如何通过系统表查看表的索引和注释?

查看某一个库下某一张表的索引
SELECT DISTINCT lower(index_name) index_name,lower(index_type) type FROM information_schema.statistics 
WHERE table_schema = 'employees' AND table_name = 'employees';
查看某一个库下某一张表的某一个索引
SELECT lower(column_name) column_name,seq_in_index column_position FROM information_schema.statistics
WHERE table_schema = 'employees' AND table_name = 'employees' AND index_name = 'primary';
查看某一个库下某一个表的注释
SELECT table_comment comments FROM information_schema.TABLES
WHERE table_schema = 'employees' AND table_name = 'employees';
查看某一个库下某一个表的列的注释
SELECT lower(column_name) column_name,column_comment comments
FROM COLUMNS WHERE table_schema = 'employees' AND table_name = 'employees'; 

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

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) 

8a中系统表不能与用户表关联该如何解决?

因为两种表使用的是不同的数据库引擎,因此需要创建与系统表同样表结构的Express引擎表。
打开_gbase_query_path参数(set global _gbase_query_path=1)。
执行insert select,将系统表的数据转存到对应的Express引擎表中。
基于Express引擎的表进行两表JOIN查询。