Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit1a0586d

Browse files
committed
Introduce notion of different types of slots (without implementing them).
Upcoming work intends to allow pluggable ways to introduce new ways ofstoring table data. Accessing those table access methods from theexecutor requires TupleTableSlots to be carry tuples in the nativeformat of such storage methods; otherwise there'll be a significantconversion overhead.Different access methods will require different data to store tuplesefficiently (just like virtual, minimal, heap already require fieldsin TupleTableSlot). To allow that without requiring additional pointerindirections, we want to have different structs (embeddingTupleTableSlot) for different types of slots. Thus different types ofslots are needed, which requires adapting creators of slots.The slot that most efficiently can represent a type of tuple in anexecutor node will often depend on the type of slot a child nodeuses. Therefore we need to track the type of slot is returned bynodes, so parent slots can create slots based on that.Relatedly, JIT compilation of tuple deforming needs to know which typeof slot a certain expression refers to, so it can create anappropriate deforming function for the type of tuple in the slot.But not all nodes will only return one type of slot, e.g. an appendnode will potentially return different types of slots for each of itssubplans.Therefore add function that allows to query the type of a node'sresult slot, and whether it'll always be the same type (whether it'sfixed). This can be queried using ExecGetResultSlotOps().The scan, result, inner, outer type of slots are automaticallyinferred from ExecInitScanTupleSlot(), ExecInitResultSlot(),left/right subtrees respectively. If that's not correct for a node,that can be overwritten using new fields in PlanState.This commit does not introduce the actually abstracted implementationof different kind of TupleTableSlots, that will be left for a followupcommit. The different types of slots introduced will, for now, stilluse the same backing implementation.While this already partially invalidates the big comment intuptable.h, it seems to make more sense to update it later, when thedifferent TupleTableSlot implementations actually exist.Author: Ashutosh Bapat and Andres Freund, with changes by Amit KhandekarDiscussion:https://postgr.es/m/20181105210039.hh4vvi4vwoq5ba2q@alap3.anarazel.de
1 parent763f2ed commit1a0586d

File tree

69 files changed

+478
-176
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

69 files changed

+478
-176
lines changed

‎src/backend/access/heap/heapam.c‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4503,7 +4503,8 @@ ProjIndexIsUnchanged(Relation relation, HeapTuple oldtup, HeapTuple newtup)
45034503
List*indexoidlist=RelationGetIndexList(relation);
45044504
EState*estate=CreateExecutorState();
45054505
ExprContext*econtext=GetPerTupleExprContext(estate);
4506-
TupleTableSlot*slot=MakeSingleTupleTableSlot(RelationGetDescr(relation));
4506+
TupleTableSlot*slot=MakeSingleTupleTableSlot(RelationGetDescr(relation),
4507+
&TTSOpsHeapTuple);
45074508
boolequals= true;
45084509
Datumold_values[INDEX_MAX_KEYS];
45094510
boolold_isnull[INDEX_MAX_KEYS];

