Re: Re: [PATCH] Caching for stable expressions with constant arguments v3

Tom Lane <tgl@sss.pgh.pa.us>

From: Tom Lane <tgl@sss.pgh.pa.us>
To: Heikki Linnakangas <heikki.linnakangas@enterprisedb.com>
Cc: Marti Raudsepp <marti@juffo.org>, pgsql-hackers <pgsql-hackers@postgresql.org>, Josh Berkus <josh@agliodbs.com>
Date: 2011-12-05T16:16:51Z
Lists: pgsql-hackers

Commits

Same data as JSON: GET /api/v1/messages/:b64id/commits the thread's linked commits as JSON, with link sources. API reference →
  1. include_if_exists facility for config file.

Heikki Linnakangas <heikki.linnakangas@enterprisedb.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