Query-Performance

Category: query-performance

When Did SQL Server Last Update That Statistic? How Much Has Been Modified Since? And What Columns are in the Stat?

When Did SQL Server Last Update That Statistic? How Much Has Been Modified Since? And What Columns are in the Stat?

Whether I’m working as a DBA, a consultant, a teacher, or just answering questions in my inbox, I always end up needing a script to inspect statistics one way or another.

Here are some freshly written scripts for a classic DBA question: what’s going on in my stats?

Continue reading

Learn to Tune Indexes in Lisbon on March 9, 2017

Learn to Tune Indexes in Lisbon on March 9, 2017

on November 30, 2016

Want to learn to tune indexes in SQL Server? I’ll be teaching a day-long pre-conference session in Portugal in March. Hope to see you there, or at SQL Saturday Lisbon (free!) the following weekend.

Continue reading

How to Tune Indexes for a Stored Procedure

How to Tune Indexes for a Stored Procedure

You’ve got an important stored procedure that you think needs index help– but it runs in environment with lots of other queries. How do you focus in and discover exactly what indexes need tuning for that procedure?

Continue reading

Why is My Query Faster the Second Time it Runs? (Dear SQL DBA Episode 23)

Why is My Query Faster the Second Time it Runs? (Dear SQL DBA Episode 23)

Today’s question is about why a query might be slow at first, then fast the next time you run it.

Continue reading

Shrinking SQL Server Data Files - Best Practices, and Why It Sucks

Shrinking SQL Server Data Files - Best Practices, and Why It Sucks

on November 8, 2016

I’ve gotten a few questions about shrinking SQL Server data files lately. What’s the best way to get shrink to run? And why might it fail in some cases?

Traditionally, every time you ask a DBA how to make shrinking suck less, they start ranting how shrinking is bad and you just shouldn’t do it. Sometimes it sounds kinda angry.

What people are trying to say is that shrinking data files is generally slow, frustrating, and painful for you.

Continue reading

Adaptive Query Processing (Dear SQL DBA Episode 21)

Adaptive Query Processing (Dear SQL DBA Episode 21)

on November 3, 2016

Episode update, April 2017: Learn About Adaptive Query Processing from Joe Sack

Microsoft shared a great video about Adaptive Query Processing, and you can learn about this new feature from Microsoft Program Manager Joe Sack. My original post below is full of speculation. Joe’s video is full of actual facts!

Continue reading

SQL Server Query Store - Filegroups and Adhoc Workloads

SQL Server Query Store - Filegroups and Adhoc Workloads

A couple of questions on SQL Server 2016’s new Query Store feature came up in my recent pre-conference session on index tuning in SQL Server. I wasn’t 100% sure of the answer offhand, so I promised to follow up in a blog post.

Continue reading