
Archive:
- October 2026 (2)
- September 2026 (5)
- August 2026 (8)
- July 2026 (8)
- June 2026 (7)
- May 2026 (7)
Search site:
Tags:
Concurrency (3) debian (3) docker (2) Execution Plans (6) Identity (1) Indexes (4) internals (11) linux (5) MongoDB (2) MR2 (2) Optimization (7) Performance (9) Performance Tuning (3) postgres (7) Powershell (2) RCSI (2) sql (2) SQL Server (26) Statistics (2) Version Store (2)
Categories:
Docker (2) Linux (4) MongoDB (2) PostgreSQL (7) Powershell (1) SQL (1) SQL Server (26)
Category: SQL Server
-
Optimizing Window Functions in Derived Datasets

In this post, we’ll look at some interesting behaviour I’ve stumbled across with window functions and derived datasets in SQL Server. I came across a query in a workload that was looking to get the most recent thing per group, a representative example in the Stack Overflow 2010 Database is below. The database is provided…
-
Filtered Indexes and Plan Parameterization

In this post, we’ll look at how filtered indexes in SQL Server work when the query is parameterised on the column of the filtered index. The query The following query in the Stack Overflow 2010 Database, provided under cc-by-sa 4.0 licence from Stack Exchange Data Dump, will find all users with the name John whose…
-
Reseed Identity – Can it Cause Clashes?

I recently had cause to reseed an identity column on a table in SQL Server, which got me wondering “If we reseed an identity column to a value lower than the existing identity values in the column, could it cause a clash?” Because why wouldn’t you wonder if you can cause something to break, whilst…
-
I Was Today Years Old When…Stored Procedures – Optional String Quotes
Today’s post is a quick one and the first in a new series I am calling “I Was Today Years Old When…” where I share simple little nuggets that I stumbled across where I think “How…HOW have I never known this” The series for me will serve as a reminder as to why I love…
-
sp_executesql and Execution Plans

Whilst I would say the actual execution plan is the most useful, estimated execution plans have their place – sometimes you just need to see estimates or a quick verification that a change you have made has had some effect on plan shape. I find them helpful to quickly see if a change made to…
-
Curse of the Catch-All query

The catch-all query – a fairly common pattern that is often seen in SQL Server apps where there is a list of results that can be filtered by one or more criteria. This usually takes the form of a stored procedure that is constructed as below. The example stored procedure is created in the Stack…
-
In a Query Plan Near You – Stats Loaded For Compilation

Something I have been making use of recently is the change in the way statistics that have been used to compile a plan are presented to us as SQL Server users. On a number of occasions I have needed to understand, or at least get some sense of, which statistics SQL Server has used to…
-
OR predicates and Indexes

In this post, we will look at how SQL Server accesses indexes when an OR predicate is used. For this demo, I am going to use the Stack Overflow Database. I am using the large 2024 version provided under cc-by-sa 4.0 licence from Stack Exchange Data Dump and running in compatibility level 160 on a…
-
KILL and Query Store

I love Query Store. I like to think of it as SQL Server’s built-in monitoring tool and I use it a lot to look at query history in terms of run times and IO metrics. One thing I learned about Query Store recently is how it deals with queries that have been killed. Setting up…
-
Transaction Types
This post is just a quick reference post that outlines the three different types of transaction in Microsoft SQL Server. AutoCommit The default. Each statement in a batch works as though it had been individually wrapped in BEGIN TRAN / COMMIT so the following code block: is effectively the same as: This moves us nicely…