Database Engineering · Scaling the database
Partitioning
Partitioning splits one huge table into smaller tables by a key such as date, inside the same database. Queries that filter on the key skip most partitions, and old data leaves by dropping a partition.
- Time16 min
- LevelDeveloper
- Pictures13 diagrams
- Check6 questions






Query asks for customer 42's orders created in the last 7 days.
Planner compares the date range with each partition's bounds.
Pruning drops every partition whose month cannot match.
Result rows from 2 partitions are combined and returned.
orders the parent: the name queries use, with no rows of its own.
Its files separate files on disk, removed whole when the month is dropped.