powa-team / pg_qualstats

A PostgreSQL extension for collecting statistics about predicates, helping find what indices are missing
Other
274 stars 26 forks source link

missing call to InstrEndLoop #11

Closed tvondra closed 7 years ago

tvondra commented 7 years ago

pgqs_ExecutorEnd gets called before regular ExecutorEnd, which means the instrumentation may not be finalized - there may still be data from the last loop in some of the nodes. pgqs_collectNodeStats needs to do something like this:

if (planstate->instrument)
    InstrEndLoop(planstate->instrument);

similarly to ExplainNode().

rjuju commented 7 years ago

Indeed. I wasn't aware of that, thank a lot for the report and the fix! It's fixed in 7ad33fb19d04e1f1941cf6b16383237348caad8b