Sql-Server

Category: sql-server

Lost Updates Under Read Committed Snapshot Isolation (RCSI)

Lost Updates Under Read Committed Snapshot Isolation (RCSI)

I shared an image on social media this week that describes how I feel about isolation levels in SQL Server (and its various flavors): the more concurrent sessions you have in a database reading and writing data at the same time, the more attractive it is to use version-based optimistic locking for scalability reasons.

There are two isolation levels in SQL Server that use optimistic locking for disk-based tables:

  1. Read Committed Snapshot Isolation (RCSI), which changes the implementation of the default Read Committed Isolation level and enables statement-based consistency.
  2. Snapshot Isolation, which provides high consistency for transactions (which often contain multiple statements). Snapshot Isolation also provides support for identifying update conflicts.

Many folks get pretty nervous about RCSI when they learn that certain timing effects can happen with data modifications that don’t happen under Read Committed. The irony is that RCSI does solve many OTHER timing risks in Read Committed, and overall is more consistent, so sticking with the pessimistic implementation of Read Committed is not a great solution, either.

Continue reading

PAGELATCH, PAGEIOLATCH, and LATCH Waits in SQL Server

PAGELATCH, PAGEIOLATCH, and LATCH Waits in SQL Server

I’ve long found it tricky to remember and explain the differences between three similar-sounding waits in SQL Server that all have “LATCH” in the name: PAGELATCH, LATCH, and PAGEIOLATCH waits.

Here’s an illustration that explains these waits, along with wait subtypes.

Continue reading

Jer and Kendar Explore Optimized Locking

Jer and Kendar Explore Optimized Locking

🔥 UPDATE (November 2025): Microsoft has introduced optimized locking v2 with significant improvements. The new version includes Skip Index Locks (SIL) and Query Plan LAQ Feedback Persistence, which further reduce lock overhead. The improvements are most pronounced for nonclustered indexes. Optimized locking v2 is available in SQL Server 2025 and Azure SQL.

SQL Server has a new feature that’s currently only available in Azure SQL Database: Optimized Locking.

Jeremiah Peschka joins Kendra (aka Kendar) to talk through the docs and nerd out on locks, blocks, and how to pronounce the acronym “LAQ”.

Prefer to explore optimized locking with a diagram? I’ve also got a little sketchnote for ya.

Continue reading

Msg 195: STRING_SPLIT Is Not a Recognized Built-In Function Name

Msg 195: STRING_SPLIT Is Not a Recognized Built-In Function Name

Yesterday, I was writing some Transact SQL to dust off the cobwebs. I got confused when I was playing around with the STRING_SPLIT function, and kept getting the error:

Msg 195, Level 15, State 10, Line 2
'STRING_SPLIT' is not a recognized built-in function name.

I checked my database compatibility level, which must be 130 or higher for the function to be available. My database compatibility level was 160, so that was fine.

Continue reading

Dear SQL DBA - Performance Tuning with Erik Darling

Dear SQL DBA - Performance Tuning with Erik Darling

By Kendra Little on August 18, 2023

SQL Server performance tuning expert Erik Darling joins the podcast today to chat about how good queries can go bad and how bad queries can get better.

He also answers the question on everyone’s mind: if he was a database, what database would he be?

Continue reading

When NOT to Choose SQL Server to Store Your Data

When NOT to Choose SQL Server to Store Your Data

I recently posted on LinkedIn that I was interviewing for a SQL Server database administrator role for the first time in a long time. I invited folks: “Ask me your favorite interview question!”

Stephen Vakil had a great one: “when should you use SQL Server to store your data?”

For situations where SQL Server is already in use and there’s a relatively low barrier to entry, I think it’s simpler to turn this question around and ask, “When is SQL Server not a good choice for storing your data?”

This post is also available as a podcast episode, and on YouTube.

Continue reading

ChatGPT Says SSMS Is the Best SQL Server Monitoring Tool

ChatGPT Says SSMS Is the Best SQL Server Monitoring Tool

One thing I enjoy about AI chatbots is that they can help me recognize when I’ve missed something obvious.

Continue reading