Re: Call for objections: simplify stable functions during - Mailing list pgsql-hackers

From Marc G. Fournier
Subject Re: Call for objections: simplify stable functions during
Date
Msg-id 20041109140520.Y19215@ganymede.hub.org
Whole thread Raw
In response to Call for objections: simplify stable functions during estimation  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
On Tue, 9 Nov 2004, Tom Lane wrote:

> Awhile back, there was some discussion about pre-folding now() and
> related functions when the planner is trying to estimate selectivities.
> This would allow reasonable plans to be made for cases like
>     WHERE moddate >= current_date - 10;
> without having to indulge in any crude hacks with mislabeled wrapper
> functions, such as you can find all too often in the archives :-(
>
> I was a bit hesitant about it at the time because I wasn't sure of all
> the implications; but I've looked the idea over again, and as far as I
> can see it's reasonable to pre-fold *all* stable functions when deriving
> statistical estimates.  (One of the potential objections went away when
> we started enforcing that stable functions don't have side-effects.)
>
> The infrastructure for this is already there, because of Oliver Jowett's
> previous work to teach eval_const_expressions() whether it's folding
> the expression "for real" or just for estimation; it's basically a one
> line change to treat stable functions differently in the two cases.
>
> I know it's a bit late in the cycle, but I'd like to go ahead and make
> this change for 8.0.  Objections?

From a performance tuning standpoing, I can't argue against it ... go for 
it ...

----
Marc G. Fournier           Hub.Org Networking Services (http://www.hub.org)
Email: scrappy@hub.org           Yahoo!: yscrappy              ICQ: 7615664


pgsql-hackers by date:

Previous
From: Simon Riggs
Date:
Subject: Re: Call for objections: simplify stable functions
Next
From: Tom Lane
Date:
Subject: Re: [GENERAL] server auto-restarts and ipcs