Обсуждение: sequential explain analyze command execution
hello, I am working with PostgreSQL 9 in windows (pgAdmin3) and I'm trying to execute distinct EXPLAIN ANALYZE command on some queries that are really time consumming, and send the results to a single file. can anybody help me to solve this please? thanks
Your first email was arrived correctly. There was no need for a second one.
As for the query you could do something like
explain analyze select *
from (query1) as q1, (query2) as q2, ... (queryN) as qN;
But that might incur in a lot of memory swapping if you select a bunch of rows in some of these queries.
An alternative is doing something like
create function myquerytest() returning integer as $$
query1
query2
...
queryN
select 1;
$$ language sql;
explain analyze select myquerytest();
drop function myquerytest();
In either case I would put the code in a file and then "give" it to psql using the -f option and set the -o option to the desired output file . Since you are using pgadmin3 I have no idea.
good luck,
Marcelo Lacerda
As for the query you could do something like
explain analyze select *
from (query1) as q1, (query2) as q2, ... (queryN) as qN;
But that might incur in a lot of memory swapping if you select a bunch of rows in some of these queries.
An alternative is doing something like
create function myquerytest() returning integer as $$
query1
query2
...
queryN
select 1;
$$ language sql;
explain analyze select myquerytest();
drop function myquerytest();
In either case I would put the code in a file and then "give" it to psql using the -f option and set the -o option to the desired output file . Since you are using pgadmin3 I have no idea.
good luck,
Marcelo Lacerda
On Sat, May 19, 2012 at 5:20 AM, michel wildcat <m.wildcat82@gmail.com> wrote:
hello,
I am working with PostgreSQL 9 in windows (pgAdmin3) and I'm trying to
execute distinct EXPLAIN ANALYZE command on some queries that are
really time consumming, and send the results to a single file.
can anybody help me to solve this please?
thanks
--
Sent via pgsql-novice mailing list (pgsql-novice@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-novice
---------- Forwarded message ---------- From: michel wildcat <m.wildcat82@gmail.com> Date: 2012/5/21 Subject: Re: [NOVICE] sequential explain analyze command execution To: Marcelo Sena <marceloslacerda@gmail.com> thank you for answering, I sent the second email because I received a failure notification from the moderator as I wasn't registered... for my question I received an answer from the french communauty that satisfied my requirements. I used construction as follow: begin; explain analyze query1; explain analyze query2; rollback; in a file myexplains.sql, then I run it on the command line with : psql -f myexplains.sql > mysexplain.txt thanks once again. 2012/5/20 Marcelo Sena <marceloslacerda@gmail.com>: > Your first email was arrived correctly. There was no need for a second one. > > As for the query you could do something like > > explain analyze select * > from (query1) as q1, (query2) as q2, ... (queryN) as qN; > > But that might incur in a lot of memory swapping if you select a bunch of > rows in some of these queries. > > An alternative is doing something like > > create function myquerytest() returning integer as $$ > query1 > query2 > ... > queryN > select 1; > $$ language sql; > > explain analyze select myquerytest(); > > drop function myquerytest(); > > In either case I would put the code in a file and then "give" it to psql > using the -f option and set the -o option to the desired output file . Since > you are using pgadmin3 I have no idea. > > good luck, > Marcelo Lacerda > > > On Sat, May 19, 2012 at 5:20 AM, michel wildcat <m.wildcat82@gmail.com> > wrote: >> >> hello, >> I am working with PostgreSQL 9 in windows (pgAdmin3) and I'm trying to >> execute distinct EXPLAIN ANALYZE command on some queries that are >> really time consumming, and send the results to a single file. >> can anybody help me to solve this please? >> thanks >> >> -- >> Sent via pgsql-novice mailing list (pgsql-novice@postgresql.org) >> To make changes to your subscription: >> http://www.postgresql.org/mailpref/pgsql-novice > >