Press "Enter" to skip to content

Storing Wait Stats In tempdb

Max Vernon has a script which loads a bunch of wait stats definitions and then collects wait stat details:

Performance troubleshooting should begin with capturing wait stats so we can understand where SQL Server is busy. The script below captures wait stats into a table in tempdb; the script should be ran via a SQL Server Agent job or some other scheduling mechanism.

I like the definitions that Max provides.  My only recommendation would be to store this data someplace a bit more permanent than tempdb.

One Comment

  1. Max Vernon
    Max Vernon 2018-08-14

    Generally, I agree with the recommendation of storing wait-stats data in a more permanent place than tempdb. My script uses tempdb since tempdb exists everywhere and doesn’t require the user to create a new database. Even though the data will be deleted on instance restart, this at least lets you see what happened every 5 minutes since the last server startup.

Comments are closed.