Re: Capturing EXPLAIN ANALYZE for a query without discarding the normal result set - Mailing list pgsql-hackers

From Jim Nasby
Subject Re: Capturing EXPLAIN ANALYZE for a query without discarding the normal result set
Date
Msg-id 52D63A68.6000702@nasby.net
Whole thread Raw
In response to Re: Capturing EXPLAIN ANALYZE for a query without discarding the normal result set  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
On 1/13/14, 9:14 PM, Tom Lane wrote:
> Dave Cole <davejohncole@gmail.com> writes:
>> It would be really cool if you could direct the EXPLAIN ANALYZE output to a
>> temporary table so that the query being analyzed could execute normally.
>
> What happens if the current transaction rolls back?
>
> If you want noninvasive explain data, contrib/auto_explain offers
> a solution right now.  The info goes to the postmaster log, which is
> perhaps less convenient than a temp table for interactive use, but
> it doesn't have the rollback problem --- and you can capture data
> about queries issued by a live application, without hacking the app.

The downside is that you then have to trawl through logs, which may not be easy (or in some hosting environments,
possible).

We're actually starting to do the opposite for a lot of automated stuff: we EXPLAIN ANALYZE a CTAS and then read the
temptable back out. But that's a lot more data copying than saving the EXPLAIN would be (well, at least normally ;).
 

As for rollback, dblink or FDW fixes that. Or if you're using a front-end that's sophisticated enough, you can pull it
outyourself and do whatever with it.
 
-- 
Jim C. Nasby, Data Architect                       jim@nasby.net
512.569.9461 (cell)                         http://jim.nasby.net



pgsql-hackers by date:

Previous
From: Jim Nasby
Date:
Subject: Re: [PATCH] Negative Transition Aggregate Functions (WIP)
Next
From: Heikki Linnakangas
Date:
Subject: Re: Extending BASE_BACKUP in replication protocol: incremental backup and backup format