Re: best way to retreive the next record in a multi column index

Поиск
Список
Период
Сортировка
От Bruno Wolff III
Тема Re: best way to retreive the next record in a multi column index
Дата
Msg-id 20030815201503.GA14932@wolff.to
обсуждение исходный текст
Ответ на best way to retreive the next record in a multi column index  ("Merlin Moncure" <merlin.moncure@rcsonline.com>)
Список pgsql-hackers
On Fri, Aug 15, 2003 at 13:42:23 -0400, Merlin Moncure <merlin.moncure@rcsonline.com> wrote:
>  
> Example: 
> I have a table t with columns a, b, c.  I have values a1, b1, c1 for
> those columns and would like to know the next value in the table when
> ordered by a, b.  I have values a1, b1, and oid1 and would like to find
> the very next record in the table (essentially looking for the next
> record in the index).
>  
> I have two solutions: one with 'or' logic and one with 'and' logic.
> Note: if the index we are scanning has the unique constraint, the oid
> part of the logic (and the index) can be left out.
>  
How about something like the following:
select * from t
where  a >= a1 and b >= b1           order by a, b limit 1 offset 1;


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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Bounds error in LockMethodInit().
Следующее
От: ohp@pyrenet.fr
Дата:
Сообщение: Re: UnixWare on Current CVS: Success!