I was recently asked to help tune a stored procedure that has been historically taking between 55 and 60 seconds to complete. Overall the code wasn’t too complex but getting to the root cause did surprise me a bit.
Tag: Development
Query tuning 101: How to measure Query Plan I/O cost
If you’re a DBA or a developer chances are you’ve looked at a query plan or two. While looking at your plan you may have noticed that each operator has a cost. Did you know that the cost is measurable?
Query tuning 101: Problems with IN ()
If you’re a DBA or database developer, chances are you will have to write or rewrite queries from time to time. Rewriting may be for new features or simply to improve the performance of existing code.
Why Halloween slowed your queries
Let me start by saying that this isn’t your typical post about the Halloween problem. This is intended to describe a couple different performance problems you should be keenly aware of.
Why I don’t love SELECT INTO
Long ago there were locking / blocking problems with the SELECT INTO statement. That’s not the case anymore and for AdHoc operations and investigation of data SELECT INTO is very helpful.
A quick note comparing ISNULL vs COALESCE
There are hundreds of blogs that compare the T-SQL ISNULL function with the ANSI standard COALESCE function. There are also plenty of arguments of why you should use one over the other.
Making the case for CamelCase naming
Coding and database standards like a religion or politics. Some people are fanatics and others really don’t care whatsoever. Getting stuck between any combination of the right and left or those that don’t care can be entertaining and sometimes outright dangerous.
Splitting CSV strings in SQL 2016
Up until SQL Server 2016, we had to write our own functions to split a CSV string into a table list. This was accomplished by writing a table value user defined function.
When should I use a CTE?
If I had a dollar for every CTE solution to a simple query in the forums (pick any SQL forum), I’d be Mark Cuban. With that said I thought it would be a good idea to ask if a CTE was actually the right solution or if it’s just the new trend and everyone uses them just because they can and all the cool kids are too. Let’s put it this way: If I had a dollar for every time a CTE was misused, I’d be Mark Cuban… or at least Robert Herjavec.
I’m speaking at SQL Saturday 553 in Oklahoma City
This will be my first time speaking in Oklahoma on 8/27 in Oklahoma City. I’ve been to several customers there but have yet to meet people from the users groups.
My session is Analyze your query plan like a Microsoft Engineer! (SQL 2016 Edition). If you deal with tuning, monitoring, or developing queries for SQL Server, you’ll want to check this out.
You can register for this free event here: http://www.sqlsaturday.com/553/eventhome.aspx
