Re: EXPLAIN output explanation requested - Mailing list pgsql-novice

From A. Kretschmer
Subject Re: EXPLAIN output explanation requested
Date
Msg-id 20080603103534.GA25281@a-kretschmer.de
Whole thread Raw
In response to EXPLAIN output explanation requested  (Ron Arts <ron.arts@neonova.nl>)
Responses Re: EXPLAIN output explanation requested
List 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

pgsql-novice by date:

Previous
From: Ron Arts
Date:
Subject: EXPLAIN output explanation requested
Next
From: "A. Kretschmer"
Date:
Subject: Re: EXPLAIN output explanation requested