PostgreSQL Source Code  git master
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 225 of file nodeSeqscan.c.

References ExecClearTuple(), ExecCloseScanRelation(), ExecFreeExprContext(), heap_endscan(), ScanState::ps, PlanState::ps_ResultTupleSlot, SeqScanState::ss, ScanState::ss_currentRelation, ScanState::ss_currentScanDesc, and ScanState::ss_ScanTupleSlot.

Referenced by ExecEndNode().

226 {
227  Relation relation;
228  HeapScanDesc scanDesc;
229 
230  /*
231  * get information from node
232  */
233  relation = node->ss.ss_currentRelation;
234  scanDesc = node->ss.ss_currentScanDesc;
235 
236  /*
237  * Free the exprcontext
238  */
239  ExecFreeExprContext(&node->ss.ps);
240 
241  /*
242  * clean out the tuple table
243  */
246 
247  /*
248  * close heap scan
249  */
250  if (scanDesc != NULL)
251  heap_endscan(scanDesc);
252 
253  /*
254  * close the heap relation.
255  */
256  ExecCloseScanRelation(relation);
257 }
void heap_endscan(HeapScanDesc scan)
Definition: heapam.c:1565
TupleTableSlot * ExecClearTuple(TupleTableSlot *slot)
Definition: execTuples.c:439
ScanState ss
Definition: execnodes.h:1115
TupleTableSlot * ss_ScanTupleSlot
Definition: execnodes.h:1106
Relation ss_currentRelation
Definition: execnodes.h:1104
void ExecFreeExprContext(PlanState *planstate)
Definition: execUtils.c:523
PlanState ps
Definition: execnodes.h:1103
TupleTableSlot * ps_ResultTupleSlot
Definition: execnodes.h:882
void ExecCloseScanRelation(Relation scanrel)
Definition: execUtils.c:668
HeapScanDesc ss_currentScanDesc
Definition: execnodes.h:1105

◆ ExecInitSeqScan()

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

Definition at line 166 of file nodeSeqscan.c.

References Assert, ExecAssignExprContext(), ExecAssignResultTypeFromTL(), ExecAssignScanProjectionInfo(), ExecInitQual(), ExecInitResultTupleSlot(), ExecInitScanTupleSlot(), PlanState::ExecProcNode, ExecSeqScan(), InitScanRelation(), innerPlan, makeNode, outerPlan, Scan::plan, PlanState::plan, ScanState::ps, Plan::qual, PlanState::qual, SeqScanState::ss, and PlanState::state.

Referenced by ExecInitNode().

167 {
168  SeqScanState *scanstate;
169 
170  /*
171  * Once upon a time it was possible to have an outerPlan of a SeqScan, but
172  * not any more.
173  */
174  Assert(outerPlan(node) == NULL);
175  Assert(innerPlan(node) == NULL);
176 
177  /*
178  * create state structure
179  */
180  scanstate = makeNode(SeqScanState);
181  scanstate->ss.ps.plan = (Plan *) node;
182  scanstate->ss.ps.state = estate;
183  scanstate->ss.ps.ExecProcNode = ExecSeqScan;
184 
185  /*
186  * Miscellaneous initialization
187  *
188  * create expression context for node
189  */
190  ExecAssignExprContext(estate, &scanstate->ss.ps);
191 
192  /*
193  * initialize child expressions
194  */
195  scanstate->ss.ps.qual =
196  ExecInitQual(node->plan.qual, (PlanState *) scanstate);
197 
198  /*
199  * tuple table initialization
200  */
201  ExecInitResultTupleSlot(estate, &scanstate->ss.ps);
202  ExecInitScanTupleSlot(estate, &scanstate->ss);
203 
204  /*
205  * initialize scan relation
206  */
207  InitScanRelation(scanstate, estate, eflags);
208 
209  /*
210  * Initialize result tuple type and projection info.
211  */
212  ExecAssignResultTypeFromTL(&scanstate->ss.ps);
213  ExecAssignScanProjectionInfo(&scanstate->ss);
214 
215  return scanstate;
216 }
List * qual
Definition: plannodes.h:145
Plan plan
Definition: plannodes.h:328
void ExecInitScanTupleSlot(EState *estate, ScanState *scanstate)
Definition: execTuples.c:842
static void InitScanRelation(SeqScanState *node, EState *estate, int eflags)
Definition: nodeSeqscan.c:142
ScanState ss
Definition: execnodes.h:1115
EState * state
Definition: execnodes.h:851
ExprState * ExecInitQual(List *qual, PlanState *parent)
Definition: execExpr.c:160
void ExecAssignResultTypeFromTL(PlanState *planstate)
Definition: execUtils.c:447
PlanState ps
Definition: execnodes.h:1103
static TupleTableSlot * ExecSeqScan(PlanState *pstate)
Definition: nodeSeqscan.c:126
void ExecAssignScanProjectionInfo(ScanState *node)
Definition: execScan.c:237
void ExecInitResultTupleSlot(EState *estate, PlanState *planstate)
Definition: execTuples.c:832
#define innerPlan(node)
Definition: plannodes.h:173
#define outerPlan(node)
Definition: plannodes.h:174
ExecProcNodeMtd ExecProcNode
Definition: execnodes.h:855
Plan * plan
Definition: execnodes.h:849
#define makeNode(_type_)
Definition: nodes.h:559
#define Assert(condition)
Definition: c.h:670
void ExecAssignExprContext(EState *estate, PlanState *planstate)
Definition: execUtils.c:425
ExprState * qual
Definition: execnodes.h:867

◆ ExecReScanSeqScan()

void ExecReScanSeqScan ( SeqScanState node)

Definition at line 271 of file nodeSeqscan.c.

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

Referenced by ExecReScan().

272 {
273  HeapScanDesc scan;
274 
275  scan = node->ss.ss_currentScanDesc;
276 
277  if (scan != NULL)
278  heap_rescan(scan, /* scan desc */
279  NULL); /* new scan keys */
280 
281  ExecScanReScan((ScanState *) node);
282 }
ScanState ss
Definition: execnodes.h:1115
void heap_rescan(HeapScanDesc scan, ScanKey key)
Definition: heapam.c:1521
HeapScanDesc ss_currentScanDesc
Definition: execnodes.h:1105
void ExecScanReScan(ScanState *node)
Definition: execScan.c:329

◆ ExecSeqScanEstimate()

void ExecSeqScanEstimate ( SeqScanState node,
ParallelContext pcxt 
)

Definition at line 297 of file nodeSeqscan.c.

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

Referenced by ExecParallelEstimate().

299 {
300  EState *estate = node->ss.ps.state;
301 
304  shm_toc_estimate_keys(&pcxt->estimator, 1);
305 }
shm_toc_estimator estimator
Definition: parallel.h:41
Snapshot es_snapshot
Definition: execnodes.h:429
ScanState ss
Definition: execnodes.h:1115
EState * state
Definition: execnodes.h:851
#define shm_toc_estimate_chunk(e, sz)
Definition: shm_toc.h:51
Size pscan_len
Definition: execnodes.h:1116
PlanState ps
Definition: execnodes.h:1103
#define shm_toc_estimate_keys(e, cnt)
Definition: shm_toc.h:53
Size heap_parallelscan_estimate(Snapshot snapshot)
Definition: heapam.c:1600

◆ ExecSeqScanInitializeDSM()

void ExecSeqScanInitializeDSM ( SeqScanState node,
ParallelContext pcxt 
)

Definition at line 314 of file nodeSeqscan.c.

References EState::es_snapshot, heap_beginscan_parallel(), heap_parallelscan_initialize(), 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, and ParallelContext::toc.

Referenced by ExecParallelInitializeDSM().

316 {
317  EState *estate = node->ss.ps.state;
318  ParallelHeapScanDesc pscan;
319 
320  pscan = shm_toc_allocate(pcxt->toc, node->pscan_len);
322  node->ss.ss_currentRelation,
323  estate->es_snapshot);
324  shm_toc_insert(pcxt->toc, node->ss.ps.plan->plan_node_id, pscan);
325  node->ss.ss_currentScanDesc =
327 }
int plan_node_id
Definition: plannodes.h:143
Snapshot es_snapshot
Definition: execnodes.h:429
ScanState ss
Definition: execnodes.h:1115
Relation ss_currentRelation
Definition: execnodes.h:1104
EState * state
Definition: execnodes.h:851
Size pscan_len
Definition: execnodes.h:1116
PlanState ps
Definition: execnodes.h:1103
void heap_parallelscan_initialize(ParallelHeapScanDesc target, Relation relation, Snapshot snapshot)
Definition: heapam.c:1615
Plan * plan
Definition: execnodes.h:849
void * shm_toc_allocate(shm_toc *toc, Size nbytes)
Definition: shm_toc.c:88
HeapScanDesc ss_currentScanDesc
Definition: execnodes.h:1105
void shm_toc_insert(shm_toc *toc, uint64 key, void *address)
Definition: shm_toc.c:171
HeapScanDesc heap_beginscan_parallel(Relation relation, ParallelHeapScanDesc parallel_scan)
Definition: heapam.c:1650
shm_toc * toc
Definition: parallel.h:44

◆ ExecSeqScanInitializeWorker()

void ExecSeqScanInitializeWorker ( SeqScanState node,
ParallelWorkerContext pwcxt 
)

Definition at line 351 of file nodeSeqscan.c.

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

Referenced by ExecParallelInitializeWorker().

353 {
354  ParallelHeapScanDesc pscan;
355 
356  pscan = shm_toc_lookup(pwcxt->toc, node->ss.ps.plan->plan_node_id, false);
357  node->ss.ss_currentScanDesc =
359 }
int plan_node_id
Definition: plannodes.h:143
ScanState ss
Definition: execnodes.h:1115
Relation ss_currentRelation
Definition: execnodes.h:1104
PlanState ps
Definition: execnodes.h:1103
Plan * plan
Definition: execnodes.h:849
HeapScanDesc ss_currentScanDesc
Definition: execnodes.h:1105
HeapScanDesc heap_beginscan_parallel(Relation relation, ParallelHeapScanDesc parallel_scan)
Definition: heapam.c:1650
void * shm_toc_lookup(shm_toc *toc, uint64 key, bool noError)
Definition: shm_toc.c:232

◆ ExecSeqScanReInitializeDSM()

void ExecSeqScanReInitializeDSM ( SeqScanState node,
ParallelContext pcxt 
)

Definition at line 336 of file nodeSeqscan.c.

References heap_parallelscan_reinitialize(), HeapScanDescData::rs_parallel, SeqScanState::ss, and ScanState::ss_currentScanDesc.

Referenced by ExecParallelReInitializeDSM().

338 {
339  HeapScanDesc scan = node->ss.ss_currentScanDesc;
340 
342 }
ScanState ss
Definition: execnodes.h:1115
ParallelHeapScanDesc rs_parallel
Definition: relscan.h:73
HeapScanDesc ss_currentScanDesc
Definition: execnodes.h:1105
void heap_parallelscan_reinitialize(ParallelHeapScanDesc parallel_scan)
Definition: heapam.c:1638