Re: BUG #7495: chosen wrong index

Поиск
Список
Период
Сортировка
От Kevin Grittner
Тема Re: BUG #7495: chosen wrong index
Дата
Msg-id 502BB47E020000250004975C@gw.wicourts.gov
обсуждение исходный текст
Ответ на Re: BUG #7495: chosen wrong index  ("Kevin Grittner" <Kevin.Grittner@wicourts.gov>)
Список pgsql-bugs
"Kevin Grittner" <Kevin.Grittner@wicourts.gov> wrote:
<> psql@elbrief.de> wrote:
>
>> insert into bla ( a , b )
>>   select a , a
>>     from generate_series( 1 , 1000000 ) as a ( a ) ;
>
>> explain analyze select * from bla
>>   where b > 990000 order by a limit 10 ;
>> [uses index on b and has a long run time]
>
> The problem is that PostgreSQL doesn't have any sense of the
> correlation between columns a and b (i.e., they are always equal)

A belated thought on this -- you went right from your load to
running queries without leaving any time for autovacuum to kick in
and generate statistics.  I recommend that somewhere after you
insert the data and before you run your selects, you run:

VACUUM ANALYZE bla;

This will get you to something which more closely resembles a
"steady state" environment.

-Kevin

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Possible Bug in 9.2beta3
Следующее
От: daniel@heroku.com
Дата:
Сообщение: BUG #7497: Excessive toast bloat after standby promotion