151
table partitioning
Physically split a table by a key, usually time, so a day can be dropped or scanned alone.
What is table partitioning?
Partitioning divides one logical table into physical pieces. Queries that filter on the partition key skip the rest (pruning). Dropping a month is a metadata operation. Partitioning is not sharding across servers, though people say both. A partition key nobody filters on does nothing.
Why does table partitioning matter when vibe coding?
Models add an index and leave a billion-row table. Or they partition by a column the query never uses. Name the key and the retention.
How do you do table partitioning?
Partition large fact tables by the column you always filter, usually time. Retention is `DROP PARTITION`. Prove pruning with a real query plan.
How do you ask a model for table partitioning?
Partition (table) by (date). Queries must filter on that key so partitions prune. Expiring data is a drop, not a delete of millions of rows. Do not partition by a column the query does not use.
What goes wrong with table partitioning?
Thousands of tiny partitions. Planning the query costs more than the scan you saved.