Tag Info

Hot answers tagged

6

SQL Server will typically optimize the IN to the same as the multiple OR statements. Take this for example: use AdventureWorks; go select BusinessEntityID from HumanResources.Employee where BusinessEntityID = 153 or BusinessEntityID = 25 or BusinessEntityID = 37; select BusinessEntityID from HumanResources.Employee where BusinessEntityID in (153, 25, ...


5

This is tricky, because you've modeled your bookings as time intervals with granularity as fine as your DB allows. Perfectly natural to do, but as you've found out it makes some comparisons difficult. Max of For each booking that overlaps given timeRange return sum of each booking that overlaps this booking and given timeRange The ...


5

Unless you have something which the application must supply all the time, I think it would be best to let the database related stuff be handled by the database itself. This will allow you to have the DB to do all the heavy lifting, while allowing the application to remain as lightweight as possible so that it can handle whatever it is that the user needs ...


4

Is this industry standard to rush things? To some degree. Companies are in business to make money, and (almost universally) business people want things faster - even at the expense of some hand-wavy quality. Furthermore, is it industry standard not to do testing, comment code, create documentation etc.. ? At my current company, we have no QA ...


4

Because many teams are clueless about benefits and drawbacks of the different features of Microsoft SQL Server. Imagine a slow app. Management has a choice: either throw more hardware (which translates into immediate and substantial cost), or blame developers for not doing their job correctly and expect them to make it faster (which translates into ...


1

So Esoteric's solution worked but it still bothered me since it feels kinda bruteforce-ish. I knew there had to be a solution that only looked at the relevant data (start, end and qty) and didn't need to translate it into a different form. Then I remembered order by and a solution hit me. Ordered edge tally Create a list of edges and their quantities ...


1

If a unit test breaks, you usually know exactly what went wrong; when an integration test breaks, it's a hint that a piece of your process has something wrong with it. If you're comfortable with this and your SP isn't incredibly complex, the integration tests from C# should be fine. A few things to consider : Use a unit testing framework. Calling them ...


1

In less words, this sounds like unit testing. Your "C# scripts" are the units of pass/failure. Is there any practice better than this one to validate SQL based code ? You shouldn't be concerned with validating the actual SQL code. All you really should care about is the validity of the data and the result. You should be decoupling your unit tests ...


1

You seem to already know what the table hint NOLOCK does, but you question "why" do people use it so frequently. In people's experience, or people that have shared experience with them, they have alleviated concurrency problems before by using the read uncommitted table hint. Despite what the hint does (the lack of issuing a shared lock on data to prevent ...


1

what way is correct ... Being cynical just for a moment, none of them. Try as we might; we never get it completely right. But we can try. ... for performance ... Database. For raw data processing power, leverage your DBMS. You don't say which one you're using but all the Big Players have some sort of procedural language (PL/SQL, T-SQL, ...


1

You're basically writing a compiler, which translates from SQL to whatever your datastore understands. In the end, you'll probably have the following parts: a Parser which takes SQL and produces an Abstract Syntax Tree a bunch of Visitors which do semantic analysis and/or rewriting on the AST an Interpreter which finally executes the (processed) query ...



Only top voted, non community-wiki answers of a minimum length are eligible