"0 to 60" : Switching to indirect checkpoints
In a recent tip, I described a scenario where a SQL Server 2016 instance seemed to be struggling with checkpoint times. The error log was populated with an alarming number of FlushCache entries like...
View ArticleVisualizing the Tipping Point with Plan Explorer
The tipping point is a term I first heard used by SQL Server performance tuning guru and long-time SentryOne Advisory Board member Kimberly Tripp – she has a great blog series on it here. The tipping...
View ArticleFundamentals of table expressions, Part 3 – Derived tables, optimization...
In Part 1 and Part 2 of this series, I covered the logical, or conceptual, aspects of named table expressions in general, and derived tables specifically. This month and the next I’m going to cover the...
View ArticleFundamentals of table expressions, Part 4 – Derived tables, optimization...
This article is the fourth part in a series on table expressions. In Part 1 and Part 2 I covered the conceptual treatment of derived tables. In Part 3 I started covering optimization considerations of...
View ArticleSometimes you CAN upsize a column in-place
Last year, Andy Mallon blogged about upsizing a column from int to bigint with no downtime. (Why this isn't a metadata-only operation in modern versions of SQL Server is beyond me, but that's another...
View ArticleParse parameter default values using PowerShell – Part 1
If you have ever tried to determine the default values for stored procedure parameters, you probably have marks on your forehead from hitting it on your desk repeatedly and violently. Most articles...
View ArticleParse parameter default values using PowerShell – Part 2
In my last post, I showed how to use TSqlParser and TSqlFragmentVisitor to extract important information from a T-SQL script containing stored procedure definitions. With that script, I left out a few...
View ArticleWhen Do SQL Server Sorts Rewind?
Introduction Rewinds are specific to operators on the inner side of a nested loops join or apply. The idea is to reuse previously-computed results from part of an execution plan where it is safe to do...
View ArticleParse parameter default values using PowerShell – Part 3
In part 1 and part 2 of this series, I introduced ParamParser: a PowerShell module that helps parse parameter information – including default values – from stored procedures and user-defined functions,...
View ArticleA use case for sp_prepare / sp_prepexec
There are features many of us shy away from, like cursors, triggers, and dynamic SQL. There is no question they each have their use cases, but when we see a trigger with a cursor inside dynamic SQL, it...
View ArticlePerformance of sys.partitions
sys.partitions appears to be a UNION ALL of two result sets (row store and columnstore) and most of my queries are resulting in two scans of sysrowsets. Is there any filter I can put on a query of...
View ArticleNumber series generator challenge solutions – Part 2
This is the second part in a series about solutions to the number series generator challenge. Last month I covered solutions that generate the rows on the fly using a table value constructor with rows...
View ArticleHow to Write a Query with Multiple Behaviors
Oftentimes, when we write a stored procedure, we want it to behave in different ways based on user input. Let's look at the following example: CREATE PROCEDURE Sales.GetOrders ( @CustomerID AS INT =...
View ArticleDeprecated features to take out of your toolbox – Part 1
Microsoft is not in the habit of deprecating things these days, but when they do, it's for a reason – and it's certainly not because they want to make your life harder. On the contrary, it is almost...
View ArticleUnderstanding Execution Plan Operator Timings
SQL Server 2014 SP2 and later produce runtime (“actual”) execution plans that can include elapsed time and CPU usage for each execution plan operator (see KB3170113 and this blog post by Pedro Lopes)....
View ArticleNumber series generator challenge solutions – Part 3
This is the third part in a series about solutions to the number series generator challenge. In Part 1 I covered solutions that generate the rows on the fly. In Part 2 I covered solutions that query a...
View ArticleDeprecated features to take out of your toolbox – Part 2
In my last post, I illustrated one reason you should stop using deprecated system tables like sysprocesses. This wasn't for performance reasons, directly, or to simply follow Microsoft's documented...
View ArticleHow Parallel Plans Start Up – Part 1
This five-part series takes a deep dive into the way SQL Server row mode parallel plans start up. This first part covers the role of the parent task (coordinator) in preparing the plan for parallel...
View ArticleHow Parallel Plans Start Up – Part 2
This is the second part of a five-part series taking a deep dive into the way SQL Server row mode parallel plans start up. By the end of the first part, we had created execution context zero for the...
View ArticleNumber series generator challenge solutions – Part 4
This is the fourth part in a series about solutions to the number series generator challenge. Many thanks to Alan Burstein, Joe Obbish, Adam Machanic, Christopher Ford, Jeff Moden, Charlie, NoamGr,...
View Article