Parameter · Query Tuning / Planner Method Configuration
enable_seqscan
Enables the planner's use of sequential-scan plans.
- Default:
on - Type: bool
- Applies: Session (any user)
In plain words
A sequential scan reads a table from start to end. It is the best way to read a large share of a table. Turning this off does not forbid it (a table with no index can only be read that way), but makes the planner pick an index whenever one is usable.
For DBAs and operators
Sequential scans read pages in order (priced with seq_page_cost), benefit from OS read-ahead and, in PostgreSQL 18, from asynchronous I/O. They use a small ring buffer for large tables so they do not flush shared buffers.
Measured on 18.6: WHERE b < 90 matches 90% of the 200,000 rows: Seq Scan, cost 4,773. With enable_seqscan = off: Bitmap Heap Scan via an index, cost 6,540, more expensive and usually slower.
How it works since 18: instead of adding a disable_cost of 1010 to the path (which used to make EXPLAIN costs look absurd), the planner counts disabled nodes and picks the plan with the fewest, then the lowest cost. If a seq scan is unavoidable, EXPLAIN shows it with its normal cost and Disabled: true.
The main use is diagnosis: SET enable_seqscan = off; EXPLAIN ANALYZE … shows whether an index plan exists and how it really performs. If it is faster, fix the cost settings (random_page_cost, effective_cache_size) or statistics. Never leave it off server-wide.
How to change it
Any user can change it for their session with SET.
See it in context
Related parameters
enable_indexscan enable_bitmapscan seq_page_cost random_page_cost