data-infra
Glossary ↗Table Partitioning
Table partitioning splits one logically large table into many smaller physical pieces — partitions — usually by a key like date, tenant ID, or region. Queries and writes still address the single logical table; the database routes each row to the right partition underneath. It's distinct from sharding: partitioning divides data within one server, while sharding spreads it across many. The payoff is that the engine can skip entire partitions it knows are irrelevant — a query for last week's rows never touches last year's — which keeps scans fast as the table grows into billions of rows. Dropping old data becomes an instant partition drop instead of a slow, lock-heavy DELETE. For SaaS builders, time-based partitioning pairs naturally with data-retention policies, and tenant-based partitioning can isolate your largest customers. Practical note: choose a partition key that most queries filter on, or you lose the pruning benefit and just add overhead.
Related terms