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

From Hannu Krosing
Subject Optimisation deficiency: currval('seq')-->seq scan, constant-->index scan
Date
Msg-id 399FC320.AFA7A99B@tm.ee
Whole thread Raw
Responses Re: Optimisation deficiency: currval('seq')-->seq scan, constant-->index scan
Re: Optimisation deficiency: currval('seq')-->seq scan, constant-->index scan
List pgsql-hackers
It seems that optimiser is unaware that currval('seq') can be treated as
a constant within 
an expression and thus produces suboptimal plans for WHERE clauses that
use currval 
thus using a seq scan instead of index scan.

Is it possible (planned) to mark functions as returning a constant when
given a constant 
argument and start using it _as a constant_ (pre-evaluated) in queries

The current behaviour is not very intuitive.

------------
Hannu


pgsql-hackers by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: autoconf check for AF_UNIX sockets
Next
From: Larry Rosenman
Date:
Subject: mac.c