云数据库 GAUSSDB-子查询调优:更多优化示例

时间:2024-05-09 09:16:57

更多优化示例

示例1:修改基表为replication表,并且在过滤列上创建索引。

1
2
3
create table master_table (a int);
create table sub_table(a int, b int);
select a from master_table group by a having a in (select a from sub_table); 

上述事例中存在一个相关性子查询,为了提升查询的性能,建表时,可以将sub_table修改为一个relication表,并且在字段a上创建一个index。

support.huaweicloud.com/distributed-devg-v3-gaussdb/gaussdb-12-0266.html