Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sp_BlitzFirst: Wait Stats Details does not display correct number of seconds that the server spent waiting #3507

Closed
aroques opened this issue Apr 30, 2024 · 4 comments · Fixed by #3508

Comments

@aroques
Copy link

aroques commented Apr 30, 2024

Version of the script
Look in the stored procedure, and it'll have a version date & number near the top. Put that in here. If it's not the current version (dated in the last month), then upgrade to the current version and test that before reporting a bug - we fix a lot of stuff in each new build. We'll flat out close bug reports for older builds.

SELECT @Version = '8.19', @VersionDate = '20240222';

What is the current behavior?
This Details of the Wait Stats finding displays the @Seconds variable for how long that the server spent waiting on a particular wait (the default is 5 as shown below):
image

If the current behavior is a bug, please provide the steps to reproduce.
Run sp_BlitzFirst on a server busy enough that it takes longer than @Seconds to run.

What is the expected behavior?
This Details of the Wait Stats finding should display the number of seconds that it actually spent waiting which in the above example is 122 seconds.

Which versions of SQL Server and which OS are affected by this issue? Did this work in previous versions of our procedures?
Product: Microsoft SQL Server Enterprise: Core-based Licensing (64-bit)
Operating System: Windows Server 2016 Standard (10.0)
Version: 14.0.3465.1

@BrentOzar
Copy link
Member

It does. Do a search in the code for "over the last" and you'll see the relevant portions:

    'For ' + CAST(((wNow.wait_time_ms - COALESCE(wBase.wait_time_ms,0)) / 1000) AS NVARCHAR(100)) + ' seconds over the last ' + CASE @Seconds WHEN 0 THEN (CAST(DATEDIFF(dd,@StartSampleTime,@FinishSampleTime) AS NVARCHAR(10)) + ' days') ELSE (CAST(@Seconds AS NVARCHAR(10)) + ' seconds') END + ', SQL Server was waiting on this particular bottleneck.' + @LineFeed + @LineFeed AS Details,

If you believe that's incorrect, can you send a screenshot that includes these 3 things:

  • The exact parameters used for sp_BlitzFirst
  • The result sets
  • The duration at the bottom right of sp_BlitzFirst
    Thanks!

@aroques
Copy link
Author

aroques commented Apr 30, 2024

Exact parameters are none so they are defaulted.
@Seconds defaults to 5 so the 0 seconds case does not get hit.

The result set and duration are shown in the first screenshot, but here's a complete screenshot of sp_BlitzFirst with defaulted parameters (@Seconds is 5) waiting 12.5 minutes:
image

@BrentOzar
Copy link
Member

HAHAHA, twelve minutes, good Lord, that's bad. OK, cool, I'll reopen this and get that in, heh.

@BrentOzar BrentOzar reopened this Apr 30, 2024
BrentOzar added a commit that referenced this issue May 1, 2024
The headline news result set now shows the accurate number of seconds used for the wait stats sample. Closes #3507.
@BrentOzar
Copy link
Member

Fixed! Here's a screenshot showing the server under load.
Screenshot 2024-05-01 at 6 56 12 AM

BrentOzar added a commit that referenced this issue May 1, 2024
…tats_seconds

#3507 sp_BlitzFirst wait stats seconds
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants