Thread: pgsql: Save calculated transitionSpace in Agg node.

pgsql: Save calculated transitionSpace in Agg node.

From
Jeff Davis
Date:
Save calculated transitionSpace in Agg node.

This will be useful in the upcoming Hash Aggregation work to improve
estimates for hash table sizing.

Discussion: https://postgr.es/m/37091115219dd522fd9ed67333ee8ed1b7e09443.camel%40j-davis.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/c11cb17dc55a6b432dc637491a4491920f9c2770

Modified Files
--------------
src/backend/optimizer/plan/createplan.c | 9 +++++++--
src/backend/optimizer/util/pathnode.c   | 2 ++
src/include/nodes/pathnodes.h           | 2 ++
src/include/nodes/plannodes.h           | 1 +
src/include/optimizer/planmain.h        | 4 ++--
5 files changed, 14 insertions(+), 4 deletions(-)


Re: pgsql: Save calculated transitionSpace in Agg node.

From
Tom Lane
Date:
Jeff Davis <jdavis@postgresql.org> writes:
> Save calculated transitionSpace in Agg node.

Surely this patch is a few bricks shy of a load.  Don't you need
copyfuncs/readfuncs/outfuncs support, for starters?

            regards, tom lane



Re: pgsql: Save calculated transitionSpace in Agg node.

From
Jeff Davis
Date:
On Thu, 2020-02-27 at 14:56 -0500, Tom Lane wrote:
> Jeff Davis <jdavis@postgresql.org> writes:
> > Save calculated transitionSpace in Agg node.
> 
> Surely this patch is a few bricks shy of a load.  Don't you need
> copyfuncs/readfuncs/outfuncs support, for starters?

Sorry, I will fix it.

I was looking at whether changes to copyfuncs (etc.) should also cause
a catversion bump, and it seems inconsistent. Commit 9ce77d75 does, but
6ef77cf4 does not. Any particular rules around that? Not terribly
important as the catversion was just bumped anyway; just curious.

Regards,
    Jeff Davis





Re: pgsql: Save calculated transitionSpace in Agg node.

From
Tom Lane
Date:
Jeff Davis <pgsql@j-davis.com> writes:
> On Thu, 2020-02-27 at 14:56 -0500, Tom Lane wrote:
>> Surely this patch is a few bricks shy of a load.  Don't you need
>> copyfuncs/readfuncs/outfuncs support, for starters?

> Sorry, I will fix it.

> I was looking at whether changes to copyfuncs (etc.) should also cause
> a catversion bump, and it seems inconsistent. Commit 9ce77d75 does, but
> 6ef77cf4 does not. Any particular rules around that? Not terribly
> important as the catversion was just bumped anyway; just curious.

You need a catversion bump if stored rules/views would change, ie when
messing with something that can appear in parser output.  The old rule
of thumb was "if you touched readfuncs.c you probably need a catversion
bump", but this is less true now that we have read/write support for
plan trees (which need serialization support so we can send them to
parallel workers, but there's no permanent storage).

In this case, since it's only touching plan nodes, you need
copyfuncs/readfuncs/outfuncs adjustments but not a catversion bump.

            regards, tom lane