truncate

Does Truncate Table Reset Statistics?

Short answer: the SQL Server optimizer will know that the table was truncated, but statistics might not update when you expect. For the long answer, let’s walk through an example using the WideWorldImporters sample database. I’ll be using Trace Flag 3604 and 2363 to get SQL Server to print information about how it optimized my query out to […]

sql-underpants

Signs Your SQL Server is Running with Scissors (Dear SQL DBA Episode 24)

Does your team know what it’s doing with SQL Server? Learn what a consultant looks for when assessing a team, and signs that SQL Server may be badly configured. Watch the 23 minute video, or scroll down to read a summary of this episode. If you enjoy the podcast, I’d appreciate your review on iTunes! Learn how […]

octomizer-small

Learn to Tune Indexes in Lisbon on March 9, 2017

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. Here’s the details on the course and how to reserve a seat. How to Tune SQL Server Indexes with Execution Plans […]

stopwatch

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? The best way to tune indexes in a stored procedure The best way is to run the stored procedure […]

slow-then-fast

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. Watch the 26 minute video or scroll on down and read the written version of the episode instead. If you enjoy the podcast, I’d appreciate your review on iTunes! Info on how to ask questions […]

locks

Should I change the ‘locks’ configuration in SQL Server?

I recently got a fantastic question from a reader regarding lock usage in SQL Server. Here’s the question: One of my production databases has a total lock count around 25,000 (select count(*) from sys.dm_tran_locks). The configuration setting for locks is set to the default of zero. This lock count is due to multiple procedures which […]

dear-sql-dba-episode-22-700x700

Should I Upgrade to SQL Server 2016? (Dear SQL DBA Episode 22)

It’s a big week for SQL Server! And it’s the perfect week to talk about this week’s question, which is about explaining to your management why it’s worth it to upgrade to SQL Server 2016, and which features you can use right away. Watch the 24 minute video, scroll down to read the article, or […]