Skip to content

Feature Request: sp_QueryReproBuilder plan search #649

@codykonior

Description

@codykonior

One of the biggest things I use sp_QueryReproBuilder for is constructing queries from cache, with the @query_text_search parameter, to find queries to test index recommendations against.

But I think it would also be cool to add a dedicated flag to pull out queries that have missing index recommendations in the XML. That will help save time in some situations, both when I'm targeting something with @query_text_search, but also just in general.

In my own copy I added a @has_missing_index BIT = NULL parameter, and then right above "Add include plan IDs", I added this:

IF @has_missing_index = 1
BEGIN
        SELECT @sql += N'
AND      qsp.query_plan LIKE ''%<MissingIndexes>%'''
END

It's not beautiful or elegant or anything, but it seems to work. I also experimented converting qsp.query_plan to XML first and checking for that property "properly", but then I got lots of errors about over-nested XML and so went back to the simple string way.

If you think this would also be useful then please add it. If not, that's fine, too.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions