SQLBits VI - Upcoming SQL Server event

SQLBits VI is scheduled in my calendar for Friday 16th April - and I’m expecting great things! It’s a 1 day, SQL Server event being held in London (Westminster to be semi-precise), and the theme is performance and scalability which, as I mentioned in an earlier blog post, is particularly high on my agenda at the moment. Not only does it offer high quality speakers, but it’s a free event too. [Read More]

Autogenerated SQL constraint names - why to avoid them

Autogenerated constraint names in SQL Server - are they convenient, or are they a hindrance? For me, they are a hindrance. Why should I care that SQL Server autogenerates a constraint name when I don’t explicitly specify one? Why does it matter if it names my PRIMARY KEY constraint “PK__Constrai__3214EC271FCDBCEB”, or my DEFAULT constraint “DF__Constraint__ColumnA__21B6055D”? Why should I name each constraint myself and not rely on autogenerated constraint names? Because it makes maintenance and database update deployments easier, simpler and in my opinion, safer. [Read More]

Optimising date filtered SQL queries

How you structure your SQL queries is very important and choosing the wrong approach can have big effects on the performance of the query. One of the key things that should flag up the potential for needing optimisation, is if you are using a function/calculation within a WHERE clause. These can lead to inefficient execution plans, preventing sub-optimal index use. A classic example to demonstrate this is when querying the data for a specific month. [Read More]

Using the SP:StmtCompleted SQL Profiler trace event class

One question I’ve seen popping up a few times recently, is how to check what individual statement(s) within an SQL Server stored procedure are taking the most time. The scenario is that there is a stored procedure that consists of a number of SQL statements. The stored procedure has been flagged up as running slower than perhaps it was expected to, but as there are a number of statements/queries within it, it’s not immediately clear where the time is being taken. [Read More]

High performance bulk loading to SQL Server using SqlBulkCopy

If you ever want to bulk load data into an SQL Server database as quickly as possible, the SqlBulkCopy class is your friend (in the System.Data.SqlClient namespace). Since being introduced in .NET 2.0, it has provided an extremely efficient way to bulk load data into SQL Server, and is one the classes that I see as a “must know about”. A usual scenario is where you want to dump some data into the database to then do some processing on. [Read More]

QCon London 2010

So QCon London is fast approaching, starting with 2 days of tutorials on the 8th and 9th of March, then the 3 day conference from 10th-12th. This will be my first time at QCon and I’m really looking forward to it. Having never been to many conferences in the past, the level of expectation I have is solely based on the StackOverflow DevDay in London last October. That was a great day with some very interesting (and humorous) talks, so I’m expecting even better things from QCon as it’s reputation precedes it! [Read More]

Would you like SQL cache with that?

One of the things I feel I keep badgering on about in the world of SQL Server and query tuning is to be fair and consistent when comparing the different possible variants. If you don’t level the playing field, then potentially it will lead to you thinking a particular query out-performs another when in fact the opposite could be true. It’s a bit like comparing 2 paper boys to see which one can complete a given round the quickest - if one of them has been doing the round for the past 2 weeks but the other has never done that round before, then are you going to be able to reliably tell which one is actually quickest? [Read More]