PostgreSQL Source Code git master
Loading...
Searching...
No Matches
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)
extern

Definition at line 294 of file nodeSeqscan.c.

295{
297
298 /*
299 * get information from node
300 */
302
303 /*
304 * close heap scan
305 */
306 if (scanDesc != NULL)
308}
static int fb(int x)
struct TableScanDescData * ss_currentScanDesc
Definition execnodes.h:1635
ScanState ss
Definition execnodes.h:1645
static void table_endscan(TableScanDesc scan)
Definition tableam.h:1004

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

Referenced by ExecEndNode().

◆ ExecInitSeqScan()

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

Definition at line 211 of file nodeSeqscan.c.

212{
214
215 /*
216 * Once upon a time it was possible to have an outerPlan of a SeqScan, but
217 * not any more.
218 */
219 Assert(outerPlan(node) == NULL);
220 Assert(innerPlan(node) == NULL);
221
222 /*
223 * create state structure
224 */
226 scanstate->ss.ps.plan = (Plan *) node;
227 scanstate->ss.ps.state = estate;
228
229 /*
230 * Miscellaneous initialization
231 *
232 * create expression context for node
233 */
234 ExecAssignExprContext(estate, &scanstate->ss.ps);
235
236 /*
237 * open the scan relation
238 */
239 scanstate->ss.ss_currentRelation =
241 node->scan.scanrelid,
242 eflags);
243
244 /* and create slot with the appropriate rowtype */
245 ExecInitScanTupleSlot(estate, &scanstate->ss,
246 RelationGetDescr(scanstate->ss.ss_currentRelation),
247 table_slot_callbacks(scanstate->ss.ss_currentRelation),
249
250 /*
251 * Initialize result type and projection.
252 */
255
256 /*
257 * initialize child expressions
258 */
259 scanstate->ss.ps.qual =
260 ExecInitQual(node->scan.plan.qual, (PlanState *) scanstate);
261
262 /*
263 * When EvalPlanQual() is not in use, assign ExecProcNode for this node
264 * based on the presence of qual and projection. Each ExecSeqScan*()
265 * variant is optimized for the specific combination of these conditions.
266 */
267 if (scanstate->ss.ps.state->es_epq_active != NULL)
268 scanstate->ss.ps.ExecProcNode = ExecSeqScanEPQ;
269 else if (scanstate->ss.ps.qual == NULL)
270 {
271 if (scanstate->ss.ps.ps_ProjInfo == NULL)
272 scanstate->ss.ps.ExecProcNode = ExecSeqScan;
273 else
274 scanstate->ss.ps.ExecProcNode = ExecSeqScanWithProject;
275 }
276 else
277 {
278 if (scanstate->ss.ps.ps_ProjInfo == NULL)
279 scanstate->ss.ps.ExecProcNode = ExecSeqScanWithQual;
280 else
281 scanstate->ss.ps.ExecProcNode = ExecSeqScanWithQualProject;
282 }
283
284 return scanstate;
285}
#define Assert(condition)
Definition c.h:945
ExprState * ExecInitQual(List *qual, PlanState *parent)
Definition execExpr.c:250
void ExecAssignScanProjectionInfo(ScanState *node)
Definition execScan.c:81
void ExecInitScanTupleSlot(EState *estate, ScanState *scanstate, TupleDesc tupledesc, const TupleTableSlotOps *tts_ops, uint16 flags)
void ExecInitResultTypeTL(PlanState *planstate)
void ExecAssignExprContext(EState *estate, PlanState *planstate)
Definition execUtils.c:490
Relation ExecOpenScanRelation(EState *estate, Index scanrelid, int eflags)
Definition execUtils.c:747
static TupleTableSlot * ExecSeqScanWithQual(PlanState *pstate)
static TupleTableSlot * ExecSeqScanWithQualProject(PlanState *pstate)
static TupleTableSlot * ExecSeqScan(PlanState *pstate)
static TupleTableSlot * ExecSeqScanEPQ(PlanState *pstate)
static TupleTableSlot * ExecSeqScanWithProject(PlanState *pstate)
#define makeNode(_type_)
Definition nodes.h:161
#define innerPlan(node)
Definition plannodes.h:264
#define outerPlan(node)
Definition plannodes.h:265
#define RelationGetDescr(relation)
Definition rel.h:540
Index scanrelid
Definition plannodes.h:540
Scan scan
Definition plannodes.h:549
const TupleTableSlotOps * table_slot_callbacks(Relation relation)
Definition tableam.c:59
#define TTS_FLAG_OBEYS_NOT_NULL_CONSTRAINTS
Definition tuptable.h:102

