SQL Server Performance Tuning

How One Index Made a Frequently Run Procedure 3x Faster

Updated October 29, 20252 min read

Finance operations

~883 MBless data read on every run

This bills-and-refunds procedure runs often, and every run waited 2.5 seconds (2,462 ms). One index brought that under a second (918 ms).

Data read per run

Before971 MB
After88 MB

Source: average of multiple runs. Data = 118,566 → 10,785 pages × 8 KB.

Reading from disk is the slowest operation SQL Server does.

Therefore, tuning for less disk “reads” is often the primary goal.

The problem

The frequently executed stored procedure select_arBillsRefunds is performing slower than expected.

The fix

To fix the issue we added an additional index IX to tblDlvitem.

Final thoughts

Adding indexes can really speed up your SQL Server queries, but there's a catch - they might also slow things down if not used wisely.

Under the hood

Before and after, every measurement

The improvement was huge: the total number of disk reads was 10,785 instead of 118,566!

Below is the detailed breakdown by metric:

Before After Improvement
Duration (ms)*2,462918~3x
CPU (ms)*2,469922~3x
Disk (number of reads)*118,56610,785~11x
*The numbers are an average of multiple T-SQL runs

After our tuning, the stored procedure became significantly faster, with average duration dropping from 2,462 ms to 918 ms.

That’s almost 3x faster.

Per run, before and after the new index

BeforeAfter

Duration2.7x faster

Before: 2,462 msAfter: 918 ms

CPU time2.7x less

Before: 2,469 msAfter: 922 ms

Disk reads (8 KB pages)11x less

Before: 119k readsAfter: 11k reads

Values from the measurement table above. Each pair of bars is on its own scale.

In today's case, an additional index helped us slash the overall duration of the stored procedure by nearly 3x - an outstanding outcome!

But it’s very important to understand your overall workload and find a good balance between making your queries efficient and not paying too much for that.

Check Red9's SQL Server Services

SQL Server Consulting

Perfect for one-time projects like SQL migrations or upgrades, and short-term fixes such as performance issues or SQL remediation.

Discover More ➜

SQL Server Managed Services

Continuous SQL support, proactive monitoring, and expert DBA help with one predictable monthly fee.

Discover More ➜

Emergency SQL Support

Take the stress out of emergencies with immediate access to a SQL Server Sr. DBA 24x7x365

Discover More ➜

Explore All Services ➜