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

From: Greg Stark <gsstark(at)mit(dot)edu>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: key = currval('tab_key_seq') choses SEQSCAN?!
Date: 2004-02-26 20:10:37
Message-ID: 87u11dha9u.fsf@stark.xeocode.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Joe Conway <mail(at)joeconway(dot)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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Andrew Melton 2004-02-26 20:21:14 Hostname change - pgsql won't start
Previous Message Jeffrey W. Baker 2004-02-26 20:09:21 Re: PostgreSQL on XFS experiences?