[PERFORM] Difference between explain analyze and real execution time

2010-11-15 Thread Artur Zając
I have some simple query (executed with time command): time psql -c 'explain analyze SELECT te.idt FROM t_positions AS te JOIN t_st AS stm ON (te.idt=stm.idt AND 4=stm.idm) WHERE te.idtr IN (347186)' QUERY

Re: [PERFORM] Difference between explain analyze and real execution time

2010-11-15 Thread Tom Lane
=?iso-8859-2?Q?Artur_Zaj=B1c?= aza...@ang.com.pl writes: Why there is so big difference between explain analyze (0.710 ms) and real execution time (3309 ms)? EXPLAIN ANALYZE doesn't account for all of the runtime involved. In this case, I'd bet that session startup/shutdown is a big part of

Re: [PERFORM] Difference between explain analyze and real execution time

2010-11-15 Thread Artur Zając
EXPLAIN ANALYZE doesn't account for all of the runtime involved. In this case, I'd bet that session startup/shutdown is a big part of the difference. regards, tom lane Does session startup/shutdown depend on tables used in query? Some simpler query: time psql -c

Re: [PERFORM] Difference between explain analyze and real execution time

2010-11-15 Thread Tobias Brox
[Tom Lane] EXPLAIN ANALYZE doesn't account for all of the runtime involved.  In this case, I'd bet that session startup/shutdown is a big part of the difference. The session startup/shutdown should be the same for the real SQL and the broken SQL, shouldn't it? [Artur Zając] time psql -c

Re: [PERFORM] Difference between explain analyze and real execution time

2010-11-15 Thread Robert Haas
2010/11/15 Artur Zając aza...@ang.com.pl: Why there is so big difference between explain analyze (0.710 ms) and real execution time (3309 ms)? Any suggestions? Could it be that it takes a long time to plan for some reason? How fast is a plain EXPLAIN? What happens if you start up psql, turn

Re: [PERFORM] Difference between explain analyze and real execution time

2010-11-15 Thread Artur Zając
2010/11/15 Artur Zając aza...@ang.com.pl: Why there is so big difference between explain analyze (0.710 ms) and real execution time (3309 ms)? Any suggestions? Could it be that it takes a long time to plan for some reason? How fast is a plain EXPLAIN? Yes! That is it :) Planning is

Re: [PERFORM] Difference between explain analyze and real execution time

2010-11-15 Thread Tom Lane
=?iso-8859-2?Q?Artur_Zaj=B1c?= aza...@ang.com.pl writes: I've changed default_statistics_target to 1 and I think that is a reason. That's certainly going to cost you something, but this seems like a mighty large slowdown, especially for a non-join query. What datatype is te.idtr, anyway?

Re: [PERFORM] Difference between explain analyze and real execution time

2010-11-15 Thread Artur Zając
I've changed default_statistics_target to 1 and I think that is a reason. That's certainly going to cost you something, but this seems like a mighty large slowdown, especially for a non-join query. What datatype is te.idtr, anyway? Integer not null and primary key of t_positions