Re: key = currval('tab_key_seq') choses SEQSCAN?!

Поиск
Список
Период
Сортировка
От Greg Stark
Тема Re: key = currval('tab_key_seq') choses SEQSCAN?!
Дата
Msg-id 87u11dha9u.fsf@stark.xeocode.com
обсуждение исходный текст
Ответ на Re: key = currval('tab_key_seq') choses SEQSCAN?!  (Joe Conway <mail@joeconway.com>)
Ответы Re: key = currval('tab_key_seq') choses SEQSCAN?!
Re: key = currval('tab_key_seq') choses SEQSCAN?!
Список pgsql-general
Joe Conway <mail@joeconway.com> writes:

> Eric B. Ridge wrote:
> > gotcha.  Stated differently, it's not volatile because, by design, it doesn't
> > always produce the same output for the same input.
>
> Right. But further, it doesn't even produce the same result within a single
> scan. Here's from pg_proc.h:

Consider a query like

select * from foo where a = currval('xyz') and b = nextval('xyz')

in that case it wouldn't be legitimate to use an index lookup on "a". Imagine
if currval('xyz')==3 at the start and there are multiple records where a=3.
Then it would return records where b = 3,4,5,... as long as a=3, which doesn't
really make sense.

Though actually I don't really see how any interpretation of this query really
makes a whole lot of sense.

--
greg

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