Re: [HACKERS] What about LIMIT in SELECT ?

Поиск
Список
Период
Сортировка
От jwieck@debis.com (Jan Wieck)
Тема Re: [HACKERS] What about LIMIT in SELECT ?
Дата
Msg-id m0zTVAt-000EBRC@orion.SAPserv.Hamburg.dsh.de
обсуждение исходный текст
Ответ на Re: [HACKERS] What about LIMIT in SELECT ?  (Bruce Momjian <maillist@candle.pha.pa.us>)
Список pgsql-hackers
> But, you are correct that certain cases where in index is already being
> used on a query, you could just skip the sort IF you used the index to
> get the rows from the base table.

    Especially in the case where

        SELECT ... WHERE key > 'val' ORDER BY key;

    creates  a Sort->IndexScan plan. The index scan already jumps
    around on the disc to collect the sorts input  and  the  sort
    finally returns exactly the same output (if the used index is
    only on key).

    And this is the case for  large  tables.  The  planner  first
    decides  to  use  an  index  scan due to the WHERE clause and
    later it notices the ORDER BY clause and creates a sort  over
    the scan.

    I'm  actually  hacking  around on it to see what happens if I
    suppress the sort node in some cases.


Jan

--

#======================================================================#
# It's easier to get forgiveness for being wrong than for being right. #
# Let's break this rule - forgive me.                                  #
#======================================== jwieck@debis.com (Jan Wieck) #

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

Предыдущее
От: Terry Mackintosh
Дата:
Сообщение: Re: [HACKERS] What about LIMIT in SELECT ?
Следующее
От: "Taral"
Дата:
Сообщение: RE: [HACKERS] What about LIMIT in SELECT ?