Skip to content

Commit

Permalink
Adapt dynamic (bitmap/index/table) scan to PG 14
Browse files Browse the repository at this point in the history
In PG commit 36d22dd, if the ops in tableslot which returned by
the current execution operator is fixed, the executor will simplify
the call and directly call `*virt` functions. But in the dynamic
(bitmap/index/table) scan operator, we don't know the tupleslot
ops of the subtable (it may even be different).

So the current change sets the `opsisfixed` of scan and result to
false, which can prevent the executor from directly calling `*virt`
funcstion.
  • Loading branch information
jiaqizho authored and my-ship-it committed Dec 24, 2024
1 parent 12ed1a8 commit 5612f4b
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/backend/executor/nodeDynamicBitmapHeapscan.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,10 @@ ExecInitDynamicBitmapHeapScan(DynamicBitmapHeapScan *node, EState *estate, int e
Relation scanRel = ExecOpenScanRelation(estate, node->bitmapheapscan.scan.scanrelid, eflags);
ExecInitScanTupleSlot(estate, &state->ss, RelationGetDescr(scanRel), table_slot_callbacks(scanRel));

/* Dynamic table/index/bitmap scan can't tell the ops of tupleslot */
state->ss.ps.scanopsfixed = false;
state->ss.ps.scanopsset = true;

/*
* Initialize result tuple type and projection info.
*/
Expand Down
4 changes: 4 additions & 0 deletions src/backend/executor/nodeDynamicBitmapIndexscan.c
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,10 @@ ExecInitDynamicBitmapIndexScan(DynamicBitmapIndexScan *node, EState *estate, int
Relation scanRel = ExecOpenScanRelation(estate, node->biscan.scan.scanrelid, eflags);
ExecInitScanTupleSlot(estate, &dynamicBitmapIndexScanState->ss, RelationGetDescr(scanRel), table_slot_callbacks(scanRel));

/* Dynamic table/index/bitmap scan can't tell the ops of tupleslot */
dynamicBitmapIndexScanState->ss.ps.scanopsfixed = false;
dynamicBitmapIndexScanState->ss.ps.scanopsset = true;

/*
* Initialize result tuple type and projection info.
*/
Expand Down
4 changes: 4 additions & 0 deletions src/backend/executor/nodeDynamicIndexscan.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,10 @@ ExecInitDynamicIndexScan(DynamicIndexScan *node, EState *estate, int eflags)
Relation scanRel = ExecOpenScanRelation(estate, node->indexscan.scan.scanrelid, eflags);
ExecInitScanTupleSlot(estate, &dynamicIndexScanState->ss, RelationGetDescr(scanRel), table_slot_callbacks(scanRel));

/* Dynamic table/index/bitmap scan can't tell the ops of tupleslot */
dynamicIndexScanState->ss.ps.scanopsfixed = false;
dynamicIndexScanState->ss.ps.scanopsset = true;

/*
* Initialize result tuple type and projection info.
*/
Expand Down
7 changes: 7 additions & 0 deletions src/backend/executor/nodeDynamicSeqscan.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,17 @@ ExecInitDynamicSeqScan(DynamicSeqScan *node, EState *estate, int eflags)
Relation scanRel = ExecOpenScanRelation(estate, node->seqscan.scanrelid, eflags);
ExecInitScanTupleSlot(estate, &state->ss, RelationGetDescr(scanRel), table_slot_callbacks(scanRel));

/* Dynamic table/index/bitmap scan can't tell the ops of tupleslot */
state->ss.ps.scanopsfixed = false;
state->ss.ps.scanopsset = true;

/* Initialize result tuple type. */
ExecInitResultTypeTL(&state->ss.ps);
ExecAssignScanProjectionInfo(&state->ss);

state->ss.ps.resultopsfixed = false;
state->ss.ps.resultopsset = true;

state->nOids = list_length(node->partOids);
state->partOids = palloc(sizeof(Oid) * state->nOids);
foreach_with_count(lc, node->partOids, i)
Expand Down

0 comments on commit 5612f4b

Please sign in to comment.