Re: Optimize ORDER BY ... LIMIT

Поиск
Список
Период
Сортировка
От Gregory Stark
Тема Re: Optimize ORDER BY ... LIMIT
Дата
Msg-id 87irjposep.fsf@enterprisedb.com
обсуждение исходный текст
Ответ на Re: Optimize ORDER BY ... LIMIT  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: Optimize ORDER BY ... LIMIT  (Alvaro Herrera <alvherre@commandprompt.com>)
Список pgsql-hackers
Tom Lane <tgl@sss.pgh.pa.us> writes:

> I believe a better way to think about this would be as an aggregate that
> remembers the top N rows.  

Wouldn't such a thing just be a reimplementation of a tuplestore though? I
mean, it's storing tuples you feed it, sorting them, and spitting them back
out in sorted order.

What would you do if the set of tuples turned out to be larger than you
expected and not fit in memory? Create a tuplesort and pass them on to it?

I've already looked at tuplesort and the changes there are minimal. The hard
part is what to do in the planner and executor to get the information to the
tuplestore. Do we want the plan to look the way it does now or use some new
sort of node that consolidates the limit and the sort in the same place.

--  Gregory Stark EnterpriseDB          http://www.enterprisedb.com


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

Предыдущее
От: Martijn van Oosterhout
Дата:
Сообщение: Re: Reducing data type space usage
Следующее
От: Martijn van Oosterhout
Дата:
Сообщение: Re: Optimize ORDER BY ... LIMIT