SQL & Relational Databases (50 Qs)•Part 3: Advanced Internals, Scale & Production Patterns (Senior / Lead)
What is Table Partitioning and Partition Pruning?
senior Levelsql-databasesAdvanced Internals
In Simple Words: Table Partitioning divides a multi-million row table into physical child tables based on a key (Range, List, Hash):
- Partition Pruning: During query execution, the optimizer inspects the query
WHEREclause and automatically skips reading partition files that cannot match the condition. - Example: A query filtering on
WHERE sale_date = '2026-03-15'reads only thesales_2026_03partition, ignoring years of historical data!