1
SQLIntermediate#architecture
Partitioning splits one table into segments inside the same database, letting the engine prune irrelevant partitions. Sharding spreads data across separate database servers to scale writes and storage.
CREATE TABLE orders (id INT, order_date DATE) PARTITION BY RANGE (YEAR(order_date)) ( PARTITION p2025 VALUES LESS THAN (2026), PARTITION p2026 VALUES LESS THAN (2027) );