PostgreSQL Source Code  git master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
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, shm_toc *toc)
 

Function Documentation

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:1112
TupleTableSlot * ss_ScanTupleSlot
Definition: execnodes.h:1103
Relation ss_currentRelation
Definition: execnodes.h:1101
void ExecFreeExprContext(PlanState *planstate)
Definition: execUtils.c:521
PlanState ps
Definition: execnodes.h:1100
TupleTableSlot * ps_ResultTupleSlot
Definition: execnodes.h:880
void ExecCloseScanRelation(Relation scanrel)
Definition: execUtils.c:666
HeapScanDesc ss_currentScanDesc
Definition: execnodes.h:1102
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:1112
EState * state
Definition: execnodes.h:849
ExprState * ExecInitQual(List *qual, PlanState *parent)
Definition: execExpr.c:160
void ExecAssignResultTypeFromTL(PlanState *planstate)
Definition: execUtils.c:445
PlanState ps
Definition: execnodes.h:1100
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:853
Plan * plan
Definition: execnodes.h:847
#define makeNode(_type_)
Definition: nodes.h:557
#define Assert(condition)
Definition: c.h:664
void ExecAssignExprContext(EState *estate, PlanState *planstate)
Definition: execUtils.c:423
ExprState * qual
Definition: execnodes.h:865
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:1112
void heap_rescan(HeapScanDesc scan, ScanKey key)
Definition: heapam.c:1521
HeapScanDesc ss_currentScanDesc
Definition: execnodes.h:1102
void ExecScanReScan(ScanState *node)
Definition: execScan.c:329
void ExecSeqScanEstimate ( SeqScanState node,
ParallelContext pcxt 
)

Definition at line 296 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().

298 {
299  EState *estate = node->ss.ps.state;
300 
303  shm_toc_estimate_keys(&pcxt->estimator, 1);
304 }
shm_toc_estimator estimator
Definition: parallel.h:41
Snapshot es_snapshot
Definition: execnodes.h:429
ScanState ss
Definition: execnodes.h:1112
EState * state
Definition: execnodes.h:849
#define shm_toc_estimate_chunk(e, sz)
Definition: shm_toc.h:51
Size pscan_len
Definition: execnodes.h:1113
PlanState ps
Definition: execnodes.h:1100
#define shm_toc_estimate_keys(e, cnt)
Definition: shm_toc.h:53
Size heap_parallelscan_estimate(Snapshot snapshot)
Definition: heapam.c:1600
void ExecSeqScanInitializeDSM ( SeqScanState node,
ParallelContext pcxt 
)

Definition at line 313 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().

315 {
316  EState *estate = node->ss.ps.state;
317  ParallelHeapScanDesc pscan;
318 
319  pscan = shm_toc_allocate(pcxt->toc, node->pscan_len);
321  node->ss.ss_currentRelation,
322  estate->es_snapshot);
323  shm_toc_insert(pcxt->toc, node->ss.ps.plan->plan_node_id, pscan);
324  node->ss.ss_currentScanDesc =
326 }
int plan_node_id
Definition: plannodes.h:143
Snapshot es_snapshot
Definition: execnodes.h:429
ScanState ss
Definition: execnodes.h:1112
Relation ss_currentRelation
Definition: execnodes.h:1101
EState * state
Definition: execnodes.h:849
Size pscan_len
Definition: execnodes.h:1113
PlanState ps
Definition: execnodes.h:1100
void heap_parallelscan_initialize(ParallelHeapScanDesc target, Relation relation, Snapshot snapshot)
Definition: heapam.c:1615
Plan * plan
Definition: execnodes.h:847
void * shm_toc_allocate(shm_toc *toc, Size nbytes)
Definition: shm_toc.c:88
HeapScanDesc ss_currentScanDesc
Definition: execnodes.h:1102
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
void ExecSeqScanInitializeWorker ( SeqScanState node,
shm_toc toc 
)

Definition at line 350 of file nodeSeqscan.c.

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

Referenced by ExecParallelInitializeWorker().

351 {
352  ParallelHeapScanDesc pscan;
353 
354  pscan = shm_toc_lookup(toc, node->ss.ps.plan->plan_node_id, false);
355  node->ss.ss_currentScanDesc =
357 }
int plan_node_id
Definition: plannodes.h:143
ScanState ss
Definition: execnodes.h:1112
Relation ss_currentRelation
Definition: execnodes.h:1101
PlanState ps
Definition: execnodes.h:1100
Plan * plan
Definition: execnodes.h:847
HeapScanDesc ss_currentScanDesc
Definition: execnodes.h:1102
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
void ExecSeqScanReInitializeDSM ( SeqScanState node,
ParallelContext pcxt 
)

Definition at line 335 of file nodeSeqscan.c.

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

Referenced by ExecParallelReInitializeDSM().

337 {
338  HeapScanDesc scan = node->ss.ss_currentScanDesc;
339 
341 }
ScanState ss
Definition: execnodes.h:1112
ParallelHeapScanDesc rs_parallel
Definition: relscan.h:73
HeapScanDesc ss_currentScanDesc
Definition: execnodes.h:1102
void heap_parallelscan_reinitialize(ParallelHeapScanDesc parallel_scan)
Definition: heapam.c:1638