Re: pgsql: Teach tuplesort.c about "top N" sorting, in which only the first

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: pgsql: Teach tuplesort.c about "top N" sorting, in which only the first
Дата
Msg-id 18677.1178287448@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: pgsql: Teach tuplesort.c about "top N" sorting, in which only the first  (Magnus Hagander <magnus@hagander.net>)
Ответы Re: pgsql: Teach tuplesort.c about "top N" sorting, in which only the first  (Magnus Hagander <magnus@hagander.net>)
Список pgsql-committers
Magnus Hagander <magnus@hagander.net> writes:
> Is there some way to see in the generated query plan if this optimisation
> is used?

If there's a SORT just below a LIMIT (that has a limit, ie it's not just
an OFFSET), then it's potentially used.  Whether it's actually used
depends on actual row counts and widths at runtime --- you'd have to
turn on trace_sort and look at the log output to determine that.

Also, if you want to experiment, you can compile with -DDEBUG_BOUNDED_SORT
to have a GUC variable optimize_bounded_sort that disables the new code
for comparison purposes.

            regards, tom lane

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

Предыдущее
От: h-saito@pgfoundry.org (User H-saito)
Дата:
Сообщение: psqlodbc - psqlodbc: Fixed HANDLE_ENLIST_IN_DTC.
Следующее
От: Tom Lane
Дата:
Сообщение: Re: pgsql: A few fixups in error handling: mark pg_re_throw() as noreturn