Skip site navigation (1) Skip section navigation (2)

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

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Greg Stark <gsstark(at)mit(dot)edu>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: key = currval('tab_key_seq') choses SEQSCAN?!
Date: 2004-02-26 22:23:16
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-general
Greg Stark <gsstark(at)mit(dot)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

In response to

pgsql-general by date

Next:From: Brandon Craig RhodesDate: 2004-02-26 22:29:17
Subject: Re: PostgreSQL on XFS experiences?
Previous:From: mailingsDate: 2004-02-26 22:22:04
Subject: Re: Postgres clustering?

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group