Limit clause not using index

Поиск
Список
Период
Сортировка
От Yves Vindevogel
Тема Limit clause not using index
Дата
Msg-id d0da86521cd54473cac40df63bb14546@implements.be
обсуждение исходный текст
Ответы Re: Limit clause not using index  (Bricklen Anderson <BAnderson@PresiNET.com>)
Re: Limit clause not using index  (John A Meinel <john@arbash-meinel.com>)
Re: Limit clause not using index  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-performance
Hi,


I have a very simple query on a big table.  When I issue a "limit"
and/or "offset" clause, the query is not using the index.

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)


rvponp=# explain select * from tblprintjobs order by loginuser,
desceventdate, desceventtime ;

                                 QUERY PLAN

-----------------------------------------------------------------------------

 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)

(3 rows)


Met vriendelijke groeten,

Bien à vous,

Kind regards,


<bold>Yves Vindevogel</bold>

<bold>Implements</bold>

<smaller>

</smaller>Hi,

I have a very simple query on a big table.  When I issue a "limit"
and/or "offset" clause, the query is not using the index.
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)

rvponp=# explain select * from tblprintjobs order by loginuser,
desceventdate, desceventtime ;
                                  QUERY PLAN
------------------------------------------------------------------------
-----
  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)
(3 rows)

Met vriendelijke groeten,
Bien à vous,
Kind regards,

Yves Vindevogel
Implements

<smaller>


Mail: yves.vindevogel@implements.be  - Mobile: +32 (478) 80 82 91


Kempische Steenweg 206 - 3500 Hasselt - Tel-Fax: +32 (11) 43 55 76


Web: http://www.implements.be

<italic><x-tad-smaller>

First they ignore you.  Then they laugh at you.  Then they fight you.
Then you win.

Mahatma Ghandi.</x-tad-smaller></italic></smaller>


Mail: yves.vindevogel@implements.be  - Mobile: +32 (478) 80 82 91

Kempische Steenweg 206 - 3500 Hasselt - Tel-Fax: +32 (11) 43 55 76

Web: http://www.implements.be

First they ignore you.  Then they laugh at you.  Then they fight you.
Then you win.
Mahatma Ghandi.

Вложения

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

Предыдущее
От: Amit V Shah
Дата:
Сообщение: Do Views execute underlying query everytime ??
Следующее
От: Bricklen Anderson
Дата:
Сообщение: Re: Limit clause not using index