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

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Brandon Craig Rhodes <brandon(at)oit(dot)gatech(dot)edu>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: key = currval('tab_key_seq') choses SEQSCAN?!
Date: 2004-02-26 01:02:57
Message-ID: 8016.1077757377@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Brandon Craig Rhodes <brandon(at)oit(dot)gatech(dot)edu> writes:
> But this same table suddenly becomes unwilling to use an index scan if
> the target value is the result of the currval() function:

currval() is considered a volatile function, therefore it is unsafe to
use in an indexscan constraint.

The subselect hack mentioned nearby fools the planner ... at the moment.
I wouldn't guarantee that it will work indefinitely. A better solution
is to wrap currval() in a function that you lyingly claim is stable.

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message cnliou 2004-02-26 01:04:23 Re: invalid memory alloc request size
Previous Message Michael Chaney 2004-02-26 00:09:23 Re: Moving from MySQL to PGSQL....some questions