通過show index語句查詢表的索引描述信息。
說明 關于show index語句的更多信息,請參見查詢索引描述信息。
前提條件
參數
參數 | 說明 |
query | SQL語句,請根據所需功能進行設置。 |
示例
使用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如下圖所示。
返回結果示例如下:
[[('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')]]
文檔內容是否對您有幫助?