pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Chris Hutchinson <chris@hutchinsonsoftware.com>
To: pgsql-performance@postgresql.org
Subject: EXPLAIN ANALYZE much slower than running query normally
Date: Tue, 5 Oct 2004 16:49:26 +1000
Message-ID: <IDEOKBCDGGIDOBADNGAPGEFEGBAA.chris@hutchinsonsoftware.com> (raw)

Running a trivial query in v7.4.2 (installed with fedora core2) using
EXPLAIN ANALYZE is taking considerably longer than just running the query
(2mins vs 6 secs). I was using this query to quickly compare a couple of
systems after installing a faster disk.

Is this sort of slowdown to be expected?

Here's the query:
----------------------------------------
[chris@fedora tmp]$ time psql dbt << ENDSQL
> select count(*) from etab;
> ENDSQL
  count
---------
 9646782
(1 row)


real    0m6.532s
user    0m0.005s
sys     0m0.002s
[chris@fedora tmp]$ time psql dbt << ENDSQL
> explain analyze select count(*) from etab;
> ENDSQL
                                                       QUERY PLAN

----------------------------------------------------------------------------
---------------
-----------------------------
 Aggregate  (cost=182029.78..182029.78 rows=1 width=0) (actual
time=112701.488..112701.493
rows=1 loops=1)
   ->  Seq Scan on etab  (cost=0.00..157912.82 rows=9646782 width=0) (actual
time=0.053..578
59.120 rows=9646782 loops=1)
 Total runtime: 112701.862 ms
(3 rows)


real    1m52.716s
user    0m0.003s
sys     0m0.005s
---------------------------------------

Thanks in advance for any clues.

Chris Hutchinson




view thread (3+ messages)  latest in thread

Message-ID: <IDEOKBCDGGIDOBADNGAPGEFEGBAA.chris@hutchinsonsoftware.com>
Permalink:  ../IDEOKBCDGGIDOBADNGAPGEFEGBAA.chris@hutchinsonsoftware.com/
Also on:    postgresql.org/message-id/IDEOKBCDGGIDOBADNGAPGEFEGBAA.chris@hutchinsonsoftware.com

 · 

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: chris@hutchinsonsoftware.com
  Subject: Re: EXPLAIN ANALYZE much slower than running query normally
  In-Reply-To: <IDEOKBCDGGIDOBADNGAPGEFEGBAA.chris@hutchinsonsoftware.com>

* 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