Re: PostgreSQL and explain

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: PostgreSQL and explain
Дата
Msg-id 5414.1017682395@sss.pgh.pa.us
обсуждение исходный текст
Ответ на PostgreSQL and explain  ("Johnson, Shaunn" <SJohnson6@bcbsm.com>)
Список pgsql-general
"Johnson, Shaunn" <SJohnson6@bcbsm.com> writes:
> This message is in MIME format. Since your mail reader does not understand
> this format, some or all of this message may not be legible.

Would it be possible to turn off the MIME-ification of your email?

> I mean: the difference for cost = 0.00..30.00 and cost = 0.00..7370.80 ...
> (forgive my newbie-ness) but this looks like an increase ... why is that?

The cost=30 number is completely bogus since it is based on no
statistical data whatever; until you've done a VACUUM or ANALYZE,
the planner is flying blind and has to work with some default
assumptions about table size.  (Which are 10 pages and 1000 tuples,
IIRC.)

After VACUUM the numbers are at least somewhat meaningful, but you
have to remember that (a) they're on an arbitrary scale of 1 disk
page fetch = 1 cost unit, and (b) the planner's opinion is frequently
very far from reality.  I'd never trust EXPLAIN's output as a guide
to what's really cheap or not; use real timings.  (EXPLAIN ANALYZE
can be helpful, since it accumulates real timings.)

There's more info about EXPLAIN in the "performance tips" chapter of the
User's Guide.

            regards, tom lane

В списке pgsql-general по дате отправления:

Предыдущее
От: Stephan Szabo
Дата:
Сообщение: Re: NOT IN queries
Следующее
От: Steve Atkins
Дата:
Сообщение: substring indices / array operators