名 | Index Method | Table Name | 约束 | 字段 | 唯一键 | 并发 |
idx_alarm_originator_alarm_type | B-Tree | alarm | originator_id "pg_catalog"."uuid_ops" ASC NULLS LAST, type COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST, start_ts "pg_catalog"."int8_ops" DESC NULLS FIRST | FALSE | FALSE | |
idx_alarm_originator_alarm_type_active | B-Tree | alarm | cleared = false | originator_id "pg_catalog"."uuid_ops" ASC NULLS LAST, type COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST | FALSE | FALSE |
idx_alarm_originator_created_time | B-Tree | alarm | originator_id "pg_catalog"."uuid_ops" ASC NULLS LAST, created_time "pg_catalog"."int8_ops" DESC NULLS FIRST | FALSE | FALSE | |
idx_alarm_tenant_alarm_type_active | B-Tree | alarm | cleared = false | tenant_id "pg_catalog"."uuid_ops" ASC NULLS LAST, type COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST | FALSE | FALSE |
idx_alarm_tenant_alarm_type_created_time | B-Tree | alarm | tenant_id "pg_catalog"."uuid_ops" ASC NULLS LAST, type COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST, created_time "pg_catalog"."int8_ops" DESC NULLS FIRST | FALSE | FALSE | |
idx_alarm_tenant_assignee_created_time | B-Tree | alarm | tenant_id "pg_catalog"."uuid_ops" ASC NULLS LAST, assignee_id "pg_catalog"."uuid_ops" ASC NULLS LAST, created_time "pg_catalog"."int8_ops" DESC NULLS FIRST | FALSE | FALSE | |
idx_alarm_tenant_created_time | B-Tree | alarm | tenant_id "pg_catalog"."uuid_ops" ASC NULLS LAST, created_time "pg_catalog"."int8_ops" DESC NULLS FIRST | FALSE | FALSE |
分析【idx_alarm_originator_alarm_type】个索引(Index)的详细描述,主要包括以下各个部分:
- Name: 索引的名称为
idx_alarm_originator_alarm_type
。 - Index Method: 索引的类型为 B-Tree 索引,即基于二叉树结构的索引。
- Table Name: 索引所属的表名为
alarm
。 - 约束(Constraints): 在这里并未提及具体的约束。
- 字段(Columns): 索引包含了三个字段,分别是
originator_id
、type
和start_ts
。每个字段后面用引号包裹的部分表示该字段的排序规则和操作符类别。originator_id
使用了uuid_ops
排序规则,按照升序(ASC)排列,NULL 值在最后(NULLS LAST)。type
使用了text_ops
排序规则,按照升序(ASC)排列,NULL 值在最后(NULLS LAST)。start_ts
使用了int8_ops
排序规则,按照降序(DESC)排列,NULL 值在最前(NULLS FIRST)。
- 聚集(Clustered): 未指定是否为聚集索引。
- 唯一键(Unique): 该索引不是唯一索引,即允许重复值。
- 并发(Concurrent): 未指定是否支持并发操作。
索引分析情况:
-
idx_alarm_originator_alarm_type:
- Index Method: B-Tree
- Table Name: alarm
- 约束: 无
- 字段: originator_id(UUID,ASC,NULLS LAST), type(Text,ASC,NULLS LAST), start_ts(BigInt,DESC,NULLS FIRST)
- 唯一键: 否
- 并发: 否
-
idx_alarm_originator_alarm_type_active:
- Index Method: B-Tree
- Table Name: alarm
- 约束: cleared = false
- 字段: originator_id(UUID,ASC,NULLS LAST), type(Text,ASC,NULLS LAST)
- 唯一键: 否
- 并发: 否
-
idx_alarm_originator_created_time:
- Index Method: B-Tree
- Table Name: alarm
- 约束: 无
- 字段: originator_id(UUID,ASC,NULLS LAST), created_time(BigInt,DESC,NULLS FIRST)
- 唯一键: 否
- 并发: 否
-
idx_alarm_tenant_alarm_type_active:
- Index Method: B-Tree
- Table Name: alarm
- 约束: cleared = false
- 字段: tenant_id(UUID,ASC,NULLS LAST), type(Text,ASC,NULLS LAST)
- 唯一键: 否
- 并发: 否
-
idx_alarm_tenant_alarm_type_created_time:
- Index Method: B-Tree
- Table Name: alarm
- 约束: 无
- 字段: tenant_id(UUID,ASC,NULLS LAST), type(Text,ASC,NULLS LAST), created_time(BigInt,DESC,NULLS FIRST)
- 唯一键: 否
- 并发: 否
-
idx_alarm_tenant_assignee_created_time:
- Index Method: B-Tree
- Table Name: alarm
- 约束: 无
- 字段: tenant_id(UUID,ASC,NULLS LAST), assignee_id(UUID,ASC,NULLS LAST), created_time(BigInt,DESC,NULLS FIRST)
- 唯一键: 否
- 并发: 否
-
idx_alarm_tenant_created_time:
- Index Method: B-Tree
- Table Name: alarm
- 约束: 无
- 字段: tenant_id(UUID,ASC,NULLS LAST), created_time(BigInt,DESC,NULLS FIRST)
- 唯一键: 否
- 并发: 否
参考文章:
15个必知的Mysql索引失效场景,别再踩坑了https://heapdump.cn/article/3965201
mysql 联合索引生效的条件、索引失效的条件https://blog.csdn.net/qq_35275233/article/details/87888809