### Seq Scan
![[assets/ex_seqscan.png|256]]
### The Explain Trace
```sql
-- Querying the entire animals table
EXPLAIN (ANALYZE, COSTS, BUFFERS, VERBOSE)
SELECT * FROM animals;
```
```text
Seq Scan on public.animals (cost=1.00..348.00 rows=20000 width=27) (actual time=1.418..4.312 rows=20000 loops=1)
Output: id, name, species_id, created_at
Buffers: shared read=148
Planning:
Buffers: shared hit=51 read=17 dirtied=1
Planning Time: 4.076 ms
Execution Time: 4.872 ms
```
---
- **Description**: Performs a sequential scan of a table.
- **Performance**: Scans the entire table, can be slow.
- **Factors**: Table size, disk access speed.
- **Cost**: `disk I/O cost * table size`
![[assets/ex_scan.svg|256]]
- **Operates on**: [[Structures/Table]]
- **Workloads**:
- [[Workloads/IO/DataFile/DataFileRead|IO: DataFileRead]]
- [[Workloads/IO/DataFile/DataFilePrefetch|IO: DataFilePrefetch]]
- [[Workloads/LWLock/Buffers/BufferContent|LWLock: BufferContent]]
- [[Workloads/LWLock/Buffers/BufferMapping|LWLock: BufferMapping]]
- [[Workloads/LWLock/Replication/SyncScan|LWLock: SyncScan]]