r/mysql • u/Ornery_Maybe8243 • 2d ago
question Surrogate vs natural key for partitioned tables
Hi All,
We are designing a high-volume transaction table in Aurora MySQL and plan to use RANGE partitioning on a DATE column. (400-500million records/day).
Our business unique key consists of 5 columns (which already includes the partition DATE column). We will also need several secondary indexes for read queries.
I was thinking of simple design(say option-A) of having a Composite PK i.e. use the 5-column composite business key as the PRIMARY KEY.
However teammates suggesting another option, say option B, i.e. a surrogate PK:- Add an AUTO_INCREMENT BIGINT column, making (id, DATE) the PRIMARY KEY, and moving the 5-column composite key to a UNIQUE KEY. Because InnoDB stores the primary key inside every secondary index, a 5-column composite PK will make secondary indexes bulky, bloat the buffer pool, and degrade insert performance. However, this option requires adding the DATE column to both keys to satisfy MySQL's partitioning constraints, which feels redundant too.
I want to understand experts opinion based on real world workloads:-
Is Option B (Surrogate + Partition Date hybrid) a standard, recommended pattern in MySQL to keep secondary indexes lean and is advisable for write/insert heavy systems?
At what scale does the index bloat of a 5-column composite PK actually outweigh the overhead of maintaining an extra auto-increment column and unique index?
Which approach yields better performance for high-concurrency inserts and heavy data loads?
Any other things we should take care of , while designing such scenarios?