How to figure the read/write ratio in Sql Server?

Bill Paetzke picture Bill Paetzke · May 6, 2010 · Viewed 8.5k times · Source

How can I query the read/write ratio in Sql Server 2005? Are there any caveats I should be aware of?

Perhaps it can be found in a DMV query, a standard report, a custom report (i.e the Performance Dashboard), or examining a Sql Profiler trace. I'm not sure exactly.

Why do I care?

I'm taking time to improve the performance of my web app's data layer. It deals with millions of records and thousands of users.

One of the points I'm examining is database concurrency. Sql Server uses pessimistic concurrency by default--good for a write-heavy app. If my app is read-heavy, I might switch it to optimistic concurrency (isolation level: read committed snapshot) like Jeff Atwood did with StackOverflow.

Answer

gbn picture gbn · May 6, 2010

All apps are heavy read only.

  • An UPDATE is a read for the WHERE clause followed by a write
  • An INSERT must check unique indexes and FKs, which are reads and why you index FK columns

At most you have 15% writes. I saw an article once discussing it, but can't find it again. More likely 1%.

I know that in our 6 million new rows per day DB, we still have a minimum of 95%+ reads (an estimate of course).

Why do you need to know?

Also: How to find out SQL Server table’s read/write statistics?

Edit, based on the question update...

I would leave DB concurrency until you need to change it. We've not change anything out of the box for our 6 million rows + heavy reads too

For tuning our web app, we designed it to reduce round trips (one call = one action, mutliple record sets per call etc)