No One’s Perfect
I’ve been working on scripts like this for long enough to know that I don’t know everything that might happen out there in your kooky-krazy environments.
The beauty of open source is that it’s really easy to let me know, or jump in and get to fixing things on your own.
To help you figure out where things are getting messy, I’ve added a few parameters to make troubleshooting easier.
The first place to look for information or details is the help parameter.
EXEC dbo.sp_QuickieStore @help = 1;
You’ll get information about parameters, results, shortcomings, and licensing.
Of course, if you’re hitting an error whether it’s red text or logical, you probably need a bit more than this.
If you want to see the queries that the dynamic SQL builds and executes, you can use the debug mode.
EXEC dbo.sp_QuickieStore @database_name = 'StackOverflow2013', @debug = 1;
What debug mode returns:
- Dynamic SQL statements, and statement length in the Messages tab
- Supplied parameter values to the procedure
- Declared parameter values
- All temp table contents with table name identifiers
- Replacement selects for empty tables with table name identifiers
This should help you figure out what’s going wrong and when. If you find something, open an issue on GitHub to tell me about it.
If you find this proc is regularly running slowly for you, you can use run this to return query plans and see where the trouble’s at.
EXEC dbo.sp_QuickieStore @database_name = 'StackOverflow2013', @troubleshoot_performance = 1;
SET STATISTICS XML ON; for queries that touch Query Store views, where we typically will have performance issues, along with a table of queries and runtimes.
Once data is in temp tables, things are fast because they’re small. Before that, you’re at the whim and fancy of the elements.
If you come across something that you think I can fix (and isn’t just poor Query Store schema design/indexing), open an issue on GitHub to tell me about it.
This week we covered all the major aspects and features of sp_QuickieStore. I’ll do some video code reviews to close out the series for now.
Thanks for reading!