Latest SQLComics

Rita the Raccoon Writes SQL

on March 28, 2024

I learned to make short form videos with my drawings this week, and, well… things are about to get weirder.

LOOK HERE

Nested Loops

on March 24, 2024

Nested loop join operators tend to look quite innocent in an estimated query execution plan. But life ain’t always so simple.

LOOK HERE

Meet the SQL Server Query Optimizer

on March 11, 2024

Thanks to Erik Darling for pointing out that it needed a little teeth.

LOOK HERE

Plan Caching in SQL Server v1

on March 4, 2024

I drew out a first visualization of how the shared plan cache in SQL Server is used when you run a query. I’m pretty sure I’ll refine and and elaborate on this in the future, so let’s call this the v1.

LOOK HERE

Latest blog posts

Finding Plans and Stats for Queries like '%something%'

on May 16, 2009

I often need to find a query plan in the cache for a process that has run long overnight. Typically I’ll be able to figure out from our logging some of the tables involved in the query. Sometimes I will have most of the executing text but won’t know exactly what dates or reference points were included.

Continue reading

The DBA Sees Your Blocking Spids... A Bird's Eye Summary of Blocking

on April 28, 2009

Update from Kendra (Nov 2018): I’m keeping this post for posterity, but I REALLY don’t recommend the script. You’d be much better off using a production monitoring tool that did this job, or @AdamMachanic ‘s sp_WhoIsActive.

Maybe you’re a user in a reporting database running a long query in the read committed isolation level, merrily blocking a process which needs to load data.

Continue reading

Index Usage Statistics with ColumnList and Index Size

on April 25, 2009

As an add on to my last post, here is what I currently do use to track index usage. This shows usage, columns in the index, and index size on disk. The size can be quite useful to know when evaluating how much an index is worth– typically if this index is large then you’re paying a fair amount on the inserts.

Continue reading

How Stale are my Statistics?

on April 22, 2009

Update: improved/more recent version of queries for this are here.

It can be pretty difficult to manage statistics in data warehouses, or even OLTP databases that have very large tables.

Continue reading