Re: Limit & offset effect on query plans

Поиск
Список
Период
Сортировка
От Kevin Grittner
Тема Re: Limit & offset effect on query plans
Дата
Msg-id 20121213154714.80050@gmx.com
обсуждение исходный текст
Ответ на Limit & offset effect on query plans  (Amitabh Kant <amitabhkant@gmail.com>)
Ответы Re: Limit & offset effect on query plans  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-performance
Pavan Deolasee wrote:
> Amitabh Kant <amitabhkant@gmail.com> wrote:

>> Our scripts automatically add "LIMIT ALL" & "OFFSET 0" to every
>> select query if no values are passed on for these parameters. I
>> remember reading through the mailing list that it's better not
>> to pass them if they are not needed as they add a cost to the
>> query plan. Is this the case, or am i looking at a very minor
>> optimization.
>>
>
> I would tend to think that is the latter. While undoubtedly
> limit/offset clause will add another node during query planning
> and execution, AFAICS the OFFSET 0 and LIMIT ALL cases are
> optimized to a good extent. So the overhead of having them will
> not be significant.

I ran some quick tests on my i7 under Linux. Plan time was
increased by about 40 microseconds (based on EXPLAIN runtime) and
added a limit node to the plan. Execution time on a SELECT * FROM
tenk1 in the regression database went up by 1.35 ms on fully cached
runs.

-Kevin


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

Предыдущее
От: Lutz Fischer
Дата:
Сообщение: problem with large inserts
Следующее
От: Willem Leenen
Дата:
Сообщение: Re: problem with large inserts