在「MySQL 8.0: When to use utf8mb3 over utf8mb4?」這邊提到了 MySQL 對 utf8
以及 utf8mb4
的故事,以及在 MySQL 8.0 預期的效能提昇:
可以看到 Oracle 的團隊花了不少力氣提昇 utf8mb4
的效能。另外提到了在 5.7 的時候將 row format 的預設值轉成 DYNAMIC
:
MySQL 5.7 (2015) added some optimizations such as a variable length sort buffer, and also changed InnoDB’s default row format to DYNAMIC. This allows for indexes on VARCHAR(255) with utf8mb4; something that made migrations more difficult prior.
依照「14.11.3 DYNAMIC and COMPRESSED Row Formats」這邊的敘述,看起來 COMPRESSED
也應該支援一樣的特性,不過不確定... (因為通常不會完整 index 整個 VARCHAR(255)
,只會 index 某個 prefix length):
The COMPRESSED row format uses similar internal details for off-page storage as the DYNAMIC row format, with additional storage and performance considerations from the table and index data being compressed and using smaller page sizes.