Deadlock Troubleshooting, Part 1
A deadlock is a circular blocking chain, where two or more threads are each blocked by the other so that no one can proceed. When the deadlock monitor thread in SQL Server detects a circular blocking...
View ArticleDeadlock Troubleshooting, Part 2
In this post I’ll look at an actual deadlock, then troubleshoot it using the steps I described in Deadlock Troubleshooting, Part 1 so you can see them in action. This is a simplified version of a...
View ArticleDeadlock Troubleshooting, Part 3
Here’s an example of the classic scenario that is usually used to introduce the concept of a deadlock in a database: Process AProcess B 1. Begin Transaction1. Begin Transaction 2. Update Part...
View ArticleToday's Annoyingly-Unwieldy Term: "Intra-Query Parallel Thread Deadlocks"
I've received a couple of questions in email and in comments about deadlocks involving mysterious-sounding non-lock resources like "exchangeEvent" and "threadpool". There are a couple of examples in...
View ArticlePurging Data
This post is about deleting a lot of rows, as you might do in a data archiving or purging task. By “a lot of rows”, I mean anything from a few thousand rows up to billions. This may seem elementary,...
View ArticleFinding procedure cache bloat
Explicitly parameterizing queries is a well-known best-practice for database app developers. There are cases where it can make sense to execute a query unparameterized, but, in general, you should...
View ArticlePurging Data
This post is about deleting a lot of rows, as you might do in a data archiving or purging task. By “a lot of rows”, I mean anything from a few thousand rows up to billions. This may seem elementary,...
View ArticleSQL Server Sizing Resources
Recently, I was asked whether Microsoft had any SQL Server hardware sizing tools. The asker referred me to http://www.sizinglounge.com as an example of what he was looking for. (Sizing Lounge...
View ArticleT-SQL UDTs. (Huh!) What are they good for?
(The title of this post might seem a little inflammatory, but it’s not just a troll -- I really do think that people should seriously question whether it’s wise to use T-SQL User Defined Data Types....
View ArticleQuery Hash Statistics, a query cost analysis tool, now available for download
Some time ago I described the query fingerprint and query plan fingerprint (a.k.a. query hash / query plan hash) features that were added in SQL Server 2008. A fingerprint identifies all queries or...
View ArticleLiving with SQL’s 900 Byte Index Key Length Limit
We recently had a situation where we needed to interface with an external non-relational data source that happened to use really long strings to identify entity instances. These identity strings had...
View ArticleQuery Tuning Fundamentals: Density, Predicates, Selectivity, and Cardinality
A few days ago I was in the middle of writing up a quick post about a query performance problem I recently ran into. The writeup referenced predicate selectivity, and I found myself wondering whether...
View ArticleDon’t depend on expression short circuiting in T-SQL (not even with CASE)
There are a fair number of blog posts and forum discussions regarding expression short circuiting in T-SQL. Some of the most authoritative posts, like this one, come to the following conclusions: (a)...
View ArticleRow Goals Gone Rogue
This post discusses “row goals“, but with a twist. The point is to illustrate how row goals can cause unnecessarily slow queries. First, run this script: USE tempdb GO IF OBJECT_ID ('even') IS NOT...
View ArticleFiltered Indexes and Forced Parameterization: Can’t we all just get along?
We have a database here that stores information about Azure SQLDB health issues; it was chugging along fine for months, then earlier this week it started to struggle. You can see the large increase in...
View Article
More Pages to Explore .....