mirror of
https://github.com/postgres/postgres.git
synced 2025-06-30 21:42:05 +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:
@ -155,20 +155,6 @@ ExecInitForeignScan(ForeignScan *node, EState *estate, int eflags)
|
||||
*/
|
||||
ExecAssignExprContext(estate, &scanstate->ss.ps);
|
||||
|
||||
/*
|
||||
* initialize child expressions
|
||||
*/
|
||||
scanstate->ss.ps.qual =
|
||||
ExecInitQual(node->scan.plan.qual, (PlanState *) scanstate);
|
||||
scanstate->fdw_recheck_quals =
|
||||
ExecInitQual(node->fdw_recheck_quals, (PlanState *) scanstate);
|
||||
|
||||
/*
|
||||
* tuple table initialization
|
||||
*/
|
||||
ExecInitResultTupleSlot(estate, &scanstate->ss.ps);
|
||||
ExecInitScanTupleSlot(estate, &scanstate->ss);
|
||||
|
||||
/*
|
||||
* open the base relation, if any, and acquire an appropriate lock on it;
|
||||
* also acquire function pointers from the FDW's handler
|
||||
@ -194,23 +180,31 @@ ExecInitForeignScan(ForeignScan *node, EState *estate, int eflags)
|
||||
TupleDesc scan_tupdesc;
|
||||
|
||||
scan_tupdesc = ExecTypeFromTL(node->fdw_scan_tlist, false);
|
||||
ExecAssignScanType(&scanstate->ss, scan_tupdesc);
|
||||
ExecInitScanTupleSlot(estate, &scanstate->ss, scan_tupdesc);
|
||||
/* Node's targetlist will contain Vars with varno = INDEX_VAR */
|
||||
tlistvarno = INDEX_VAR;
|
||||
}
|
||||
else
|
||||
{
|
||||
ExecAssignScanType(&scanstate->ss, RelationGetDescr(currentRelation));
|
||||
ExecInitScanTupleSlot(estate, &scanstate->ss, RelationGetDescr(currentRelation));
|
||||
/* Node's targetlist will contain Vars with varno = scanrelid */
|
||||
tlistvarno = scanrelid;
|
||||
}
|
||||
|
||||
/*
|
||||
* Initialize result tuple type and projection info.
|
||||
* Initialize result slot, type and projection.
|
||||
*/
|
||||
ExecAssignResultTypeFromTL(&scanstate->ss.ps);
|
||||
ExecInitResultTupleSlotTL(estate, &scanstate->ss.ps);
|
||||
ExecAssignScanProjectionInfoWithVarno(&scanstate->ss, tlistvarno);
|
||||
|
||||
/*
|
||||
* initialize child expressions
|
||||
*/
|
||||
scanstate->ss.ps.qual =
|
||||
ExecInitQual(node->scan.plan.qual, (PlanState *) scanstate);
|
||||
scanstate->fdw_recheck_quals =
|
||||
ExecInitQual(node->fdw_recheck_quals, (PlanState *) scanstate);
|
||||
|
||||
/*
|
||||
* Initialize FDW-related state.
|
||||
*/
|
||||
|
Reference in New Issue
Block a user