COLLATIONS

COLLATIONS 表提供了 CHARACTER_SETS 表中字符集对应的排序规则列表。目前 TiDB 包含该表仅为兼容 MySQL。

  1. USE information_schema;
  2. DESC collations;
  1. +--------------------+-------------+------+------+---------+-------+
  2. | Field | Type | Null | Key | Default | Extra |
  3. +--------------------+-------------+------+------+---------+-------+
  4. | COLLATION_NAME | varchar(32) | YES | | NULL | |
  5. | CHARACTER_SET_NAME | varchar(32) | YES | | NULL | |
  6. | ID | bigint(11) | YES | | NULL | |
  7. | IS_DEFAULT | varchar(3) | YES | | NULL | |
  8. | IS_COMPILED | varchar(3) | YES | | NULL | |
  9. | SORTLEN | bigint(3) | YES | | NULL | |
  10. +--------------------+-------------+------+------+---------+-------+
  11. 6 rows in set (0.00 sec)
  1. SELECT * FROM collations WHERE character_set_name='utf8mb4';
  1. +----------------+--------------------+------+------------+-------------+---------+
  2. | COLLATION_NAME | CHARACTER_SET_NAME | ID | IS_DEFAULT | IS_COMPILED | SORTLEN |
  3. +----------------+--------------------+------+------------+-------------+---------+
  4. | utf8mb4_bin | utf8mb4 | 46 | Yes | Yes | 1 |
  5. +----------------+--------------------+------+------------+-------------+---------+
  6. 1 row in set (0.00 sec)

COLLATION 表中列的含义如下:

  • COLLATION_NAME:排序规则名称
  • CHARACTER_SET_NAME:排序规则所属的字符集名称
  • ID:排序规则的 ID
  • IS_DEFAULT:该排序规则是否是所属字符集的默认排序规则
  • IS_COMPILED:字符集是否编译到服务器中
  • SORTLEN:排序规则在对字符进行排序时,所分配内存的最小长度