pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Artur Zając <azajac@ang.com.pl>
To: pgsql-performance@postgresql.org
Subject: Difference between explain analyze and real execution time
Date: Mon, 15 Nov 2010 09:21:34 +0100
Message-ID: <000001cb849e$1dce2720$596a7560$@ang.com.pl> (raw)

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
PLAN

----------------------------------------------------------------------------
----------------------------------------------------------------------------

Nested Loop  (cost=0.00..33.33 rows=2 width=4) (actual time=0.297..0.418
rows=3 loops=1)

   ->  Index Scan using t_positions_index1 on t_positions te
(cost=0.00..8.43 rows=3 width=4) (actual time=0.140..0.148 rows=3 loops=1)

         Index Cond: (idtr = 347186)

   ->  Index Scan using t_st_index4 on t_st stm  (cost=0.00..8.29 rows=1
width=4) (actual time=0.078..0.079 rows=1 loops=3)

         Index Cond: ((stm.idt = te.idt) AND (4 = stm.idm))

Total runtime: 0.710 ms

(6 rows)

 

 

real    0m3.309s

user    0m0.002s

sys     0m0.002s

 

Why there is so big difference between explain analyze (0.710 ms) and real
execution time (3309 ms)? Any suggestions?

 

Psql only execution time:

 

time psql -c 'explain analyze SELECT blabla()'

ERROR:  function blabla() does not exist

 

real    0m0.011s

user    0m0.001s

sys     0m0.004s

 

SELECT version();

 

PostgreSQL 9.0.1 on i686-pc-linux-gnu, compiled by GCC gcc (GCC) 4.1.2
20070502 (Red Hat 4.1.2-12), 32-bit

 

-------------------------------------------

Artur Zajac

 

 

view thread (8+ messages)  latest in thread

Message-ID: <000001cb849e$1dce2720$596a7560$@ang.com.pl>
Permalink:  ../000001cb849e$1dce2720$596a7560$@ang.com.pl/
Also on:    postgresql.org/message-id/000001cb849e$1dce2720$596a7560$@ang.com.pl

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: azajac@ang.com.pl
  Subject: Re: Difference between explain analyze and real execution time
  In-Reply-To: <000001cb849e$1dce2720$596a7560$@ang.com.pl>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox