Andres Freund <andres@xxxxxxxxxxxxxxx> writes: > Couldn't we at least significantly improve on the status quo by > detecting we're currently planning a query that's only going to be > executed once (because it's directly executed or because were planning a > onetime plan for specific parameters) and inline stable functions before > doing the theorem proving? I think Haas went down that rabbit hole before you. The current definition of stable functions is not strong enough to guarantee that a plan-time evaluation would give the same result as a run-time evaluation, not even in one-shot-plan cases. The obvious reason why not is that the planner isn't using the same snapshot that the executor will use (which is not that easy to change, see his failed patch from a year or so back). But even if we rejiggered things enough so the query did use the same snapshot that'd been used for planning, I'm not very convinced that such an assumption would be valid. The assumptions for stable functions are pretty weak really. regards, tom lane -- Sent via pgsql-performance mailing list (pgsql-performance@xxxxxxxxxxxxxx) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-performance