Re: EXPLAIN output explanation requested

Поиск
Список
Период
Сортировка
От A. Kretschmer
Тема Re: EXPLAIN output explanation requested
Дата
Msg-id 20080603103534.GA25281@a-kretschmer.de
обсуждение исходный текст
Ответ на EXPLAIN output explanation requested  (Ron Arts <ron.arts@neonova.nl>)
Ответы Re: EXPLAIN output explanation requested  ("A. Kretschmer" <andreas.kretschmer@schollglas.com>)
Список 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 по дате отправления:

Предыдущее
От: Ron Arts
Дата:
Сообщение: EXPLAIN output explanation requested
Следующее
От: "A. Kretschmer"
Дата:
Сообщение: Re: EXPLAIN output explanation requested