开发指南—DAL语句—SHOW—SHOW GLOBAL INDEX

本文涉及的产品
云原生数据库 PolarDB 分布式版,标准版 2核8GB
简介: PolarDB-X支持使用全局二级索引,本文将介绍如何使用SHOW GLOBAL INDEX命令查看已创建或创建中的全局二级索引。

语法


SHOW GLOBAL {INDEX | INDEXES} [FROM [schema_name.]tbl_name]

schema_nametbl_name是可选的,用于过滤表名或查看其它数据库上表的信息。


show global index; # 查询当前数据库上所有表的全局二级索引信息

show global index from xxx_tb; # 查询当前数据库上 xxx_tb 的全局二级索引信息
show global index from xxx_db.xxx_tb; # 查询 xxx_db 上 xxx_tb 的全局二级索引信息(跨库查询)

示例


mysql> show global index;
+---------------------+----------------------+------------+-------------------------------+----------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------+------------------+---------------------+--------------------+------------------+---------------------+--------------------+----------+
| SCHEMA | TABLE | NON_UNIQUE | KEY_NAME | INDEX_NAMES | COVERING_NAMES | INDEX_TYPE | DB_PARTITION_KEY | DB_PARTITION_POLICY | DB_PARTITION_COUNT | TB_PARTITION_KEY | TB_PARTITION_POLICY | TB_PARTITION_COUNT | STATUS |
+---------------------+----------------------+------------+-------------------------------+----------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------+------------------+---------------------+--------------------+------------------+---------------------+--------------------+----------+
| XXXX_DRDS_LOCAL_APP | full_gsi_ddl_renamed | 1 | g_i_c_ddl_c_blob_long_renamed | c_blob_long | id, c_bit_1, c_bit_8, c_bit_16, c_bit_32, c_bit_64, c_tinyint_1, c_tinyint_1_un, c_tinyint_4, c_tinyint_4_un, c_tinyint_8, c_tinyint_8_un, c_smallint_16, c_smallint_16_un, c_mediumint_1, c_mediumint_24, c_mediumint_24_un, c_int_1, c_int_32, c_int_32_un, c_bigint_1, c_bigint_64, c_bigint_64_un, c_decimal, c_decimal_pr, c_float, c_float_pr, c_float_un, c_double, c_double_pr, c_double_un, c_date, c_datetime, c_datetime_3, c_datetime_6, c_timestamp_1, c_timestamp_3, c_time, c_time_1, c_time_3, c_time_6, c_year, c_year_4, c_char, c_varchar, c_binary, c_varbinary, c_blob_tiny, c_blob_medium, c_text_tiny, c_text, c_text_medium, c_text_long, c_enum, c_set, c_json, c_point, c_linestring, c_polygon, c_multipoint, c_multilinestring, c_multipolygon, c_geometrycollection, c_geometory | NULL | c_blob_long | HASH | 4 | c_blob_long | HASH | 3 | PUBLIC |
| XXXX_DRDS_LOCAL_APP | full_gsi_ddl_renamed | 1 | g_i_c_ddl_c_mediumint_1 | c_mediumint_1 | id, c_bit_1, c_bit_8, c_bit_16, c_bit_32, c_bit_64, c_tinyint_1, c_tinyint_1_un, c_tinyint_4, c_tinyint_4_un, c_tinyint_8, c_tinyint_8_un, c_smallint_16, c_smallint_16_un, c_mediumint_24, c_mediumint_24_un, c_int_1, c_int_32, c_int_32_un, c_bigint_1, c_bigint_64, c_bigint_64_un, c_decimal, c_decimal_pr, c_float, c_float_pr, c_float_un, c_double, c_double_pr, c_double_un, c_date, c_datetime, c_datetime_3, c_datetime_6, c_timestamp_1, c_timestamp_3, c_time, c_time_1, c_time_3, c_time_6, c_year, c_year_4, c_char, c_varchar, c_binary, c_varbinary, c_blob_tiny, c_blob_medium, c_blob_long, c_text_tiny, c_text, c_text_medium, c_text_long, c_enum, c_set, c_json, c_point, c_linestring, c_polygon, c_multipoint, c_multilinestring, c_multipolygon, c_geometrycollection, c_geometory, c_smallint_1, c_timestamp_6 | NULL | c_mediumint_1 | HASH | 4 | c_mediumint_1 | HASH | 3 | PUBLIC |
| XXXX_DRDS_LOCAL_APP | full_gsi_ddl_renamed | 1 | g_i_c_ddl_c_smallint_16_un | c_smallint_16_un, c_time_1 | id, c_bit_1, c_bit_8, c_bit_16, c_bit_32, c_bit_64, c_tinyint_1, c_tinyint_1_un, c_tinyint_4, c_tinyint_4_un, c_tinyint_8, c_tinyint_8_un, c_smallint_16, c_mediumint_1, c_mediumint_24, c_mediumint_24_un, c_int_1, c_int_32, c_int_32_un, c_bigint_1, c_bigint_64, c_bigint_64_un, c_decimal, c_decimal_pr, c_float, c_float_pr, c_float_un, c_double, c_double_pr, c_double_un, c_date, c_datetime, c_datetime_3, c_datetime_6, c_timestamp_1, c_timestamp_3, c_time, c_time_3, c_time_6, c_year, c_year_4, c_char, c_varchar, c_binary, c_varbinary, c_blob_tiny, c_blob_medium, c_blob_long, c_text_tiny, c_text, c_text_medium, c_text_long, c_enum, c_set, c_json, c_point, c_linestring, c_polygon, c_multipoint, c_multilinestring, c_multipolygon, c_geometrycollection, c_geometory | NULL | c_smallint_16_un | HASH | 4 | c_smallint_16_un | HASH | 3 | PUBLIC |
| XXXX_DRDS_LOCAL_APP | t_order | 0 | g_i_seller | seller_id | id, order_id | HASH | seller_id | HASH | 4 | seller_id | HASH | 2 | CREATING |
+---------------------+----------------------+------------+-------------------------------+----------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------+------------------+---------------------+--------------------+------------------+---------------------+--------------------+----------+
4 rows in set (0.01 sec)

