Ranked Rather Than Ordered

Поиск
Список
Период
Сортировка
От Berkowitz Eric
Тема Ranked Rather Than Ordered
Дата
Msg-id 815D9B8B-2C07-4A37-B4A5-282B4246875E@roosevelt.edu
обсуждение исходный текст
Ответы Re: Ranked Rather Than Ordered  (Heikki Linnakangas <heikki.linnakangas@enterprisedb.com>)
Список pgadmin-hackers
When postgresql implements the following query:

Select * from <table> where <condition> order by <ordinal expression>
limit <X>

It appears to do a select, then a sort, then return the top X rows.

This works fine for small results but not for tables with tens of
millions of rows and queries that may return tens of thousands or even
hundreds of thousands of rows.

The sort is superfluous and incredibly expensive.

What should be done on this query is to do the select  saving X rows
in a save-bucket that is ranked by  the ordinal expression.

In fact, I currently find it far faster to do a simple select with no
limit or ordering and then in an external application do a single pass
over the resultset using an efficient save-bucket to keep the X
highest ranked rows.

Is there any way to get postgresql to perform this query efficiently
-- single-pass with ranking and an efficient save-bucket, no sorting,
or are there any plans for such an extension?

Thanks


Eric




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

Предыдущее
От: svn@pgadmin.org
Дата:
Сообщение: SVN Commit by dpage: r7867 - trunk/pgadmin3/pgadmin/debugger
Следующее
От: Heikki Linnakangas
Дата:
Сообщение: Re: Ranked Rather Than Ordered