Re: key = currval('tab_key_seq') choses SEQSCAN?! - Mailing list pgsql-general

From Tom Lane
Subject Re: key = currval('tab_key_seq') choses SEQSCAN?!
Date
Msg-id 14867.1077834196@sss.pgh.pa.us
Whole thread Raw
In response to Re: key = currval('tab_key_seq') choses SEQSCAN?!  (Greg Stark <gsstark@mit.edu>)
List pgsql-general
Greg Stark <gsstark@mit.edu> writes:
> Consider a query like
> select * from foo where a = currval('xyz') and b = nextval('xyz')
> ...
> Though actually I don't really see how any interpretation of this
> query really makes a whole lot of sense.

Yeah.  The only moderately credible use-case I've ever seen for volatile
functions in WHERE clauses is

    select * from foo where random() < 0.01;

which gets you a random sampling of approximately 1% of the table.

            regards, tom lane

pgsql-general by date:

Previous
From: Alex Satrapa
Date:
Subject: Re: postgreSQL licenseing
Next
From: mailings@oopsware.de
Date:
Subject: Re: Postgres clustering?