Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Test scenario:
I am only one user on database. I reset sys.dm_os_wait_stats. I run a SELECT query (table scan).

Execution time = 20 minutes, but sys.dm_os_wait_stats -> PAGEIOLATCH_SH -> Wait_time_ms = 40 minutes (2 580 252)

How is it possible that in 20 minutes: wait_time_ms > execution time ?

share|improve this question

migrated from Feb 22 '13 at 13:38

This question came from our site for professional and enthusiast programmers.

Your query could run in parallel, with two threads accumulating twice the wait time – Andomar Feb 22 '13 at 9:02
That is also cumulative wait time across the instance, not just a particular database. – Thomas Stringer Feb 22 '13 at 14:23

As the two comments mention, there are two things at work here.

  1. sys.dm_os_wait_stats records accumulated wait times since the server was restarted. So if the server has been up for a while, these can be fairly high. To get a meaningful value out of sys.dm_os_wait_stats, you need to take two snapshots e.g. 5 minutes apart and compare them to each other. Keep in mind, there you cannot tie them to a single connection. Anything on the server that is waiting for something during that time will cause a change in one of the values returned by sys.dm_os_wait_stats.

  2. If a query gets executed in parallel, each thread will use up CPU time as well as potentially wait time. So both the total CPU time as well as the total wait time for a single query can be higher than the elapsed time.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.