Skip to content

sp_BlitzIndex - @Debug = 1 returns results from #BlitzIndexResults before the table is populated #3776

@VladDBA

Description

@VladDBA

Version of the script

8.28 - 20251124

What is the current behavior?

When running

EXEC sp_BlitzIndex @GetAllDatabases = 1, @Debug = 1, @Mode = 4;

The result set for #BlitzIndexResults is empty because the table is queried before it's populated

If the current behavior is a bug, please provide the steps to reproduce.

Run any of these:

EXEC sp_BlitzIndex @GetAllDatabases = 1, @Debug = 1, @Mode = 4;
EXEC sp_BlitzIndex @GetAllDatabases = 1, @Debug = 1, @Mode = 0;
EXEC sp_BlitzIndex @DatabaseName = 'StackOverflow', @Debug = 1, @Mode = 4;
EXEC sp_BlitzIndex @DatabaseName = 'StackOverflow', @Debug = 1, @Mode = 0;

What is the expected behavior?

For the result belonging to the debug output of #BlitzIndexResults to not be empty when running with @Mode = 0 or @Mode = 4.

Which versions of SQL Server and which OS are affected by this issue? Did this work in previous versions of our procedures?

This is independent of SQL Server and/or OS version.

PR with fix will be coming shortly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions