PostgreSQL Source Code git master
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
nodeSeqscan.h File Reference
#include "access/parallel.h"
#include "nodes/execnodes.h"
Include dependency graph for nodeSeqscan.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

SeqScanStateExecInitSeqScan (SeqScan *node, EState *estate, int eflags)
 
void ExecEndSeqScan (SeqScanState *node)
 
void ExecReScanSeqScan (SeqScanState *node)
 
void ExecSeqScanEstimate (SeqScanState *node, ParallelContext *pcxt)
 
void ExecSeqScanInitializeDSM (SeqScanState *node, ParallelContext *pcxt)
 
void ExecSeqScanReInitializeDSM (SeqScanState *node, ParallelContext *pcxt)
 
void ExecSeqScanInitializeWorker (SeqScanState *node, ParallelWorkerContext *pwcxt)
 

Function Documentation

◆ ExecEndSeqScan()

void ExecEndSeqScan ( SeqScanState node)

Definition at line 184 of file nodeSeqscan.c.

185{
186 TableScanDesc scanDesc;
187
188 /*
189 * get information from node
190 */
191 scanDesc = node->ss.ss_currentScanDesc;
192
193 /*
194 * close heap scan
195 */
196 if (scanDesc != NULL)
197 table_endscan(scanDesc);
198}
struct TableScanDescData * ss_currentScanDesc
Definition: execnodes.h:1575
ScanState ss
Definition: execnodes.h:1585
static void table_endscan(TableScanDesc scan)
Definition: tableam.h:1024

References SeqScanState::ss, ScanState::ss_currentScanDesc, and table_endscan().

Referenced by ExecEndNode().

◆ ExecInitSeqScan()

SeqScanState * ExecInitSeqScan ( SeqScan node,
EState estate,
int  eflags 
)

Definition at line 123 of file nodeSeqscan.c.

124{
125 SeqScanState *scanstate;
126
127 /*
128 * Once upon a time it was possible to have an outerPlan of a SeqScan, but
129 * not any more.
130 */
131 Assert(outerPlan(node) == NULL);
132 Assert(innerPlan(node) == NULL);
133
134 /*
135 * create state structure
136 */
137 scanstate = makeNode(SeqScanState);
138 scanstate->ss.ps.plan = (Plan *) node;
139 scanstate->ss.ps.state = estate;
140 scanstate->ss.ps.ExecProcNode = ExecSeqScan;
141
142 /*
143 * Miscellaneous initialization
144 *
145 * create expression context for node
146 */
147 ExecAssignExprContext(estate, &scanstate->ss.ps);
148
149 /*
150 * open the scan relation
151 */
152 scanstate->ss.ss_currentRelation =
154 node->scan.scanrelid,
155 eflags);
156
157 /* and create slot with the appropriate rowtype */
158 ExecInitScanTupleSlot(estate, &scanstate->ss,
161
162 /*
163 * Initialize result type and projection.
164 */
165 ExecInitResultTypeTL(&scanstate->ss.ps);
166 ExecAssignScanProjectionInfo(&scanstate->ss);
167
168 /*
169 * initialize child expressions
170 */
171 scanstate->ss.ps.qual =
172 ExecInitQual(node->scan.plan.qual, (PlanState *) scanstate);
173
174 return scanstate;
175}
#define Assert(condition)
Definition: c.h:812
ExprState * ExecInitQual(List *qual, PlanState *parent)
Definition: execExpr.c:224
void ExecAssignScanProjectionInfo(ScanState *node)
Definition: execScan.c:270
void ExecInitScanTupleSlot(EState *estate, ScanState *scanstate, TupleDesc tupledesc, const TupleTableSlotOps *tts_ops)
Definition: execTuples.c:1998
void ExecInitResultTypeTL(PlanState *planstate)
Definition: execTuples.c:1942
void ExecAssignExprContext(EState *estate, PlanState *planstate)
Definition: execUtils.c:485
Relation ExecOpenScanRelation(EState *estate, Index scanrelid, int eflags)
Definition: execUtils.c:742
static TupleTableSlot * ExecSeqScan(PlanState *pstate)
Definition: nodeSeqscan.c:108
#define makeNode(_type_)
Definition: nodes.h:155
#define innerPlan(node)
Definition: plannodes.h:182
#define outerPlan(node)
Definition: plannodes.h:183
#define RelationGetDescr(relation)
Definition: rel.h:531
ExprState * qual
Definition: execnodes.h:1147
Plan * plan
Definition: execnodes.h:1126
EState * state
Definition: execnodes.h:1128
ExecProcNodeMtd ExecProcNode
Definition: execnodes.h:1132
Relation ss_currentRelation
Definition: execnodes.h:1574
PlanState ps
Definition: execnodes.h:1573
Index scanrelid
Definition: plannodes.h:390
Scan scan
Definition: plannodes.h:399
const TupleTableSlotOps * table_slot_callbacks(Relation relation)
Definition: tableam.c:58

References Assert, ExecAssignExprContext(), ExecAssignScanProjectionInfo(), ExecInitQual(), ExecInitResultTypeTL(), ExecInitScanTupleSlot(), ExecOpenScanRelation(), PlanState::ExecProcNode, ExecSeqScan(), innerPlan, makeNode, outerPlan, PlanState::plan, ScanState::ps, PlanState::qual, RelationGetDescr, SeqScan::scan, Scan::scanrelid, SeqScanState::ss, ScanState::ss_currentRelation, PlanState::state, and table_slot_callbacks().