References Assert, ExecAssignExprContext(), ExecAssignScanProjectionInfo(), ExecInitQual(), ExecInitResultTypeTL(), ExecInitScanTupleSlot(), ExecOpenScanRelation(), ExecSeqScan(), ExecSeqScanEPQ(), ExecSeqScanWithProject(), ExecSeqScanWithQual(), ExecSeqScanWithQualProject(), fb(), innerPlan, makeNode, outerPlan, RelationGetDescr, SeqScan::scan, Scan::scanrelid, table_slot_callbacks(), and TTS_FLAG_OBEYS_NOT_NULL_CONSTRAINTS.

Referenced by ExecInitNode().

◆ ExecReScanSeqScan()

void ExecReScanSeqScan ( SeqScanState node)
extern

Definition at line 322 of file nodeSeqscan.c.

323{
324 TableScanDesc scan;
325
326 scan = node->ss.ss_currentScanDesc;
327
328 if (scan != NULL)
329 table_rescan(scan, /* scan desc */
330 NULL); /* new scan keys */
331
332 ExecScanReScan((ScanState *) node);
333}
void ExecScanReScan(ScanState *node)
Definition execScan.c:108
static void table_rescan(TableScanDesc scan, ScanKeyData *key)
Definition tableam.h:1013

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

Referenced by ExecReScan().

◆ ExecSeqScanEstimate()

void ExecSeqScanEstimate ( SeqScanState node,
ParallelContext pcxt 
)
extern

Definition at line 348 of file nodeSeqscan.c.

350{
351 EState *estate = node->ss.ps.state;
352
354 estate->es_snapshot);
357}
#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:672
shm_toc_estimator estimator
Definition parallel.h:43
EState * state
Definition execnodes.h:1179
Relation ss_currentRelation
Definition execnodes.h:1634
PlanState ps
Definition execnodes.h:1633
Size table_parallelscan_estimate(Relation rel, Snapshot snapshot)
Definition tableam.c:131

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 
)
extern

Definition at line 366 of file nodeSeqscan.c.

368{
369 EState *estate = node->ss.ps.state;
371
372 pscan = shm_toc_allocate(pcxt->toc, node->pscan_len);
374 pscan,
375 estate->es_snapshot);
376 shm_toc_insert(pcxt->toc, node->ss.ps.plan->plan_node_id, pscan);
377 node->ss.ss_currentScanDesc =
379}
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:46
Plan * plan
Definition execnodes.h:1177
int plan_node_id
Definition plannodes.h:231
TableScanDesc table_beginscan_parallel(Relation relation, ParallelTableScanDesc pscan)
Definition tableam.c:166
void table_parallelscan_initialize(Relation rel, ParallelTableScanDesc pscan, Snapshot snapshot)
Definition tableam.c:146

References EState::es_snapshot, fb(), 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 
)
extern

◆ ExecSeqScanReInitializeDSM()

void ExecSeqScanReInitializeDSM ( SeqScanState node,
ParallelContext pcxt 
)
extern

Definition at line 388 of file nodeSeqscan.c.

390{
392
395}
struct ParallelTableScanDescData * rs_parallel
Definition relscan.h:65
static void table_parallelscan_reinitialize(Relation rel, ParallelTableScanDesc pscan)
Definition tableam.h:1160

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

Referenced by ExecParallelReInitializeDSM().