‎src/backend/catalog/index.c‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2510,7 +2510,8 @@ IndexBuildHeapRangeScan(Relation heapRelation,
25102510
*/
25112511
estate=CreateExecutorState();
25122512
econtext=GetPerTupleExprContext(estate);
2513-
slot=MakeSingleTupleTableSlot(RelationGetDescr(heapRelation));
2513+
slot=MakeSingleTupleTableSlot(RelationGetDescr(heapRelation),
2514+
&TTSOpsHeapTuple);
25142515

25152516
/* Arrange for econtext's scan tuple to be the tuple under test */
25162517
econtext->ecxt_scantuple=slot;
@@ -2997,7 +2998,8 @@ IndexCheckExclusion(Relation heapRelation,
29972998
*/
29982999
estate=CreateExecutorState();
29993000
econtext=GetPerTupleExprContext(estate);
3000-
slot=MakeSingleTupleTableSlot(RelationGetDescr(heapRelation));
3001+
slot=MakeSingleTupleTableSlot(RelationGetDescr(heapRelation),
3002+
&TTSOpsHeapTuple);
30013003

30023004
/* Arrange for econtext's scan tuple to be the tuple under test */
30033005
econtext->ecxt_scantuple=slot;
@@ -3315,7 +3317,8 @@ validate_index_heapscan(Relation heapRelation,
33153317
*/
33163318
estate=CreateExecutorState();
33173319
econtext=GetPerTupleExprContext(estate);
3318-
slot=MakeSingleTupleTableSlot(RelationGetDescr(heapRelation));
3320+
slot=MakeSingleTupleTableSlot(RelationGetDescr(heapRelation),
3321+
&TTSOpsHeapTuple);
33193322

33203323
/* Arrange for econtext's scan tuple to be the tuple under test */
33213324
econtext->ecxt_scantuple=slot;

‎src/backend/catalog/indexing.c‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,8 @@ CatalogIndexInsert(CatalogIndexState indstate, HeapTuple heapTuple)
9595
heapRelation=indstate->ri_RelationDesc;
9696

9797
/* Need a slot to hold the tuple being examined */
98-
slot=MakeSingleTupleTableSlot(RelationGetDescr(heapRelation));
98+
slot=MakeSingleTupleTableSlot(RelationGetDescr(heapRelation),
99+
&TTSOpsHeapTuple);
99100
ExecStoreHeapTuple(heapTuple,slot, false);
100101

101102
/*

‎src/backend/commands/analyze.c‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -730,7 +730,8 @@ compute_index_stats(Relation onerel, double totalrows,
730730
estate=CreateExecutorState();
731731
econtext=GetPerTupleExprContext(estate);
732732
/* Need a slot to hold the current heap tuple, too */
733-
slot=MakeSingleTupleTableSlot(RelationGetDescr(onerel));
733+
slot=MakeSingleTupleTableSlot(RelationGetDescr(onerel),
734+
&TTSOpsHeapTuple);
734735

735736
/* Arrange for econtext's scan tuple to be the tuple under test */
736737
econtext->ecxt_scantuple=slot;

‎src/backend/commands/constraint.c‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,8 @@ unique_key_recheck(PG_FUNCTION_ARGS)
122122
/*
123123
* The heap tuple must be put into a slot for FormIndexDatum.
124124
*/
125-
slot=MakeSingleTupleTableSlot(RelationGetDescr(trigdata->tg_relation));
125+
slot=MakeSingleTupleTableSlot(RelationGetDescr(trigdata->tg_relation),
126+
&TTSOpsHeapTuple);
126127

127128
ExecStoreHeapTuple(new_row,slot, false);
128129

‎src/backend/commands/copy.c‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2488,9 +2488,11 @@ CopyFrom(CopyState cstate)
24882488
ExecInitRangeTable(estate,cstate->range_table);
24892489

24902490
/* Set up a tuple slot too */
2491-
myslot=ExecInitExtraTupleSlot(estate,tupDesc);
2491+
myslot=ExecInitExtraTupleSlot(estate,tupDesc,
2492+
&TTSOpsHeapTuple);
24922493
/* Triggers might need a slot as well */
2493-
estate->es_trig_tuple_slot=ExecInitExtraTupleSlot(estate,NULL);
2494+
estate->es_trig_tuple_slot=ExecInitExtraTupleSlot(estate,NULL,
2495+
&TTSOpsHeapTuple);
24942496

24952497
/*
24962498
* Set up a ModifyTableState so we can let FDW(s) init themselves for

‎src/backend/commands/explain.c‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,8 @@ ExplainQuery(ParseState *pstate, ExplainStmt *stmt, const char *queryString,
266266
Assert(es->indent==0);
267267

268268
/* output tuples */
269-
tstate=begin_tup_output_tupdesc(dest,ExplainResultDesc(stmt));
269+
tstate=begin_tup_output_tupdesc(dest,ExplainResultDesc(stmt),
270+
&TTSOpsVirtual);
270271
if (es->format==EXPLAIN_FORMAT_TEXT)
271272
do_text_output_multiline(tstate,es->str->data);
272273
else

‎src/backend/commands/functioncmds.c‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2347,7 +2347,8 @@ ExecuteCallStmt(CallStmt *stmt, ParamListInfo params, bool atomic, DestReceiver
23472347
tupTypmod=HeapTupleHeaderGetTypMod(td);
23482348
retdesc=lookup_rowtype_tupdesc(tupType,tupTypmod);
23492349

2350-
tstate=begin_tup_output_tupdesc(dest,retdesc);
2350+
tstate=begin_tup_output_tupdesc(dest,retdesc,
2351+
&TTSOpsHeapTuple);
23512352

23522353
rettupdata.t_len=HeapTupleHeaderGetDatumLength(td);
23532354
ItemPointerSetInvalid(&(rettupdata.t_self));

‎src/backend/commands/subscriptioncmds.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1148,7 +1148,7 @@ fetch_table_list(WalReceiverConn *wrconn, List *publications)
11481148
res->err)));
11491149

11501150
/* Process tables. */
1151-
slot=MakeSingleTupleTableSlot(res->tupledesc);
1151+
slot=MakeSingleTupleTableSlot(res->tupledesc,&TTSOpsMinimalTuple);
11521152
while (tuplestore_gettupleslot(res->tuplestore, true, false,slot))
11531153
{
11541154
char*nspname;

‎src/backend/commands/tablecmds.c‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4736,8 +4736,8 @@ ATRewriteTable(AlteredTableInfo *tab, Oid OIDNewHeap, LOCKMODE lockmode)
47364736
* tuples are the same, the tupDescs might not be (consider ADD COLUMN
47374737
* without a default).
47384738
*/
4739-
oldslot=MakeSingleTupleTableSlot(oldTupDesc);
4740-
newslot=MakeSingleTupleTableSlot(newTupDesc);
4739+
oldslot=MakeSingleTupleTableSlot(oldTupDesc,&TTSOpsHeapTuple);
4740+
newslot=MakeSingleTupleTableSlot(newTupDesc,&TTSOpsHeapTuple);
47414741

47424742
/* Preallocate values/isnull arrays */
47434743
i=Max(newTupDesc->natts,oldTupDesc->natts);
@@ -8527,7 +8527,7 @@ validateCheckConstraint(Relation rel, HeapTuple constrtup)
85278527

85288528
econtext=GetPerTupleExprContext(estate);
85298529
tupdesc=RelationGetDescr(rel);
8530-
slot=MakeSingleTupleTableSlot(tupdesc);
8530+
slot=MakeSingleTupleTableSlot(tupdesc,&TTSOpsHeapTuple);
85318531
econtext->ecxt_scantuple=slot;
85328532

85338533
snapshot=RegisterSnapshot(GetLatestSnapshot());

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp