Re: best way to fetch next/prev record based on index

Поиск
Список
Период
Сортировка
От Merlin Moncure
Тема Re: best way to fetch next/prev record based on index
Дата
Msg-id 6EE64EF3AB31D5448D0007DD34EEB34101AEFD@Herge.rcsinc.local
обсуждение исходный текст
Ответ на best way to fetch next/prev record based on index  ("Merlin Moncure" <merlin.moncure@rcsonline.com>)
Ответы Re: best way to fetch next/prev record based on index  (Greg Stark <gsstark@mit.edu>)
Список pgsql-performance
Greg wrote:
> One thing that can help is to add ORDER BY a,b,c LIMIT 1 to your
query.
> That
> will virtually guarantee that it uses an index scan, which will at
least
> avoid
> making it scan all the records *after* finding the match. However it
still
> doesn't seem to make Postgres use an Index Cond to allow it to do an
> instant
> lookup.

Yes, order by/limit was accidentally left of my original example.  My
problem is with the word 'virtually'.

> do it for multi-column keys. It seems it would be nice if some syntax
> similar
> to (a,b,c) > (a1,b1,c1) worked for this.

'nice' would be an understatement...
if the above syntax is not defined in the standard, I would humbly
suggest, well, beg for it to work as you thought it did.  That would be
GREAT!  ISMT it may be that that is in fact standard...(I don't have it,
so I don't know).

Merlin



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

Предыдущее
От: Rod Taylor
Дата:
Сообщение: Re: best way to fetch next/prev record based on index
Следующее
От: Christopher Kings-Lynne
Дата:
Сообщение: Re: Automagic tuning