Modifying sp_QuickieStore Returned Column Order

I love QuickieStore, but I wanted some columns to be at the front end of the results returned. Namely, I wanted top_waits, query_sql_text, and query_plan right after database name. This way I don’t have to scroll over to see those values.

You can get a copy of my modified stored proc up in a forked copy of Erik’s repo.

It’s pretty easy to fix once you know where to look. I ended up updating four bits of code.

The sections I needed to update started with these comments:

  • Expert mode returns more columns from runtime stats
  • Do we want to format things?
  • For non-experts only!
  • Formatted but not still not expert output

Then, I just added these columns after database_name. I added them because I didn’t feel like rearranging the columns and breaking anything, and then just gave them a different name so it wouldn’t error with the column being in there twice.

topwaits = w.top_waits,
querytext = qsqt.query_sql_text,
queryplan = TRY_CAST(qsp.query_plan AS XML),

Here’s an example of one of the four sections I needed to update. I added a pink box around the columns so you could see the change I made.

I didn’t tinker with the stored proc’s original incarnation to begin with. I made a copy and tested it with that.

I tested it with some different parameters, and it seems like I didn’t break anything, so that’s good. I mainly look at results with the top 20 cpu in Azure SQL DB, so I wanted to make sure that still worked. I usually don’t use expert_mode or format_output, but just wanted to ensure those could still work if needed.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.