quickly getting the top N rows

Поиск
Список
Период
Сортировка
От Ben
Тема quickly getting the top N rows
Дата
Msg-id Pine.LNX.4.64.0710041053590.30864@localhost.localdomain
обсуждение исходный текст
Ответы Re: quickly getting the top N rows  (Mark Lewis <mark.lewis@mir3.com>)
Re: quickly getting the top N rows  (Bill Moran <wmoran@collaborativefusion.com>)
Re: quickly getting the top N rows  (Andreas Kretschmer <akretschmer@spamfence.net>)
Re: quickly getting the top N rows  ("Scott Marlowe" <scott.marlowe@gmail.com>)
Список pgsql-performance
If I have this:

create table foo (bar int primary key);

...then in my ideal world, Postgres would be able to use that index on bar
to help me with this:

select bar from foo order by bar desc limit 20;

But in my experience, PG8.2 is doing a full table scan on foo, then
sorting it, then doing the limit. I have a more complex primary key, but I
was hoping the same concept would still apply. Am I doing something wrong,
or just expecting something that doesn't exist?

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

Предыдущее
От: "Tore Lukashaugen"
Дата:
Сообщение: Partitioning in postgres - basic question
Следующее
От: Mark Lewis
Дата:
Сообщение: Re: quickly getting the top N rows