Launch week: the Season Pass & Fundamentals Week are 50% off — ends in 19d 10h 20mSee the sale

Author: Erik Darling

Restoring tempdb since GETDATE(). Now blogging at ErikDarlingData.com.
Performance Tuning

Improved diagnostics for query execution plans that involve residual predicate pushdown

I love stuff like this!
Even though it's not on my list of dream features, it's pretty neat. Getting new views into what SQL is doing when queries execute is pretty cool. You can read the short and gory details at the KB here: Improved diagnostics for query execution plans that involve residual predicate pushdown in SQL Server 2012

Read more about Improved diagnostics for query execution plans that involve residual predicate pushdown 6 comments — Join the discussion
Performance Tuning

Filtered Indexes: Just Add Includes

I found a quirky thing recently While playing with filtered indexes, I noticed something odd. By 'playing with' I mean 'calling them horrible names' and 'admiring the way other platforms implemented them'. I sort of wrote about a similar topic in discussing indexing for windowing functions. It turns out that a recent annoyance could also…

Read more about Filtered Indexes: Just Add Includes 30 comments — Join the discussion
Performance Tuning

Tracking tempdb growth using Extended Events

Everyone knows tempdb is a wierd [sic] place
Brent refers to it as a public toilet. I agree with that sentiment. It will let anyone in to do whatever they want.

Recently I was trying to track down what was causing tempdb's log to grow. I was thinking about using a Trace to do it, but then I remembered that it's at least 2015, and I should be using Extended Events. Don't worry, there won't be any PowerShell. You can keep reading.

Read more about Tracking tempdb growth using Extended Events 38 comments — Join the discussion
Performance Tuning

Trace Flag 2330: Who needs missing index requests?

Hey, remember 2005?
What a great year for... not SQL Server. Mirroring was still a Service Pack away, and there was an issue with spinlock contention on OPT_IDX_STATS or SPL_OPT_IDX_STATS. The KB for it is over here, and it's pretty explicit that the issue was fixed in 2008, and didn't carry over to any later versions. For people still on 2005, you had a Trace Flag: 2330.

Read more about Trace Flag 2330: Who needs missing index requests? 7 comments — Join the discussion
Performance Tuning

The case for Query Store in tempdb

Query Store is so cool
Billed as a flight data recorder for SQL Server, the Query Store is a repository of execution plan information, like the plan cache, except a bit more actionable. And it has a GUI.

You can read all about what it does and what you can do with it around the internet. You can be suitably impressed and enchanted by the promise of data that's persisted between restarts, being able to quickly and easily address plan regression issues, and so forth.

Read more about The case for Query Store in tempdb 15 comments — Join the discussion

SQL Server Features I’d Like To See, Oracle Edition

BUT FRANCE HAS A PONY
I really like SQL Server. Most of the time. Okay, so most of the time I like SQL Server most of the time. Don't get me wrong, if I had to go back through the career-time continuum and pick a RDBMS to work with, I'd probably still choose it over Oracle. Probably. And, because I don't exclusively grow facial hair from my neck, I wouldn't be allowed to choose PostgreSQL. They'd kick me off the mailing list.

Read more about SQL Server Features I’d Like To See, Oracle Edition 55 comments — Join the discussion
T-SQL & Development

Window Functions and Cruel Defaults

My First Post Here...
Well, my first technical post, was about how the default index creation method is OFFLINE. If you want that sweet, sweet Enterpri$e Edition ONLINE goodness, you need to specify it. It's been a while since that one; almost six months to the day. So here's another one!
But Window Functions Are Awesome
Heck yeah they are. And how. Boy howdy. Etc. You get the point. I'm enthusiastic. What can be cruel about them? Glad you asked!

Read more about Window Functions and Cruel Defaults 5 comments — Join the discussion
Performance Tuning

Is leading an index with a BIT column always bad?

“Throughout history, slow queries are the normal condition of man. Indexes which permit this norm to be exceeded — here and there, now and then — are the work of an extremely small minority, frequently despised, often condemned, and almost always opposed by all right-thinking people who don't think bit columns are selective enough to…

Read more about Is leading an index with a BIT column always bad? 5 comments — Join the discussion
Performance Tuning

Clustered Index key columns in Nonclustered Indexes

Clustered indexes are fundamental
And I'm not just saying that because Kendra is my spiritual adviser!

They are not ~a copy~ of the table, they are the table, ordered by the column(s) you choose as the key. It could be one. It could be a few. It could be a GUID! But that's for another time. A long time from now. When I've raised an army, in accordance with ancient prophecy.

Read more about Clustered Index key columns in Nonclustered Indexes 26 comments — Join the discussion
Performance Tuning

Finding Tables with Nonclustered Primary Keys and no Clustered Index

i've seen this happen
Especially if you've just inherited a database, or started using a vendor application. This can also be the result of inexperienced developers having free reign over index design.

Unless you're running regular health checks on your indexes with something like our sp_BlitzIndex® tool, you might not catch immediately that you have a heap of HEAPs in your database.

Read more about Finding Tables with Nonclustered Primary Keys and no Clustered Index 31 comments — Join the discussion
Performance Tuning

Indexing for GROUP BY

It's not glamorous And on your list of things that aren't going fast enough, it's probably pretty low. But you can get some pretty dramatic gains from indexes that cover columns you're performing aggregations on. We'll take a quick walk down demo lane in a moment, using the Stack Overflow database. Query outta nowhere! [crayon-6a37e9749ace5863475743/]…

Read more about Indexing for GROUP BY 9 comments — Join the discussion