Re: Bad Planner Statistics for Uneven distribution.

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Bad Planner Statistics for Uneven distribution.
Дата
Msg-id 8073.1153517393@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Bad Planner Statistics for Uneven distribution.  ("Kevin McArthur" <Kevin@StormTide.ca>)
Ответы Re: Bad Planner Statistics for Uneven distribution.  ("Guillaume Smet" <guillaume.smet@gmail.com>)
Список pgsql-performance
"Kevin McArthur" <Kevin@StormTide.ca> writes:
>          ->  Seq Scan on models_brands  (cost=0.00..6411.89 rows=369489 width=4) (actual time=0.040..1352.997
rows=369489loops=1) 
> ...
>    ->  Index Scan using models_brands_brand on models_brands  (cost=0.00..862236.96 rows=369489 width=4) (actual
time=0.122..1440.809rows=369489 loops=1) 

> Picks the wrong plan here. Should pick the index with seqscanning enabled.

It's really not possible for a full-table indexscan to be faster than a
seqscan, and not very credible for it even to be approximately as fast.
I suspect your second query here is the beneficiary of the first query
having fetched all the pages into cache.  In general, if you want to
optimize for a mostly-cached database, you need to reduce
random_page_cost below its default value ...

            regards, tom lane

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

Предыдущее
От: Kevin Keith
Дата:
Сообщение: Re: Partitioned tables in queries
Следующее
От: "Guillaume Smet"
Дата:
Сообщение: Re: Bad Planner Statistics for Uneven distribution.