Difference Between Request and Session in sp_BlitzWho

sp-blitzsql server

I'm starting to use sp_blitzwho, and I was wondering about a few of the columns.

  1. There are a set of columns that start request_ such as request_writes, and then a set of columns that start session_, such as session_writes. Could someone explain the difference between these?

  2. There is a column called wait_info. This holds a wait time and type, that I assume is what the proc call is waiting on? Is this correct?

If so what is the top_session_waits column showing? This column often has a few Waits in there?

Best Answer

One of the cool things about open source stored procedures like sp_BlitzWho is that you can actually see the source code. It's really useful when you have questions about where data is coming from and what it means.

If I open sp_BlitzWho and do a control-F for request_writes, for example, I see that it's:

COALESCE(r.writes, s.writes) AS request_writes,

And a little further down, I can see which tables the r and s aliases point to:

FROM sys.dm_exec_sessions AS s
             LEFT JOIN sys.dm_exec_requests AS r

From there, you can hit the documentation for sys.dm_exec_sessions and sys.dm_exec_requests, which explain that a request is a currently executing task (like a query), and a session is someone's connection that has been open for a while, which may have performed several requests over time.

As you suspected, wait_info is indeed what the query is waiting on - but rather than spoon-feeding you that one, I'll let you start your journey of reading the source code there. Hope that helps!