When you want to know why the server’s slow, you can ask Brent. sp_BlitzFirst® checks a lot of DMVs to find common causes of server slowness.
When you turn on @ExpertMode = 1, you can see additional information like file stats, wait stats, and Perfmon counters.
To log those to a table permanently, check out the @Output parameters. In this example, I’m writing all of the working tables to the DBAtools database:
@OutputDatabaseName = 'DBAtools'
, @OutputSchemaName = 'dbo'
, @OutputTableName = 'AskBrentResults'
, @OutputTableNameFileStats = 'AskBrentResults_FileStats'
, @OutputTableNamePerfmonStats = 'AskBrentResults_PerfmonStats'
, @OutputTableNameWaitStats = 'AskBrentResults_WaitStats'
That creates the tables if they don’t already exist, and then adds the result sets each time it runs so you can track performance over time.
Why was the server slow yesterday afternoon?
When it’s time to query the data back out, you can add the @AsOf parameter with a date & time to see the main result set of alert results as of that moment in time:
That returns results within 15 minutes of either side of your time so you can see if there were any problems leading up to (or after) that moment. It’s really useful when someone says the server was slow last night.
However, that only shows the basic result set of sp_BlitzFirst® – not the detailed file/Perfmon/wait stats results. For those, you’re best off querying the tables directly for trending purposes.
v20: You Can Query Your File/Perfmon/Wait Statistics Over Time, Too
When you use the @parameter (or PerfmonStats or WaitStats), the latest version of sp_BlitzFirst® automatically creates a matching view, too, with a suffix of _Deltas. For example, if your results are in DBAtools.dbo.WaitStats, then sp_BlitzFirst automatically creates a view called WaitStats_Deltas. Querying that view will give you trending data over time because it automatically matches up samples for you to get running averages.
This way, if you run sp_BlitzFirst® in an Agent job every 5 minutes, you can track your SQL Server’s statistics over time. You can query it back out with SSMS, or your favorite reporting tool.
You can grab sp_BlitzFirst® along with all our other scripts in our handy download pack. Enjoy!