Re: Which one is faster?

Поиск
Список
Период
Сортировка
От Jan Wieck
Тема Re: Which one is faster?
Дата
Msg-id 3D11C92E.F05D0E80@Yahoo.com
обсуждение исходный текст
Ответ на Re: Which one is faster?  (Bruce Momjian <pgman@candle.pha.pa.us>)
Ответы Re: Which one is faster?  (Bruce Momjian <pgman@candle.pha.pa.us>)
Список pgsql-sql
Bruce Momjian wrote:
> 
> Wei Weng wrote:
> > Between Using Limit P, S or using a cursor to start from FETCH ABSOLUTE
> > S and FETCH NEXT for P times, which one is faster?
> 
> LIMIT is faster because it doesn't need to generate all the result, in
> some cases.

Neither does using a cursor need to generate all the results first. It's
a portal, which is an executor state on hold, and FETCH is implemented
as ExecutorRun() with the number of wanted result rows as limitation.
Since LIMIT generates internally one more result row than really wanted,
I don't think LIMIT would be much faster, but it's for sure less
portable.


Jan

-- 

#======================================================================#
# It's easier to get forgiveness for being wrong than for being right. #
# Let's break this rule - forgive me.                                  #
#================================================== JanWieck@Yahoo.com #


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

Предыдущее
От: Christoph Haller
Дата:
Сообщение: psql -E Floating exception (coredump)
Следующее
От: Tom Lane
Дата:
Сообщение: Re: psql -E Floating exception (coredump)