Re: Limit clause not using index

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Limit clause not using index
Дата
Msg-id 3415.1119364973@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Limit clause not using index  (Yves Vindevogel <yves.vindevogel@implements.be>)
Ответы Re: Limit clause not using index  (Yves Vindevogel <yves.vindevogel@implements.be>)
Список pgsql-performance
Yves Vindevogel <yves.vindevogel@implements.be> writes:
> Can anyone explain me this ?

> rvponp=# explain select * from tblprintjobs order by loginuser,
> desceventdate, desceventtime offset 25 limit 25 ;
>                                      QUERY PLAN
> ------------------------------------------------------------------------
> -----------
>   Limit  (cost=349860.62..349860.68 rows=25 width=206)
>     ->  Sort  (cost=349860.56..351416.15 rows=622236 width=206)
>           Sort Key: loginuser, desceventdate, desceventtime
>           ->  Seq Scan on tblprintjobs  (cost=0.00..25589.36 rows=622236 width=206)
> (4 rows)


Do you have an index matching that sort key?  I'd certainly expect the
above to use it if it were there.  For the full table case it's not so
clear --- an indexscan isn't always better.

            regards, tom lane

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

Предыдущее
От: John A Meinel
Дата:
Сообщение: Re: Limit clause not using index
Следующее
От: Matthew Nuzum
Дата:
Сообщение: Re: Do Views execute underlying query everytime ??