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

INSERT INTO #QueryDetailsStagingTable Does Not Scale #40

Open
DatabaseJase opened this issue Aug 6, 2024 · 0 comments
Open

INSERT INTO #QueryDetailsStagingTable Does Not Scale #40

DatabaseJase opened this issue Aug 6, 2024 · 0 comments

Comments

@DatabaseJase
Copy link

-- Detailed Report: Use @SqlCmd load details into #QueryDetailsStagingTable - START

I have added an OPTION (FORCE ORDER) to this statement because when there is a high volume of data in [sys].[query_store_runtime_stats] the execution plan does not scan the #DeleatableQueryTable resulting in a query that executes for over 12 hours without completing. the OPTION (FORCE ORDER) allows the query to run in a reasonable amount of time.

I did not want to use the OPTION (FORCE ORDER) solution so I have re-written the SELECT as a CTE to generate a query plan that executes in 15 minutes with the same volume of data.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant