全部产品
Search
文档中心

表格存储:查询索引描述信息

更新时间:Oct 07, 2023

通过show index语句查询表的索引描述信息。

说明 关于show index语句的更多信息,请参见查询索引描述信息

前提条件

参数

参数说明
querySQL语句,请根据所需功能进行设置。

示例

使用show index in test_table语句查询test_table表的索引描述信息。

[[('Table', 'test_table'), ('Non_unique', 0), ('Key_name', 'PRIMARY'), ('Seq_in_index', 1), ('Column_name', 'pk'), ('Is_defined_column', None), ('Search_type', ''), ('Collation', 'A'), ('Cardinality', 0), ('Sub_part', None), ('Packed', None), ('Null', ''), ('Index_type', ''), ('Comment', ''), ('Index_comment', ''), ('Visible', 'YES'), ('Expression', 'NULL')], [('Table', 'test_table'), ('Non_unique', 1), ('Key_name', 'test_table_index'), ('Seq_in_index', 1), ('Column_name', 'pk'), ('Is_defined_column', 'NO'), ('Search_type', 'KEYWORD'), ('Collation', 'A'), ('Cardinality', 0), ('Sub_part', None), ('Packed', None), ('Null', 'YES'), ('Index_type', 'SearchIndex'), ('Comment', ''), ('Index_comment', ''), ('Visible', 'YES'), ('Expression', 'NULL')], [('Table', 'test_table'), ('Non_unique', 1), ('Key_name', 'test_table_index'), ('Seq_in_index', 2), ('Column_name', 'string_value'), ('Is_defined_column', 'NO'), ('Search_type', 'KEYWORD'), ('Collation', 'A'), ('Cardinality', 0), ('Sub_part', None), ('Packed', None), ('Null', 'YES'), ('Index_type', 'SearchIndex'), ('Comment', ''), ('Index_comment', ''), ('Visible', 'YES'), ('Expression', 'NULL')], [('Table', 'test_table'), ('Non_unique', 1), ('Key_name', 'test_table_index'), ('Seq_in_index', 3), ('Column_name', 'bool_value'), ('Is_defined_column', 'NO'), ('Search_type', 'BOOLEAN'), ('Collation', 'A'), ('Cardinality', 0), ('Sub_part', None), ('Packed', None), ('Null', 'YES'), ('Index_type', 'SearchIndex'), ('Comment', ''), ('Index_comment', ''), ('Visible', 'YES'), ('Expression', 'NULL')], [('Table', 'test_table'), ('Non_unique', 1), ('Key_name', 'test_table_index'), ('Seq_in_index', 4), ('Column_name', 'double_value'), ('Is_defined_column', 'NO'), ('Search_type', 'DOUBLE'), ('Collation', 'A'), ('Cardinality', 0), ('Sub_part', None), ('Packed', None), ('Null', 'YES'), ('Index_type', 'SearchIndex'), ('Comment', ''), ('Index_comment', ''), ('Visible', 'YES'), ('Expression', 'NULL')], [('Table', 'test_table'), ('Non_unique', 1), ('Key_name', 'test_table_index'), ('Seq_in_index', 5), ('Column_name', 'long_value'), ('Is_defined_column', 'NO'), ('Search_type', 'LONG'), ('Collation', 'A'), ('Cardinality', 0), ('Sub_part', None), ('Packed', None), ('Null', 'YES'), ('Index_type', 'SearchIndex'), ('Comment', ''), ('Index_comment', ''), ('Visible', 'YES'), ('Expression', 'NULL')]]

假设test_table表下有一个test_table_index多元索引,多元索引的Schema如下图所示。

image.png

返回结果示例如下:

[[('Table', 'test_table'), ('Non_unique', 0), ('Key_name', 'PRIMARY'), ('Seq_in_index', 1), ('Column_name', 'pk'),('Is_defined_column', None), ('Search_type', ''), ('Collation', 'A'), ('Cardinality', 0), ('Sub_part', None),('Packed', None), ('Null', ''), ('Index_type', ''), ('Comment', ''), ('Index_comment', ''), ('Visible', 'YES'),('Expression', 'NULL')], 
 [('Table', 'test_table'), ('Non_unique', 1), ('Key_name', 'test_table_index'), ('Seq_in_index', 1), ('Column_name', 'pk'), ('Is_defined_column', 'NO'), ('Search_type', 'KEYWORD'), ('Collation', 'A'), ('Cardinality', 0), ('Sub_part', None), ('Packed', None), ('Null', 'YES'), ('Index_type', 'SearchIndex'), ('Comment', ''), ('Index_comment', ''), ('Visible', 'YES'), ('Expression', 'NULL')], 
 [('Table', 'test_table'), ('Non_unique', 1), ('Key_name', 'test_table_index'), ('Seq_in_index', 2), ('Column_name','string_value'), ('Is_defined_column', 'NO'), ('Search_type', 'KEYWORD'), ('Collation', 'A'), ('Cardinality', 0),('Sub_part', None), ('Packed', None), ('Null', 'YES'), ('Index_type', 'SearchIndex'), ('Comment', ''),('Index_comment', ''), ('Visible', 'YES'), ('Expression', 'NULL')], 
 [('Table', 'test_table'), ('Non_unique', 1), ('Key_name', 'test_table_index'), ('Seq_in_index', 3), ('Column_name', 'bool_value'), ('Is_defined_column', 'NO'), ('Search_type', 'BOOLEAN'), ('Collation', 'A'), ('Cardinality', 0), ('Sub_part', None), ('Packed', None), ('Null', 'YES'), ('Index_type', 'SearchIndex'), ('Comment', ''), ('Index_comment', ''), ('Visible', 'YES'), ('Expression', 'NULL')], 
 [('Table', 'test_table'), ('Non_unique', 1), ('Key_name', 'test_table_index'), ('Seq_in_index', 4), ('Column_name', 'double_value'), ('Is_defined_column', 'NO'), ('Search_type', 'DOUBLE'), ('Collation', 'A'), ('Cardinality', 0), ('Sub_part', None), ('Packed', None), ('Null', 'YES'), ('Index_type', 'SearchIndex'), ('Comment', ''), ('Index_comment', ''), ('Visible', 'YES'), ('Expression', 'NULL')], 
 [('Table', 'test_table'), ('Non_unique', 1), ('Key_name', 'test_table_index'), ('Seq_in_index', 5), ('Column_name', 'long_value'), ('Is_defined_column', 'NO'), ('Search_type', 'LONG'), ('Collation', 'A'), ('Cardinality', 0), ('Sub_part', None), ('Packed', None), ('Null', 'YES'), ('Index_type', 'SearchIndex'), ('Comment', ''), ('Index_comment', ''), ('Visible', 'YES'), ('Expression', 'NULL')]]