Blogs

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

Automated Deployments and the Art of the Database with Database Michael J Swart

In this episode, Michael J Swart joins the Dear SQL DBA podcast to talk about databases, automation, and how he’s come to illustrate some of the coolest blog posts ever to be written about data.

Check out Michael’s art and blog posts at michaeljswart.com, and explore his posts by illustration at https://michaeljswart.com/browse-articles-by-illustration/.

Continue reading

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.

This is an excerpt from my new comic, “Wait Stats in SQL Server.”

Continue reading

Jer and Kendar Explore Optimized Locking

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

Dear SQL DBA - Advice for Technical Leaders with Alex Robson

Ever wondered what it’s like to be a VP or Director of Engineering? I chatted with Alex Robson about leadership in technology, what you can get out of coaching or an MBA program (should you be interested), and what makes a high performing team.

Alex’s site and blog: https://robsonconsulting.services

Continue reading

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.

The issue? STRING_SPLIT is a table valued function. If your syntax uses it as a scalar function, you will still see a message that it doesn’t exist – but really the issue is that the function exists, but needs to be called with a different syntax.

Let’s look at some examples.

Continue reading

Dear SQL DBA - Performance Tuning with Erik Darling

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

What to do when they're pretty sure it was the database... all the time

It can be tiring to have the database constantly be the Prime Suspect for performance problems.

There’s a right way and a wrong way to handle it.

Continue reading

Dear SQL DBA: What's up with Tech Interviews in 2023? With Jeremiah Peschka

Tech interviews are weird and wacky. How did they get this way, and how SHOULD they be? Jeremiah Peschka joins us to discuss.

Continue reading

Database Devops Core Concepts: Migration Scripts

Database migration scripts are a popular and effective way to check database code into version control.

In this post I describe the most common features of popular migration script runners for database code deployment, along with the top gotchas that folks hit when versioning their database code with migrations.

Continue reading