Re: ToDo: log plans of cancelled queries
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Alvaro Herrera <alvherre@2ndquadrant.com>
Cc: Pavel Stehule <pavel.stehule@gmail.com>, PostgreSQL Hackers <pgsql-hackers@postgresql.org>
Date: 2013-01-11T16:11:11Z
Lists: pgsql-hackers
Alvaro Herrera <alvherre@2ndquadrant.com> writes: > Tom Lane escribi: >> However, auto_explain is even worse on the other problem. You flat out >> cannot do catalog lookups in a failed transaction, but there's no way to >> print a decompiled plan without such lookups. So it won't work. (It >> would also be appropriate to be suspicious of whether the executor's >> plan state tree is even fully set up at the time the error is thrown...) > Maybe it'd work to save the query source text and parameter values > somewhere and log an explain in a different session. There wouldn't be a lot of certainty that you got the same plan. AFAICS the only thing you could do is what Stephen suggested: run EXPLAIN *before* starting the query. You could stash the text somewhere and only print it on failure, which would prevent useless log bloat. But it'd still be awfully expensive. regards, tom lane