InnoDB has a maximum index length of 767 bytes for tables that use COMPACT or REDUNDANT row format, so for utf8mb3 or utf8mb4 columns, you can index a maximum of 255 or 191 characters, respectively. If you currently have utf8mb3 columns with indexes longer than 191 characters, you must index a smaller number of characters.
In an InnoDB table that uses COMPACT or REDUNDANT row format, these column and index definitions are legal:
col1 VARCHAR(500) CHARACTER SET utf8, INDEX (col1(255))
To use utf8mb4 instead, the index must be smaller:大概意思就是InnoDB最大索引长度为 767 字节数,用的编码是utf8mb4,则可以存储191个字符(767/4 约等于 191),编码字段长度超出最大索引长度后MySQL 默认在普通索引追加了191
col1 VARCHAR(500) CHARACTER SET utf8mb4, INDEX (col1(191))
准备了单表100W的数据进行测试
使用性能压力测试工具mysqlslap
性能测试脚本
CRC全称为Cyclic Redundancy Check,又叫循环冗余校验。加一个name_crc32列,创建这个列的所有,索引空间小很多,利用整型加速查询
CRC32是CRC算法的一种,返回值的范围0~2^32-1,使用bigint存储
欢迎光临 ToB企服应用市场:ToB评测及商务社交产业平台 (https://dis.qidao123.com/) | Powered by Discuz! X3.4 |