1
0
mirror of https://github.com/postgres/postgres.git synced 2025-06-11 20:28:21 +03:00

Allow tupleslots to have a fixed tupledesc, use in executor nodes.

The reason for doing so is that it will allow expression evaluation to
optimize based on the underlying tupledesc. In particular it will
allow to JIT tuple deforming together with the expression itself.

For that expression initialization needs to be moved after the
relevant slots are initialized - mostly unproblematic, except in the
case of nodeWorktablescan.c.

After doing so there's no need for ExecAssignResultType() and
ExecAssignResultTypeFromTL() anymore, as all former callers have been
converted to create a slot with a fixed descriptor.

When creating a slot with a fixed descriptor, tts_values/isnull can be
allocated together with the main slot, reducing allocation overhead
and increasing cache density a bit.

Author: Andres Freund
Discussion: https://postgr.es/m/20171206093717.vqdxe5icqttpxs3p@alap3.anarazel.de
This commit is contained in:
Andres Freund
2018-02-16 21:17:38 -08:00
parent bf6c614a2f
commit ad7dbee368
52 changed files with 579 additions and 791 deletions

View File

@ -206,14 +206,6 @@ ExecInitMaterial(Material *node, EState *estate, int eflags)
* ExecQual or ExecProject.
*/
/*
* tuple table initialization
*
* material nodes only return tuples from their materialized relation.
*/
ExecInitResultTupleSlot(estate, &matstate->ss.ps);
ExecInitScanTupleSlot(estate, &matstate->ss);
/*
* initialize child nodes
*
@ -226,13 +218,19 @@ ExecInitMaterial(Material *node, EState *estate, int eflags)
outerPlanState(matstate) = ExecInitNode(outerPlan, estate, eflags);
/*
* initialize tuple type. no need to initialize projection info because
* this node doesn't do projections.
* Initialize result type and slot. No need to initialize projection info
* because this node doesn't do projections.
*
* material nodes only return tuples from their materialized relation.
*/
ExecAssignResultTypeFromTL(&matstate->ss.ps);
ExecAssignScanTypeFromOuterPlan(&matstate->ss);
ExecInitResultTupleSlotTL(estate, &matstate->ss.ps);
matstate->ss.ps.ps_ProjInfo = NULL;
/*
* initialize tuple type.
*/
ExecCreateScanSlotFromOuterPlan(estate, &matstate->ss);
return matstate;
}