Recording of Adding Parameter info to sp_BlitzWho – Part 2

By Greg 1 comment

I did some more work on sp_BlitzWho recently. Check out the clip on YouTube below. If you missed part 1, you can find it here.

Recording of Adding Parameter info to sp_BlitzWho – Part 1

By Greg 1 comment

I did some work on sp_BlitzWho recently. Check out the clip on YouTube. Part 2 will hopefully come soon:

When are different Strings equal?

By Greg 2 comments

When working on the First Responder Kit recently, I needed to compare two strings and came across a bit of an oddity on how SQL compares strings. Let’s check it out. First, put the following stored proc in to your database: Pretty simple, we’re going to take 2 strings in, compare them together. If they’re […]

CTEs are not Staging Tables

By Greg 1 comment

If you have a complex query, a CTE (Common Table Expression) can be a great way to break down the query into individual parts. What is often overlooked by developers is that CTEs can cause significant performance problems when used incorrectly. A common pattern I have seen is joining to a CTE multiple times. This […]

Option Recompile

By Greg No comments

When doing query tuning, sometimes the answer can be that it’s just better to get SQL Server to recompile a plan based on the data passed in. You might have a batch process that runs every hour and sometimes it has only a few hundred rows, other times it has a few billion rows. The […]

Rollup and Cube Part 3

By Greg No comments

In the previous 2 posts we have looked at how Rollup and Cube work. This time we’re going to look at how you might implement these in the real world. I don’t think ROLLUP has a great use in the real world (feel free to comment below if you have a real use for it). […]

Rollup and Cube Part 2

By Greg No comments

Previously in Part 1, we looked at the ROLLUP keyword that can be applied to SQL Select queries. We are now going to look at the similar, but different CUBE keyword. As we saw last time, the ROLLUP keyword would sum each part of the GROUP BY and give you a running total. The CUBE […]

Rollup and Cube Part 1

By Greg No comments

I have recently come across these 2 keywords: ROLLUP and CUBE. These keywords allow you to get running totals when you group by some data. In this post we’ll have a look at how ROLLUP works, and in the next post we’ll see how CUBE works, and then in the final post we’ll look at […]

Query Hints

By Greg No comments

SQL Server has a couple of keywords that can be added to a query to give the query optimizer some ideas on how to best compile your SQL statements. Hints like FORCE ORDER, MAXDOP and NOEXPAND can be used as a way to tell the optimizer “Hey, I’ve got this idea, you should try it.” […]

Are Stored Procedure Parameters always cached?

By Greg No comments

Does SQL Server always cache your parameters? Does it always keep track of what you pass in?