| From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
|---|---|
| To: | Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com> |
| Cc: | Marti Raudsepp <marti(at)juffo(dot)org>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>, Josh Berkus <josh(at)agliodbs(dot)com> |
| Subject: | Re: Re: [PATCH] Caching for stable expressions with constant arguments v3 |
| Date: | 2011-12-05 16:16:51 |
| Message-ID: | 28529.1323101811@sss.pgh.pa.us |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com> writes:
> I wonder if it would be better to add the CacheExpr nodes to the tree as
> a separate pass, instead of shoehorning it into eval_const_expressions?
> I think would be more readable that way, even though a separate pass
> would be more expensive.
A separate pass would be very considerably more expensive, because
(1) it would require making a whole new copy of each expression tree,
and (2) it would require looking up the volatility status of each
function and operator. eval_const_expressions already has to do the
latter, or has to do it in a lot of cases anyway, so I think it's
probably the best place to add this. If it weren't for (2) I would
suggest adding the work to setrefs.c instead, but as it is I think
we'd better suck it up and deal with any fallout in the later stages
of the planner.
regards, tom lane
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Kevin Grittner | 2011-12-05 17:09:06 | Re: [REVIEW] Patch for cursor calling with named parameters |
| Previous Message | Robert Haas | 2011-12-05 15:58:18 | Re: cannot read pg_class without having selected a database / is this a bug? |