mysql 索引长度限制
MySQL :: MySQL 8.4 Reference Manual :: 17.21 InnoDB Limits
-
The index key prefix length limit is 3072 bytes for
InnoDBtables that useDYNAMICorCOMPRESSEDrow format.The index key prefix length limit is 767 bytes for
InnoDBtables that use theREDUNDANTorCOMPACTrow format. For example, you might hit this limit with a column prefix index of more than 191 characters on aTEXTorVARCHARcolumn, assuming autf8mb4character set and the maximum of 4 bytes for each character.Attempting to use an index key prefix length that exceeds the limit returns an error.
If you reduce the
InnoDBpage size to 8KB or 4KB by specifying theinnodb_page_sizeoption when creating the MySQL instance, the maximum length of the index key is lowered proportionally, based on the limit of 3072 bytes for a 16KB page size. That is, the maximum index key length is 1536 bytes when the page size is 8KB, and 768 bytes when the page size is 4KB.The limits that apply to index key prefixes also apply to full-column index keys.

浙公网安备 33010602011771号