Re: ToDo: log plans of cancelled queries - Mailing list pgsql-hackers

From Tom Lane
Subject Re: ToDo: log plans of cancelled queries
Date
Msg-id 9735.1357920671@sss.pgh.pa.us
Whole thread Raw
In response to Re: ToDo: log plans of cancelled queries  (Alvaro Herrera <alvherre@2ndquadrant.com>)
List 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



pgsql-hackers by date:

Previous
From: Alvaro Herrera
Date:
Subject: Re: foreign key locks
Next
From: Stephen Frost
Date:
Subject: Re: ToDo: log plans of cancelled queries