GBase 8a
运维管理
文章

如何查看gbase8a哪些表上创建有索引

发表于2025-12-08 11:12:5733次浏览0个评论

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)

评论

登录后才可以发表评论