I don't understand this explain output

From: Ron Arts <ron(dot)arts(at)neonova(dot)nl>
To: pgsql-novice(at)postgresql(dot)org
Subject: I don't understand this explain output
Date: 2009-05-26 08:32:03
Message-ID: 4A1BA903.8020300@neonova.nl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Hi,

I am looking at a very simple query (select * from queue),
which takes forever to finish. I don't understand the output that
explain tells me:

m=# explain select * from queue;
QUERY PLAN
------------------------------------------------------------
Seq Scan on queue (cost=0.00..635477.00 rows=1 width=402)
(1 row)

The cost seems to be very high. It's a small table (only 23 rows)
and has not seen many modifications since the table was initially
filled. OTOH many individual records are updated every minute.

If I look at anopther table in the same database:

m=# explain select * from contact;
QUERY PLAN
-------------------------------------------------------------
Seq Scan on contact (cost=0.00..183.14 rows=614 width=411)
(1 row)

and this query finishes very quickly (614 rows).

Why would a simple query be so very costly?

Thanks,
Ron Arts

--
NeoNova BV
innovatieve internetoplossingen

http://www.neonova.nl Science Park 140 1098 XG Amsterdam
info: 020-5611300 servicedesk: 020-5611302 fax: 020-5611301
KvK Amsterdam 34151241

Op dit bericht is de volgende disclaimer van toepassing:
http://www.neonova.nl/maildisclaimer

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Luiz Eduardo Cantanhede Neri 2009-05-26 09:52:59 Re: I don't understand this explain output
Previous Message Frank Bax 2009-05-25 23:37:09 Re: Read data from text file