当前位置: 代码迷 >> 综合 >> mysql Cardinality
  详细解决方案

mysql Cardinality

热度:63   发布时间:2023-12-21 19:24:57.0
show index 有一个重要的字段信息 Cardinality,表示索引的散列:
show index from message_message

-------+---------+
| Table | Non_unique | Key_name | Seq_in_index | Column_name | Collation | Cardinality | Sub_part | Packed | Null | Index_type | Comment |
+-----------------+------------+--------------------+--------------+-----------------------+-----------+-------------+----------+--------+------+------------+---------+
| message_message | 0 | PRIMARY | 1 | id | A | 12171545 | NULL | NULL | | BTREE | |
| message_message | 1 | idx_parent | 1 | parent_id | A | 3042886 | NULL | NULL | YES | BTREE | |
| message_message | 1 | idx_last_replied | 1 | last_replied_datetime | A | 12171545 | NULL | NULL | | BTREE | |
| message_message | 1 | idx_x8 | 1 | sender_id | A | 338098 | NULL | NULL | YES | BTREE | |
| message_message | 1 | idx_x8 | 2 | add_datetime | A | 12171545 | NULL | NULL | | BTREE | |
| message_message | 1 | idx_cat_add | 1 | category | A | 17 | NULL | NULL | | BTREE | |




参考:http://oliver-peng.iteye.com/blog/671309
http://blog.donews.com/maverick/archive/2007/09/28/1214300.aspx
http://www.penglixun.com/tech/database/mysql_show_index_cardinality.html
  相关解决方案