A natural key means something (an email, a SKU); a surrogate key only identifies the row. Natural keys change, dragging every foreign key along, and InnoDB copies the primary key into each secondary index, so shop uses narrow surrogates and keeps natural keys UNIQUE. Natural keys suit stable codes (country) and junction tables. Use a UUID when ids are made outside the database or must not be guessable. UUID() returns version 1, which starts with the fastest-changing timestamp bits; UUID_TO_BIN(u, 1) packs it into BINARY(16) with the first and third groups swapped, so later values sort later:
SET @u = UUID();
SELECT @u AS uuid, HEX(UUID_TO_BIN(@u, 1)) AS packed;+--------------------------------------+----------------------------------+ | uuid | packed | +--------------------------------------+----------------------------------+ | 98bfb64a-b727-11f1-98d6-00155d5f9c3f | 11F1B72798BFB64A98D600155D5F9C3F | +--------------------------------------+----------------------------------+
InnoDB clusters rows by primary key. In one run here, 300,000 inserts took 2.43 s and 36 MB with INT AUTO_INCREMENT, 2.51 s and 40 MB with swapped UUIDs, and 5.46 s and 60 MB with RANDOM_BYTES(16), standing in for random version 4 UUIDs. RFC 9562 (2024) defines time-ordered version 7; MySQL 9.7 524 cannot generate it (MariaDB 11.7 3,681 can), so make v7 in PHP and store it with UUID_TO_BIN(u), without the swap.