erikdarlingdata/DarlingData

sp_QuickieStore: Are the various "last_" columns named as we want them to be?

Closed this issue · 2 comments

Which script is your question about?

Script Name: sp_QuickieStore

Script version

4.9

Is your question about how they work, or the results?

how the scripts work

Okay, what's your question?

Consider the column in the expert mode output called last_cpu_time_ms. When I read that, I think "this is the cpu time in ms from the last time that the plan/query ran". Inspecting the code, we see that it is defined as MAX((qsrs.last_cpu_time / 1000.)) over a grouping of plan_id. That means that it's not the value from the last run, it's the maximum of the last runs over all of the time periods in the time interval we're considering. I discovered this after running sp_QuickieStore multiple times in a day. Each time, I saw the same frighteningly high value in one of the last_ fields even though I knew that the query in question ran hundreds of times per hour. I was very confused. The other various last_ columns share this behaviour.

My question is just "is this behaviour what we want?". I can't call it a bug, because this was quite obviously done on purpose.

IMPORTANT: If you're going to contribute code, please read the contributing guide first.
https://github.com/erikdarlingdata/DarlingData/blob/main/CONTRIBUTING.md

Done that. I'm perfectly happy to contribute, but if my work on finding regressed queries is anything to go by (it's nearly done, I swear!), then you will be waiting months.

@ReeceGoding I’m happy to accept a correction here. I added these aggregates pretty quickly to solve a problem where execution counts were incorrect.

Closed via #492