Re: [GENERAL] not using index through procedure

2004-10-15 Thread Tom Lane
Robin Ericsson [EMAIL PROTECTED] writes: Is there even a way to solve it this way via a procedure? If you want the range to depend on a procedure parameter then you're back to square one: the planner has no way to know the values that parameter will take on, and its default assumption is that

[GENERAL] not using index through procedure

2004-10-14 Thread Robin Ericsson
After some discussion on performance list, I guess this is back to a general question :) This is very simplified query of my real problem, but it should show the way of the problems. CREATE OR REPLACE FUNCTION ago(interval) RETURNS timestamp AS 'SELECT (now() - $1)::timestamp without time zone'

Re: [GENERAL] not using index through procedure

2004-10-14 Thread Martijn van Oosterhout
One's marked VOLATILE, the other is marked IMMUTABLE. This affects whether it's considered a constant, the planner estimates and hence whether it uses the index. On Thu, Oct 14, 2004 at 05:30:58PM +0200, Robin Ericsson wrote: After some discussion on performance list, I guess this is back to a

Re: [GENERAL] not using index through procedure

2004-10-14 Thread Robin Ericsson
Martijn van Oosterhout [EMAIL PROTECTED] wrote: One's marked VOLATILE, the other is marked IMMUTABLE. This affects whether it's considered a constant, the planner estimates and hence whether it uses the index. Is there even a way to solve it this way via a procedure? I've tried different