{"Entry":{"collection":"plan","key":"seq-scan","name":"Seq Scan","aliases":["Seq Scan","SeqScan","T_SeqScan"],"metadata":{"aliases":["Seq Scan","SeqScan","T_SeqScan"],"category":"Scan","content_hash":"9ab82aa4b6c2f0aa7a079f4847bc7b25fb25745e8e050604f944c7496f166391","imported_at":"2026-09-30T00:40:44.246834+08:00","name":"Seq Scan","name_zh":"SeqScan","slug":"seq-scan","summary":"Reads a relation through a sequential scan and applies its scan qualifications."}},"Definition":{"Collection":"plan","Key":"seq-scan","SourceDatabase":"center","Version":"18","SourceTable":"plan_node","SourceKey":"seq-scan","SourceRevision":"555610c24d53e4316da5b7d3fc25c279d96856d5e0e23ee308c328c5fa881d9f","Facts":{"comparison_data":{"initializer":"ExecInitSeqScan","memory_mechanism":"unclassified","node_tag":"T_SeqScan","parallel_callbacks":["ExecSeqScanEstimate","ExecSeqScanInitializeDSM","ExecSeqScanInitializeWorker","ExecSeqScanReInitializeDSM"],"partial_modes":[],"strategies":[],"text_names":["Seq Scan"]},"comparison_hash":"5631c0db91382334dc4ca321ae0335013d10ae1c0c24f3523fcca0184bbbc81b","description":["Reads a relation through a sequential scan and applies its scan qualifications."],"evidence_kind":"source and documentation","explain_names":["Seq Scan"],"explain_prefixes":["Parallel","Async"],"facts":[{"label":"Core node tag","value":"T_SeqScan"},{"label":"Structured EXPLAIN Node Type","value":"Seq Scan"},{"label":"Inputs","value":"A relation"},{"label":"Output","value":"Qualified relation tuples"},{"label":"Executor initializer","value":"ExecInitSeqScan"},{"label":"Memory mechanism","value":"unclassified"}],"memory":{"description":"This extraction does not assign a universal memory limit or spill policy to this node. Inspect the same-build implementation and its expressions or provider.","evidence":[{"archive_sha256":"555610c24d53e4316da5b7d3fc25c279d96856d5e0e23ee308c328c5fa881d9f","label":"src/backend/executor/nodeSeqscan.c","path":"src/backend/executor/nodeSeqscan.c","sha256":"e6c9800872e17a6cfb6e58613de7e82da082b4d430557a3065a3caa6fe24f34d","url":"https://ftp.postgresql.org/pub/source/v18.6/postgresql-18.6.tar.bz2"}],"mechanism":"unclassified","source_notes":[]},"node_tag":"T_SeqScan","parallel_callbacks":["ExecSeqScanEstimate","ExecSeqScanInitializeDSM","ExecSeqScanInitializeWorker","ExecSeqScanReInitializeDSM"],"partial_modes":[],"related":[{"label":"EXPLAIN","url":"/wiki/sql/explain/?v=18"},{"label":"Using EXPLAIN","url":"/docs/18/using-explain.html"},{"label":"Parallel plans","url":"/docs/18/parallel-plans.html"},{"label":"enable_seqscan","url":"/wiki/guc/enable_seqscan/?v=18"}],"release":{"channel":"stable","label":"18.6","major":"18","ref":"PostgreSQL 18.6 source archive","revision":"555610c24d53e4316da5b7d3fc25c279d96856d5e0e23ee308c328c5fa881d9f","source_snapshot_utc":"","source_url":"https://ftp.postgresql.org/pub/source/v18.6/postgresql-18.6.tar.bz2"},"runtime_verified":false,"sections":[{"paragraphs":["Structured formats use the Node Type above. Text-format spellings can also include operation, strategy, join type, scan direction or aggregation-stage attributes.","Text names recorded by this source: Seq Scan.","Parallel-aware and parallel-safe are different plan properties. A node running inside a parallel worker is not necessarily a parallel-aware node."],"title":"EXPLAIN names and attributes"},{"paragraphs":["This extraction does not assign a universal memory limit or spill policy to this node. Inspect the same-build implementation and its expressions or provider."],"title":"Memory and temporary storage"},{"paragraphs":["The source callbacks below can coordinate execution or collect worker instrumentation. Their presence is not a blanket claim that this node supports a shared parallel scan or shared state.","Callbacks in this build: ExecSeqScanEstimate, ExecSeqScanInitializeDSM, ExecSeqScanInitializeWorker, ExecSeqScanReInitializeDSM."],"title":"Parallel execution and instrumentation"},{"paragraphs":["Notice that the EXPLAIN output shows the WHERE clause being applied as a “ filter ” condition attached to the Seq Scan plan node. This means that the plan node checks the condition for each row it scans, and outputs only the ones that pass the condition. The estimate of output rows has been reduced because of the WHERE clause. However, the scan will still have to visit all 10000 rows, so the cost hasn't decreased; in fact it has gone up a bit (by 10000 * cpu_operator_cost , to be exact) to reflect the extra CPU time spent checking the WHERE condition."],"title":"Same-version manual discussion"},{"blocks":[{"code":"EXPLAIN SELECT * FROM tenk1;\n\n                         QUERY PLAN\n-------------------------------------------------------------\n Seq Scan on tenk1  (cost=0.00..445.00 rows=10000 width=244)","paragraphs":["Example copied from the PostgreSQL 18.6 manual; it was not executed for this collection.","Here is a trivial example, just to show what the output looks like:"],"source":{"label":"PostgreSQL 18.6 · using-explain","path":"using-explain.html","sha256":"60040c30180093418a0affe56dd27dff9df2504b705b38039589e458bf5c31ed","url":"/docs/18/using-explain.html#USING-EXPLAIN-BASICS"}},{"code":"EXPLAIN SELECT * FROM tenk1 WHERE unique1 \u003c 7000;\n\n                         QUERY PLAN\n------------------------------------------------------------\n Seq Scan on tenk1  (cost=0.00..470.00 rows=7000 width=244)\n   Filter: (unique1 \u003c 7000)","paragraphs":["Example copied from the PostgreSQL 18.6 manual; it was not executed for this collection.","Now let's modify the query to add a WHERE condition:"],"source":{"label":"PostgreSQL 18.6 · using-explain","path":"using-explain.html","sha256":"60040c30180093418a0affe56dd27dff9df2504b705b38039589e458bf5c31ed","url":"/docs/18/using-explain.html#USING-EXPLAIN-BASICS"}}],"title":"Examples from this manual build"},{"paragraphs":["nodeSeqscan.c Support routines for sequential scans of relations.","ExecSeqScanEstimate estimates DSM space needed for parallel scan ExecSeqScanInitializeDSM initialize DSM for parallel scan ExecSeqScanReInitializeDSM reinitialize DSM for fresh parallel scan ExecSeqScanInitializeWorker attach to DSM info in parallel worker","We reach here if the scan is not parallel, or if we're serially executing a scan that was planned to be parallel.","SeqRecheck -- access method routine to recheck a tuple in EvalPlanQual","Note that unlike IndexScan, SeqScan never use keys in heap_beginscan (and this is very bad) - so, here we do not check are keys ok or not."],"title":"Executor implementation notes"},{"code":"case T_SeqScan:\n\t\t\tpname = sname = \"Seq Scan\";\n\t\t\tbreak;","title":"EXPLAIN identity in core source"}],"source_inventory":{"executor":"src/backend/executor/execProcnode.c","explain":"src/backend/commands/explain.c","implementation":"src/backend/executor/nodeSeqscan.c"},"sources":[{"archive_sha256":"555610c24d53e4316da5b7d3fc25c279d96856d5e0e23ee308c328c5fa881d9f","label":"src/backend/commands/explain.c:1432","line":1432,"path":"src/backend/commands/explain.c","sha256":"34c86d6070224a0e981efef51f79101d6d505e5874f1684ace183034bab14bb4","url":"https://ftp.postgresql.org/pub/source/v18.6/postgresql-18.6.tar.bz2"},{"archive_sha256":"555610c24d53e4316da5b7d3fc25c279d96856d5e0e23ee308c328c5fa881d9f","label":"src/backend/executor/execProcnode.c:209","line":209,"path":"src/backend/executor/execProcnode.c","sha256":"f8a06a3f539077249b20664b2812433db6d7bd12b2c0ca633525db43d06f112a","url":"https://ftp.postgresql.org/pub/source/v18.6/postgresql-18.6.tar.bz2"},{"archive_sha256":"555610c24d53e4316da5b7d3fc25c279d96856d5e0e23ee308c328c5fa881d9f","label":"src/backend/executor/nodeSeqscan.c","path":"src/backend/executor/nodeSeqscan.c","sha256":"e6c9800872e17a6cfb6e58613de7e82da082b4d430557a3065a3caa6fe24f34d","url":"https://ftp.postgresql.org/pub/source/v18.6/postgresql-18.6.tar.bz2"},{"archive_sha256":"555610c24d53e4316da5b7d3fc25c279d96856d5e0e23ee308c328c5fa881d9f","label":"src/include/nodes/plannodes.h","path":"src/include/nodes/plannodes.h","sha256":"52422b327a8049fbbb20d8b96008a0fc0a6fafa60f7eff3c695d5b2e83830120","url":"https://ftp.postgresql.org/pub/source/v18.6/postgresql-18.6.tar.bz2"},{"label":"PostgreSQL 18.6 · using-explain","path":"using-explain.html","sha256":"60040c30180093418a0affe56dd27dff9df2504b705b38039589e458bf5c31ed","url":"/docs/18/using-explain.html#USING-EXPLAIN-BASICS"}],"strategies":[],"tables":[{"columns":[{"key":"label","label":"Text-format label"},{"key":"identity","label":"Structured node identity"}],"key":"explain-labels","rows":[{"identity":"Seq Scan","label":"Seq Scan"}],"title":"EXPLAIN labels in this source build"}]},"ManualEvidence":{"release":{"channel":"stable","label":"18.6","major":"18","ref":"PostgreSQL 18.6 source archive","revision":"555610c24d53e4316da5b7d3fc25c279d96856d5e0e23ee308c328c5fa881d9f","source_snapshot_utc":"","source_url":"https://ftp.postgresql.org/pub/source/v18.6/postgresql-18.6.tar.bz2"},"sources":[{"archive_sha256":"555610c24d53e4316da5b7d3fc25c279d96856d5e0e23ee308c328c5fa881d9f","label":"src/backend/commands/explain.c:1432","line":1432,"path":"src/backend/commands/explain.c","sha256":"34c86d6070224a0e981efef51f79101d6d505e5874f1684ace183034bab14bb4","url":"https://ftp.postgresql.org/pub/source/v18.6/postgresql-18.6.tar.bz2"},{"archive_sha256":"555610c24d53e4316da5b7d3fc25c279d96856d5e0e23ee308c328c5fa881d9f","label":"src/backend/executor/execProcnode.c:209","line":209,"path":"src/backend/executor/execProcnode.c","sha256":"f8a06a3f539077249b20664b2812433db6d7bd12b2c0ca633525db43d06f112a","url":"https://ftp.postgresql.org/pub/source/v18.6/postgresql-18.6.tar.bz2"},{"archive_sha256":"555610c24d53e4316da5b7d3fc25c279d96856d5e0e23ee308c328c5fa881d9f","label":"src/backend/executor/nodeSeqscan.c","path":"src/backend/executor/nodeSeqscan.c","sha256":"e6c9800872e17a6cfb6e58613de7e82da082b4d430557a3065a3caa6fe24f34d","url":"https://ftp.postgresql.org/pub/source/v18.6/postgresql-18.6.tar.bz2"},{"archive_sha256":"555610c24d53e4316da5b7d3fc25c279d96856d5e0e23ee308c328c5fa881d9f","label":"src/include/nodes/plannodes.h","path":"src/include/nodes/plannodes.h","sha256":"52422b327a8049fbbb20d8b96008a0fc0a6fafa60f7eff3c695d5b2e83830120","url":"https://ftp.postgresql.org/pub/source/v18.6/postgresql-18.6.tar.bz2"},{"label":"PostgreSQL 18.6 · using-explain","path":"using-explain.html","sha256":"60040c30180093418a0affe56dd27dff9df2504b705b38039589e458bf5c31ed","url":"/docs/18/using-explain.html#USING-EXPLAIN-BASICS"}]},"MeasuredEvidence":{"runtime_verified":false}},"Text":{"Collection":"plan","Key":"seq-scan","SourceDatabase":"center","Version":"18","Locale":"en","Title":"Seq Scan","Summary":"Reads a relation through a sequential scan and applies its scan qualifications.","BodyHTML":"\u003cp\u003eReads a relation through a sequential scan and applies its scan qualifications.\u003c/p\u003e","SourceRevision":"555610c24d53e4316da5b7d3fc25c279d96856d5e0e23ee308c328c5fa881d9f","ContentHash":"1fa4265163a3625aea720b963b64540a6187d4545ada8436f98de8cb85b09ad9","Payload":{"description":["Reads a relation through a sequential scan and applies its scan qualifications."],"related":[{"label":"EXPLAIN","url":"/wiki/sql/explain/?v=18"},{"label":"Using EXPLAIN","url":"/docs/18/using-explain.html"},{"label":"Parallel plans","url":"/docs/18/parallel-plans.html"},{"label":"enable_seqscan","url":"/wiki/guc/enable_seqscan/?v=18"}],"sections":[{"paragraphs":["Structured formats use the Node Type above. Text-format spellings can also include operation, strategy, join type, scan direction or aggregation-stage attributes.","Text names recorded by this source: Seq Scan.","Parallel-aware and parallel-safe are different plan properties. A node running inside a parallel worker is not necessarily a parallel-aware node."],"title":"EXPLAIN names and attributes"},{"paragraphs":["This extraction does not assign a universal memory limit or spill policy to this node. Inspect the same-build implementation and its expressions or provider."],"title":"Memory and temporary storage"},{"paragraphs":["The source callbacks below can coordinate execution or collect worker instrumentation. Their presence is not a blanket claim that this node supports a shared parallel scan or shared state.","Callbacks in this build: ExecSeqScanEstimate, ExecSeqScanInitializeDSM, ExecSeqScanInitializeWorker, ExecSeqScanReInitializeDSM."],"title":"Parallel execution and instrumentation"},{"paragraphs":["Notice that the EXPLAIN output shows the WHERE clause being applied as a “ filter ” condition attached to the Seq Scan plan node. This means that the plan node checks the condition for each row it scans, and outputs only the ones that pass the condition. The estimate of output rows has been reduced because of the WHERE clause. However, the scan will still have to visit all 10000 rows, so the cost hasn't decreased; in fact it has gone up a bit (by 10000 * cpu_operator_cost , to be exact) to reflect the extra CPU time spent checking the WHERE condition."],"title":"Same-version manual discussion"},{"blocks":[{"code":"EXPLAIN SELECT * FROM tenk1;\n\n                         QUERY PLAN\n-------------------------------------------------------------\n Seq Scan on tenk1  (cost=0.00..445.00 rows=10000 width=244)","paragraphs":["Example copied from the PostgreSQL 18.6 manual; it was not executed for this collection.","Here is a trivial example, just to show what the output looks like:"],"source":{"label":"PostgreSQL 18.6 · using-explain","path":"using-explain.html","sha256":"60040c30180093418a0affe56dd27dff9df2504b705b38039589e458bf5c31ed","url":"/docs/18/using-explain.html#USING-EXPLAIN-BASICS"}},{"code":"EXPLAIN SELECT * FROM tenk1 WHERE unique1 \u003c 7000;\n\n                         QUERY PLAN\n------------------------------------------------------------\n Seq Scan on tenk1  (cost=0.00..470.00 rows=7000 width=244)\n   Filter: (unique1 \u003c 7000)","paragraphs":["Example copied from the PostgreSQL 18.6 manual; it was not executed for this collection.","Now let's modify the query to add a WHERE condition:"],"source":{"label":"PostgreSQL 18.6 · using-explain","path":"using-explain.html","sha256":"60040c30180093418a0affe56dd27dff9df2504b705b38039589e458bf5c31ed","url":"/docs/18/using-explain.html#USING-EXPLAIN-BASICS"}}],"title":"Examples from this manual build"},{"paragraphs":["nodeSeqscan.c Support routines for sequential scans of relations.","ExecSeqScanEstimate estimates DSM space needed for parallel scan ExecSeqScanInitializeDSM initialize DSM for parallel scan ExecSeqScanReInitializeDSM reinitialize DSM for fresh parallel scan ExecSeqScanInitializeWorker attach to DSM info in parallel worker","We reach here if the scan is not parallel, or if we're serially executing a scan that was planned to be parallel.","SeqRecheck -- access method routine to recheck a tuple in EvalPlanQual","Note that unlike IndexScan, SeqScan never use keys in heap_beginscan (and this is very bad) - so, here we do not check are keys ok or not."],"title":"Executor implementation notes"},{"code":"case T_SeqScan:\n\t\t\tpname = sname = \"Seq Scan\";\n\t\t\tbreak;","title":"EXPLAIN identity in core source"}],"tables":[{"columns":[{"key":"label","label":"Text-format label"},{"key":"identity","label":"Structured node identity"}],"key":"explain-labels","rows":[{"identity":"Seq Scan","label":"Seq Scan"}],"title":"EXPLAIN labels in this source build"}]}},"RequestedLocale":"zh-Hans","Fallback":true,"Versions":["10","11","12","13","14","15","16","17","18","19","20"],"Locales":["en"],"Signatures":null,"Spellings":null,"SQLState":null,"Evidence":null}
