Re: Optimisation deficiency: currval('seq')-->seq scan, constant-->index scan - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Optimisation deficiency: currval('seq')-->seq scan, constant-->index scan
Date
Msg-id 1823.966869439@sss.pgh.pa.us
Whole thread Raw
In response to Re: Optimisation deficiency: currval('seq')-->seq scan, constant-->index scan  (Tiago Antão <tra@fct.unl.pt>)
List pgsql-hackers
Tiago Antão <tra@fct.unl.pt> writes:
>  Isn't the problem more general than just nextval?

Yes it is, and that's why I'm not very excited about the idea of
adding special-case logic for nextval/currval into the optimizer.

It's fairly easy to get around this problem in plpgsql, eg
declare x int;beginx := currval('seq');return f1 from foo where seqfld = x;

so I really am going to resist suggestions that the optimizer should
make invalid assumptions about currval by itself ...
        regards, tom lane


pgsql-hackers by date:

Previous
From: Mark Hollomon
Date:
Subject: functional index arg matching patch
Next
From: Vince Vielhaber
Date:
Subject: Re: Bug tracking (was Re: +/- Inf for float8's)