Referenced by ExecInitNode().

◆ ExecReScanSeqScan()

void ExecReScanSeqScan ( SeqScanState node)

Definition at line 212 of file nodeSeqscan.c.

213{
214 TableScanDesc scan;
215
216 scan = node->ss.ss_currentScanDesc;
217
218 if (scan != NULL)
219 table_rescan(scan, /* scan desc */
220 NULL); /* new scan keys */
221
222 ExecScanReScan((ScanState *) node);
223}
void ExecScanReScan(ScanState *node)
Definition: execScan.c:297
static void table_rescan(TableScanDesc scan, struct ScanKeyData *key)
Definition: tableam.h:1033

References ExecScanReScan(), SeqScanState::ss, ScanState::ss_currentScanDesc, and table_rescan().

Referenced by ExecReScan().

◆ ExecSeqScanEstimate()

void ExecSeqScanEstimate ( SeqScanState node,
ParallelContext pcxt 
)

Definition at line 238 of file nodeSeqscan.c.

240{
241 EState *estate = node->ss.ps.state;
242
244 estate->es_snapshot);
247}
#define shm_toc_estimate_chunk(e, sz)
Definition: shm_toc.h:51
#define shm_toc_estimate_keys(e, cnt)
Definition: shm_toc.h:53
Snapshot es_snapshot
Definition: execnodes.h:632
shm_toc_estimator estimator
Definition: parallel.h:41
Size pscan_len
Definition: execnodes.h:1586
Size table_parallelscan_estimate(Relation rel, Snapshot snapshot)
Definition: tableam.c:130

References EState::es_snapshot, ParallelContext::estimator, ScanState::ps, SeqScanState::pscan_len, shm_toc_estimate_chunk, shm_toc_estimate_keys, SeqScanState::ss, ScanState::ss_currentRelation, PlanState::state, and table_parallelscan_estimate().

Referenced by ExecParallelEstimate().

◆ ExecSeqScanInitializeDSM()

void ExecSeqScanInitializeDSM ( SeqScanState node,
ParallelContext pcxt 
)

Definition at line 256 of file nodeSeqscan.c.

258{
259 EState *estate = node->ss.ps.state;
261
262 pscan = shm_toc_allocate(pcxt->toc, node->pscan_len);
264 pscan,
265 estate->es_snapshot);
266 shm_toc_insert(pcxt->toc, node->ss.ps.plan->plan_node_id, pscan);
267 node->ss.ss_currentScanDesc =
269}
void * shm_toc_allocate(shm_toc *toc, Size nbytes)
Definition: shm_toc.c:88
void shm_toc_insert(shm_toc *toc, uint64 key, void *address)
Definition: shm_toc.c:171
shm_toc * toc
Definition: parallel.h:44
int plan_node_id
Definition: plannodes.h:152
TableScanDesc table_beginscan_parallel(Relation relation, ParallelTableScanDesc pscan)
Definition: tableam.c:165
void table_parallelscan_initialize(Relation rel, ParallelTableScanDesc pscan, Snapshot snapshot)
Definition: tableam.c:145

References EState::es_snapshot, PlanState::plan, Plan::plan_node_id, ScanState::ps, SeqScanState::pscan_len, shm_toc_allocate(), shm_toc_insert(), SeqScanState::ss, ScanState::ss_currentRelation, ScanState::ss_currentScanDesc, PlanState::state, table_beginscan_parallel(), table_parallelscan_initialize(), and ParallelContext::toc.

Referenced by ExecParallelInitializeDSM().

◆ ExecSeqScanInitializeWorker()

void ExecSeqScanInitializeWorker ( SeqScanState node,
ParallelWorkerContext pwcxt 
)

Definition at line 294 of file nodeSeqscan.c.

296{
298
299 pscan = shm_toc_lookup(pwcxt->toc, node->ss.ps.plan->plan_node_id, false);
300 node->ss.ss_currentScanDesc =
302}
void * shm_toc_lookup(shm_toc *toc, uint64 key, bool noError)
Definition: shm_toc.c:232

References PlanState::plan, Plan::plan_node_id, ScanState::ps, shm_toc_lookup(), SeqScanState::ss, ScanState::ss_currentRelation, ScanState::ss_currentScanDesc, table_beginscan_parallel(), and ParallelWorkerContext::toc.

Referenced by ExecParallelInitializeWorker().

◆ ExecSeqScanReInitializeDSM()

void ExecSeqScanReInitializeDSM ( SeqScanState node,
ParallelContext pcxt 
)

Definition at line 278 of file nodeSeqscan.c.

280{
282
283 pscan = node->ss.ss_currentScanDesc->rs_parallel;
285}
struct ParallelTableScanDescData * rs_parallel
Definition: relscan.h:66
static void table_parallelscan_reinitialize(Relation rel, ParallelTableScanDesc pscan)
Definition: tableam.h:1179

References TableScanDescData::rs_parallel, SeqScanState::ss, ScanState::ss_currentRelation, ScanState::ss_currentScanDesc, and table_parallelscan_reinitialize().

Referenced by ExecParallelReInitializeDSM().