Re: find next in an index

Поиск
Список
Период
Сортировка
От Bruno Wolff III
Тема Re: find next in an index
Дата
Msg-id 20050213034739.GB10271@wolff.to
обсуждение исходный текст
Ответ на find next in an index  (Neil Dugan <postgres@butterflystitches.com.au>)
Ответы Re: find next in an index  (Neil Dugan <postgres@butterflystitches.com.au>)
Список pgsql-general
On Sun, Feb 13, 2005 at 14:03:02 +1100,
  Neil Dugan <postgres@butterflystitches.com.au> wrote:
> Hi,
> I am trying to find out how to get the next record according to a
> particular index.
> I have a table with a name field and a serial field.  The name field
> isn't unique so I made an index on name(varchar) & serialno(bigserial).
> I also have an index just on 'name'.  I am having trouble working out
> the syntax for the query.
>
> select * from table where name>='jack' and serialno!='2'
> order by name,serialno;
>
> I don't think this will work under all circumstances.
>
> Any help appreciated. Thanks.

I think using OFFSET 1 and LIMIT 2 with an appropiate WHERE clause
will get you want you want. If you are going to keep stepping through
the list, you might want to use a cursor.

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

Предыдущее
От: Bruno Wolff III
Дата:
Сообщение: Re: Website Documentation
Следующее
От: Neil Dugan
Дата:
Сообщение: Re: find next in an index