Thread: Running explain analyze in a transaction
I want to to do the following.
begin;Hi,
2015-04-10 1:13 GMT+02:00 Tim Uckun <timuckun@gmail.com>:
Is there an easier way to do this?I have been resorting to commenting out the rollback and running it separately but it's a bit of a pain.If I do this I don't get the results of the analyze.rollback;explain analyze blahI want to to do the following.begin;
Nope. The query tool gets the result of the last query only. So you need to do it in two steps.
What you need to do is leave off ROLLBACK until
you examine the output.
Or perhaps just redirect the output to capture the results.
IE:
\o some_result_file
BEGIN;
EXPLAIN ANALYZE blah;
ROLLBACK;
However, perhaps a better thing to do is just leave out the ANALYZE as that is what causes the execution and only adds timing to the results.
Melvin Davidson
Folk Alley - All Folk - 24 Hours a day
www.folkalley.com
Folk Alley - All Folk - 24 Hours a day
www.folkalley.com
From: Tim Uckun <timuckun@gmail.com>
To: "pgadmin-support@postgresql.org" <pgadmin-support@postgresql.org>
Sent: Thursday, April 9, 2015 7:13 PM
Subject: [pgadmin-support] Running explain analyze in a transaction
I want to to do the following.
begin;I have been it in two steps but sometimes I jump on to another task and forget that I have an open transaction and shut down the app.
Anyway I would like to request a feature to let me see intermediate results because for me anyway it's not unusual to chain multiple statements together.On Sat, Apr 11, 2015 at 2:50 AM, Guillaume Lelarge <guillaume@lelarge.info> wrote:
Hi,2015-04-10 1:13 GMT+02:00 Tim Uckun <timuckun@gmail.com>:Is there an easier way to do this?I have been resorting to commenting out the rollback and running it separately but it's a bit of a pain.If I do this I don't get the results of the analyze.rollback;explain analyze blahI want to to do the following.begin;Nope. The query tool gets the result of the last query only. So you need to do it in two steps.
<p dir="ltr">Le 11 avr. 2015 01:44, "Tim Uckun" <<a href="mailto:timuckun@gmail.com">timuckun@gmail.com</a>> a écrit :<br/> ><br /> > I have been it in two steps but sometimes I jump on to another task and forget that I have anopen transaction and shut down the app. <br /> ><p dir="ltr">This shouldn't be an issue because the rollback is automaticthis way.<p dir="ltr">> Anyway I would like to request a feature to let me see intermediate results because forme anyway it's not unusual to chain multiple statements together.<br /> ><p dir="ltr">That feature is frequently asked,quite possible, but hard to do. Mostly on the UI part. You need to find someone quite motivated and who has time onhis hands.<p dir="ltr">> Thanks.<br /> ><br /> > On Sat, Apr 11, 2015 at 2:50 AM, Guillaume Lelarge <<a href="mailto:guillaume@lelarge.info">guillaume@lelarge.info</a>>wrote:<br /> >><br /> >> Hi,<br /> >><br/> >> 2015-04-10 1:13 GMT+02:00 Tim Uckun <<a href="mailto:timuckun@gmail.com">timuckun@gmail.com</a>>:<br/> >>><br /> >>> I want to to do the following.<br/> >>><br /> >>> begin;<br /> >>> explain analyze blah<br /> >>> rollback;<br/> >>><br /> >>> If I do this I don't get the results of the analyze.<br /> >>><br/> >>> I have been resorting to commenting out the rollback and running it separately but it's abit of a pain.<br /> >>><br /> >>> Is there an easier way to do this?<br /> >>><br /> >><br/> >> Nope. The query tool gets the result of the last query only. So you need to do it in two steps.<br/> >><br /> >><br /> >> -- <br /> >> Guillaume.<br /> >> <a href="http://blog.guillaume.lelarge.info">http://blog.guillaume.lelarge.info</a><br/> >> <a href="http://www.dalibo.com">http://www.dalibo.com</a><br/> ><br /> ><br />