From: | "A(dot) Kretschmer" <andreas(dot)kretschmer(at)schollglas(dot)com> |
---|---|
To: | pgsql-novice(at)postgresql(dot)org |
Subject: | Re: EXPLAIN output explanation requested |
Date: | 2008-06-03 10:35:34 |
Message-ID: | 20080603103534.GA25281@a-kretschmer.de |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-novice |
am Tue, dem 03.06.2008, um 11:56:39 +0200 mailte Ron Arts folgendes:
> Hello all,
>
> I have an EXPLAIN statement that gives me output I understand,
> but on the other hand I don't...
>
> tium=# explain select codec1, phonetype from phone;
> QUERY PLAN
> ------------------------------------------------------------
> Seq Scan on phone (cost=0.00..85882.58 rows=658 width=11)
> (1 row)
>
>
> This is a table with 658 rows. Queries are indeed very
> slow. How is the query plan computed? What does the 85882 value
> mean?
You have no WHERE-condition, the whole table read with a sequential
scan. The 85882.58 is a calculated cost, based on seq_page_cost=1.
In other word, PG has to read about. 85882 blocks from disk, with a
block-size of 4 KByte thats about 343 MByte.
I guess, you have much insert/delete or update - operations on this
table and no recent vacuum.
Try to run a 'vacuum full;' and re-run your query. And, run a 'explain
analyse <your query>' to see the estimated costs and the real costs.
Andreas
--
Andreas Kretschmer
Kontakt: Heynitz: 035242/47150, D1: 0160/7141639 (mehr: -> Header)
GnuPG-ID: 0x3FFF606C, privat 0x7F4584DA http://wwwkeys.de.pgp.net
From | Date | Subject | |
---|---|---|---|
Next Message | A. Kretschmer | 2008-06-03 10:52:28 | Re: EXPLAIN output explanation requested |
Previous Message | Ron Arts | 2008-06-03 09:56:39 | EXPLAIN output explanation requested |