select single entry and its neighbours using direct-acess to index?

Поиск
Список
Период
Сортировка
От peter pilsl
Тема select single entry and its neighbours using direct-acess to index?
Дата
Msg-id 41B420CC.608@goldfisch.at
обсуждение исходный текст
Ответы Re: select single entry and its neighbours using direct-acess to index?
Список pgsql-general
Is there an easy solution for this?

I'd like to select a single entry from a table and the entries that
would be previous and next given to a certain order.

like

select id from mytable where id=45 order by name,name2;

and then I'd like to select the two entries that would come before and
after according to the order "name,name2";
id is not ordered, but there is an index on  (name,name2) so the needed
infomation about previous, next should be stored somewhere in this index.

My current solution is to read all the data without the WHERE-clause and
then fetch the needed ones, which is quite time-demanding.

thnx,
peter



--
mag. peter pilsl
goldfisch.at
IT-management
tel +43 699 1 3574035
fax +43 699 4 3574035
pilsl@goldfisch.at

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

Предыдущее
От: "Julian Scarfe"
Дата:
Сообщение: Re: Index bloat in 7.2
Следующее
От: dom@happygiraffe.net (Dominic Mitchell)
Дата:
Сообщение: Re: When to encrypt