What does size limit on MySQL index mean?

前端 未结 2 587
野趣味
野趣味 2021-01-16 04:28

I have a table created like so:

CREATE TABLE `my_table` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`info` varchar(50) DEFAULT NULL,
`some_more_info` sm         


        
相关标签:
2条回答
  • 2021-01-16 05:19

    Yes. The entire description about the index length can be found here: http://dev.mysql.com/doc/refman/5.0/en/create-index.html

    Prefix lengths are given in characters for nonbinary string types and in bytes for binary string types. That is, index entries consist of the first length characters of each column value for CHAR, VARCHAR, and TEXT columns, and the first length bytes of each column value for BINARY, VARBINARY, and BLOB columns.

    Also you create query has/had some extra ,'s.

    0 讨论(0)
  • 2021-01-16 05:32

    In short, yes, the first 24 characters are taken into consideration to build the BTree index. Indexing limits are assigned to text types such as varchar and text, as they don't affect numeric precision.

    0 讨论(0)
提交回复
热议问题