Do you have a comment or suggestion to improve SQL Server? We’d love to hear it!

Live Query Statistics only showing the first query in a batch

In SSMS 13.0.16000.28, click Query, Include Live Query Statistics.

Start a multi-batch query where each query takes a non-trivial amount of time, like this:

DECLARE @DontGoToEngland TABLE (Stuffing NVARCHAR(MAX));
INSERT INTO @DontGoToEngland
SELECT text
FROM sys.messages;
INSERT INTO @DontGoToEngland
SELECT text
FROM sys.messages
ORDER BY text;
INSERT INTO @DontGoToEngland
SELECT text
FROM sys.messages
ORDER BY text;

Execute the query, and only the first query's Live Query Statistics shows up as the batch runs (in this case, the first insert.) The Live Query Statistics no longer updates after the first query finishes - until the entire batch finishes. The status bar in SSMS says "Executing query... 100%" even though other queries in the batch are running, and their live query stats don't show up.

10 votes
Sign in
(thinking…)
Sign in with: oidc
Signed in as (Sign out)

We’ll send you updates on this idea

AdminMicrosoft SQL Server (Product Manager, Microsoft Azure) shared this idea  ·   ·  Flag idea as inappropriate…  ·  Admin →

Upvotes: 4

<=-=Dec 4 2016 5:14PM=-=>

Just to be clear – this is different than the fixed bug 1051306, which was about only showing the current query. (Now it just only shows the first.)

<=-=Apr 26 2017 2:29PM=-=>

This isn’t fixed in 14.0.17099.0 (the new SQL Server Management Studio 17 that went out today.)

2 comments

Sign in
(thinking…)
Sign in with: oidc
Signed in as (Sign out)
Submitting...
  • Brent Ozar commented  ·   ·  Flag as inappropriate

    Here's another repro using a couple of CPU-heavy scripts. As of the Sept 2019 release, the first live query plan shows, and then after it finishes, the animations continue but it still shows "Query 1" as the query that's running:

    /* Query 1 */
    SELECT COUNT(DISTINCT value)
    FROM sys.messages m
    CROSS APPLY STRING_SPLIT(UPPER(LOWER(m.text)), ' ');

    /* Query 2 */
    SELECT COUNT(DISTINCT value)
    FROM sys.messages m
    CROSS APPLY STRING_SPLIT(LOWER(UPPER(m.text)), ' ');

Feedback and Knowledge Base