如何查看所有创建了hash索引的表?

warning: 这篇文章距离上次修改已过1648天,其中的内容可能已经有所变动。

8a数据库中的information_schema.COLUMNS表中记录了某列是否是索引,可以通过如下sql查找所有的索引字段:

select TABLE_SCHEMA,TABLE_NAME,COLUMN_NAME,COLUMN_KEY from information_schema.COLUMNS where COLUMN_KEY='MUL' and TABLE_SCHEMA<>'gbase';

获取具体的表名称后,可以通过如下sql查看该表索引的具体情况:

gbase> show index from test.t1;
 +-------+------------+----------+--------------+-------------+-----------+-------------+----------+--------+------+-------------+---------+
 | Table | Non_unique | Key_name | Seq_in_index | Column_name | Collation | Cardinality | Sub_part | Packed | Null | Index_type  | Comment |
 +-------+------------+----------+--------------+-------------+-----------+-------------+----------+--------+------+-------------+---------+
 | t1    |          1 | inx_test |            1 | a           | NULL      |        NULL |     NULL | NULL   | YES  | GLOBAL HASH |         |
 +-------+------------+----------+--------------+-------------+-----------+-------------+----------+--------+------+-------------+---------+
 1 row in set (Elapsed: 00:00:00.00) 
最后修改于:2020年10月28日 12:18

添加新评论