[Case Study] Fixing SQL Server Deadlocks by tuning SQL performance

Problem Summary

Two procedures were involved in 80% of deadlocks related to a third-party application.

Deadlocks are a common problem handled by SQL Server automatically. Nevertheless, you have to make sure that you minimize deadlocks as much as possible because every rolled back transaction negatively influences your end-users.

What was done

To improve the stored procedure’s performance and solve the deadlocks between them, we created 2 new indexes and 2 news statistics.

In many cases, we can fix or reduce them using index tuning. Sometimes, we need to go deeper into every detail to find the main cause of the problem.

Technical background

Indexes operate “behind the scenes”: adding and removing indexes rarely changes an application’s code.

The SQL Server engine uses an index, as a reader uses a book index. Without it, the reader needs to look at every page in a book to find a word.

Indexes are the method by which SQL Server sorts and organizes the rows in tables. It allows you to quickly narrow in on the rows to satisfy the query and avoid scanning every row in the table.

In database terms, a table scan (or just scan) happens when there is no index available to help a query. They have a terrific impact on performance on large tables, but sometimes are inevitable.

The proper index can drastically increase the performance of an application. However, there are tradeoffs to almost any feature, and indexes are no exception.

Learn how to improve your SQL Server performance using Indexes

Check out more case studies here!

Picture of Mark Varnas

Mark Varnas

Hey I'm Mark, one of the guys behind Red9. I make a living performance tuning SQL Servers and making them more stable. I channel my SQL into our SQL Managed Services, SQL Consulting and our internal database products.

Leave a Reply

Your email address will not be published. Required fields are marked *