IT lexicon › Database › Table scan

Table scan

Database På svenska → Updated: 2026-11-13

Reading every record in a table from top to bottom to find matches — slow but guaranteed to find everything.

A table scan is the slowest execution path in SQL. "SELECT * FROM users WHERE last_login > '2024-01-01'" without an index must read every million-row table and test the condition on each. A query planner avoids this when indexes exist. With an index, the database could skip directly to relevant records.

Before indexing became standard, table scans were how databases worked. Slow, but reliable — and on small datasets, the overhead didn't matter. Today a table scan is a red flag: a missing index or a poorly-written query. Query optimizers spend considerable effort avoiding them. On huge tables, a table scan can take hours.

← Back to the lexicon