On Wed, Jul 3, 2013 at 7:05 AM, Joe Van Dyk <joe@xxxxxxxxx> 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 -- Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general