HiveBrain v1.2.0
Get Started
← Back to all entries
patternMinor

Should I test against warm cache or cold cache in sql server?

Submitted by: @import:stackexchange-dba··
0
Viewed 0 times
coldsqlwarmagainstcachetestshouldserver

Problem

I'm tuning a query which runs slow the first time and fast on the subsequent runs. I understand that it is because SQL Server is using cold cache (reading from disk) the first time and using warm cache (reading from memory) the second time. When tuning queries in real-world scenarios should I tune using the warm cache or the cold cache? I've tried finding books or articles on this subject but couldn't find anything. Do you guys know of any resources that I can use to expand my knowledge on this subject?

Solution

Great question. Always test with a warm cache, and measure the CPU, reads, and writes, not just the elapsed time. Running with a cold cache is an unusual scenario, and really just measures your IO performance.

Context

StackExchange Database Administrators Q#318562, answer score: 3

Revisions (0)

No revisions yet.