From: | Luca Ferrari <fluca1978(at)infinito(dot)it> |
---|---|
To: | Joe Van Dyk <joe(at)tanga(dot)com> |
Cc: | "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: Analyzing last run query in psql |
Date: | 2013-07-03 07:10:46 |
Message-ID: | CAKoxK+65Cxdy56tUg8c_+8hJgqmry0ub5HpBVpPtBMvL65eiJw@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Wed, Jul 3, 2013 at 7:05 AM, Joe Van Dyk <joe(at)tanga(dot)com> wrote:
> I frequently need to analyze the last query in psql:
> select * from table where id = 1;
> explain analyze select * from table where id = 1;
>
> It would be nice to be able to do this:
> explain analyze $LAST
>
> (or can I do something like that already?)
>
> I'm not using psql interactively, I pipe files into psql (if it matters).
I don't know of any feature like that, but maybe you can do the
following in your script/files:
\set lastquery 'your-query-here'
so that you can do something like
explain :lastquery;
But if you are able to manipulate your scripts you can just insert the
explain by hand on queries you are interested in, or use autoexplain
for all the queries.
Luca
From | Date | Subject | |
---|---|---|---|
Next Message | Oleg Bartunov | 2013-07-03 13:43:34 | Re: Analyzing last run query in psql |
Previous Message | Andreas Kretschmer | 2013-07-03 06:20:57 | Re: Analyzing last run query in psql |