Archives: July 2011
Optimize a query by thinking out of the box
Recently I had to create a simple query to lookup a single row in a table containing ranges that do not overlap. Consider this table design and example data:
CREATE TABLE MyRanges ( id INT IDENTITY(1,1) PRIMARY KEY, RangeFrom INT NOT NULL, RangeTo INT…
0 comments, 218 reads
Posted in SQL Server Notes from the Field on 26 July 2011
SQL Server – SET STATISTICS [IO|TIME] ON
My colleagues and I often joke around with “If it takes less than a second, then it’s okay!”. The reason for that is, that it is actually quite often we encounter pieces of t-sql code that does not perform good enough for what it will be used for when it…
0 comments, 295 reads
Posted in SQL Server Notes from the Field on 19 July 2011
Which database is using all my CPU #2
A few weeks back we wrote about a query to tell you which database is using up most CPU time. A natual follow up question is: Which queries are using all my CPU? I have modified the query a bit so we now get a row per execution plan instead… Read more
0 comments, 441 reads
Posted in SQL Server Notes from the Field on 12 July 2011
T-SQL Enhancement: EXECUTE WITH RESULT SETS
All developers know, that it is very important to encapsulate code in classes and methods to be able to reuse bits and pieces for other purposes than they were originally made for. The same goes for t-sql development, by using stored procedures and functions. But often you need to slightly… Read more
0 comments, 187 reads
Posted in SQL Server Notes from the Field on 5 July 2011



Subscribe to this blog