表 1. 列名说明

列名 说明
SCHEMA 库名
TABLE 表名
NON_UNIQUE 是否为唯一约束全局二级索引,取值范围如下:
  • 1:普通全局二级索引
  • 0:唯一约束全局二级索引
KEY_NAME 索引名
INDEX_NAMES 索引列
COVERING_NAMES 覆盖列
INDEX_TYPE 索引类型,取值范围如下:
  • NULL(即未指定)
  • BTREE
  • HASH
DB_PARTITION_KEY 分库拆分键
DB_PARTITION_POLICY 分库拆分函数
DB_PARTITION_COUNT 分库数量
TB_PARTITION_KEY 分表拆分键
TB_PARTITION_POLICY 分表拆分函数
TB_PARTITION_COUNT 分表数
STATUS 索引的当前状态,取值范围如下:
  • CREATING
  • DELETE_ONLY
  • WRITE_ONLY
  • WRITE_REORG
  • PUBLIC
  • ABSENT
相关实践学习
快速体验PolarDB开源数据库
本实验环境已内置PostgreSQL数据库以及PolarDB开源数据库:PolarDB PostgreSQL版和PolarDB分布式版,支持一键拉起使用,方便各位开发者学习使用。
相关文章
|
6月前
|
人工智能 编解码 物联网
Stability AI推出新的AI图像生成模型Stable Cascade,对比 SD2.1 的算力成本降低了10倍左右!
Stability AI推出新的AI图像生成模型Stable Cascade,对比 SD2.1 的算力成本降低了10倍左右!
110 2
|
6月前
|
编译器 C语言 C++
【51单片机】LED的三个基本项目(LED点亮&LED闪烁&LED流水灯)(3)
【51单片机】LED的三个基本项目(LED点亮&LED闪烁&LED流水灯)(3)
|
6月前
|
搜索推荐 算法 程序员
第六十一练 字符串匹配 - 精确匹配
第六十一练 字符串匹配 - 精确匹配
35 3
Illegal mix of collations (latin1_swedish_ci,IMPLICIT) and (utf8_general_ci,COERCIBLE) for operation
Illegal mix of collations (latin1_swedish_ci,IMPLICIT) and (utf8_general_ci,COERCIBLE) for operation
75 0
|
索引
开发指南—DAL语句—SHOW—SHOW INDEX
您可以使用SHOW INDEX语句查看PolarDB-X表上的局部索引和全局索引信息。
100 0
|
数据库
开发指南—DAL语句—SHOW—SHOW TABLEGROUP
用于查看当前数据库实例的表组信息,包括每个表组的分区情况,每个表组里都包括哪些表等信息。
开发指南—DAL语句—SHOW—SHOW HELP
本文介绍了如何使用SHOW HELP命令。
129 0
|
数据库 索引
开发指南—DAL语句—SHOW—SHOW GLOBAL INDEX
PolarDB-X支持使用全局二级索引,本文将介绍如何使用SHOW GLOBAL INDEX命令查看已创建或创建中的全局二级索引。
Python正则表达式所有函数详解
Python 中的 re.fullmatch() 函数用于检查输入字符串是否完全匹配给定的正则表达式模式。它接受两个参数:第一个是正则表达式模式,第二个是要与该模式匹配的字符串。如果匹配成功,它会返回一个匹配对象,如果匹配失败,则返回 None。
|
JSON 前端开发 Java
SpringBoot空指针异常及时间格式问题
SpringBoot空指针异常及时间格式问题
154 0