Re: Partitions not Working as Expected - Mailing list pgsql-performance

From Tom Lane
Subject Re: Partitions not Working as Expected
Date
Msg-id 654.1372367875@sss.pgh.pa.us
Whole thread Raw
In response to Re: Partitions not Working as Expected  (Andres Freund <andres@2ndquadrant.com>)
List pgsql-performance
Andres Freund <andres@2ndquadrant.com> 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


pgsql-performance by date:

Previous
From: Josh Berkus
Date:
Subject: Re: Partitions not Working as Expected
Next
From: Tom Lane
Date:
Subject: Re: Partitions not Working as Expected