Re: [HACKERS] What about LIMIT in SELECT ?

Поиск
Список
Период
Сортировка
От jwieck@debis.com (Jan Wieck)
Тема Re: [HACKERS] What about LIMIT in SELECT ?
Дата
Msg-id m0zVCaT-000EBPC@orion.SAPserv.Hamburg.dsh.de
обсуждение исходный текст
Ответ на RE: [HACKERS] What about LIMIT in SELECT ?  ("Hiroshi Inoue" <Inoue@tpf.co.jp>)
Список pgsql-hackers
Hiroshi Inoue wrote:

> When using cursors,in most cases the response to get first(next) rows
> is necessary for me,not the throughput.
> How can we tell PostgreSQL optimzer that the response is necessary ?

    With my LIMIT patch, the offset and the row count are part of
    the querytree. And if a LIMIT is given, the limitCount elemet
    of the querytree (a Node *) isn't NULL what it is by default.

    When a LIMIT is given, the optimizer could assume that  first
    rows  is  wanted (even if the limit is ALL maybe - but I have
    to think about this some more). And this assumption might let
    it  decide  to use an index to resolve an ORDER BY even if no
    qualification was given.

    Telling the optimizer that first  rows  wanted  in  a  cursor
    operation would read

        DECLARE CURSOR c FOR SELECT * FROM mytab ORDER BY a LIMIT ALL;


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 по дате отправления:

Предыдущее
От: Andreas Zeugswetter
Дата:
Сообщение: AW: [HACKERS] SELECT ... LIMIT (trial implementation)
Следующее
От: Bruce Momjian
Дата:
Сообщение: Re: [HACKERS] Re: inet/cidr/bind