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: 14867.1077834196@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
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

Browse pgsql-general by date

  From Date Subject
Next Message Brandon Craig Rhodes 2004-02-26 22:29:17 Re: PostgreSQL on XFS experiences?
Previous Message mailings 2004-02-26 22:22:04 Re: Postgres clustering?