Re: Query Optimizer makes a poor choice

Поиск
Список
Период
Сортировка
От Filip Rembiałkowski
Тема Re: Query Optimizer makes a poor choice
Дата
Msg-id CAP_rwwkE8pGhGsOXt2LQgE9K9_B4LRaLe7=0pT3ZdRQYeEPixQ@mail.gmail.com
обсуждение исходный текст
Ответ на Query Optimizer makes a poor choice  ("Tyler Hains" <thains@profitpointinc.com>)
Ответы Re: Query Optimizer makes a poor choice  ("Tyler Hains" <thains@profitpointinc.com>)
Список pgsql-general
2011/11/29 Tyler Hains <thains@profitpointinc.com>:
> # explain analyze select * from cards where card_set_id=2850 order by
> card_id limit 1;
>                                                                QUERY PLAN
>
-----------------------------------------------------------------------------------------------------------------------------------------
>  Limit  (cost=0.00..105.19 rows=1 width=40) (actual time=6026.947..6026.948
> rows=1 loops=1)
>    ->  Index Scan using cards_pkey on cards  (cost=0.00..2904875.38
> rows=27616 width=40) (actual time=6026.945..6026.945 rows=1 loops=1)
>          Filter: (card_set_id = 2850)
>  Total runtime: 6026.985 ms

do you have autovacum enabled?

does the plan change when you push stats target for this column?
ALTER TABLE cards ALTER card_set_id SET STATISTICS 500;
ANALYZE cards ( card_set_id );

what happens when you do:
select * from ( select * from cards where card_set_id=2850 ) order by
card_id limit 1
?

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

Предыдущее
От: Pavel Stehule
Дата:
Сообщение: Re: stored function data structures - difficulty
Следующее
От: Filip Rembiałkowski
Дата:
Сообщение: Re: initdb failure on Windows 2003