通過show index語句查詢表的索引描述資訊。
說明
關於show index語句的更多資訊,請參見查詢索引描述資訊。
前提條件
- 已初始化Client。具體操作,請參見初始化OTSClient。
- 已建立映射關係。具體操作,請參見建立映射關係。
樣本
使用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')]]