ITPub博客

首页 > 数据库 > > 使用Node Group-多Node Group关联查询

使用Node Group-多Node Group关联查询

作者:GaussDB_数据库 时间:2020-01-14 15:21:50 0 删除 编辑

允许分布在不同Node Group中的表进行关联查询。包括基表扫描操作、关联操作、集合操作、聚集操作和增删改操作。

用户可通过GUC参数对计算Node Group进行调整,具体调整方式请参考expected_computing_nodegroup。

示例

示例一:多Node Group关联使用

  1. 建立Node Group和基表
    create node group ng1 with (dn_6001_6002, dn_6003_6004);
    create node group ng2 with (dn_6005_6006, dn_6007_6008, dn_6009_6010);
    create table t1 (a int, b int, c int, d int) to group ng1;
    create table t2 (a int, b int, c int, d int) to group ng2;
  2. 查看Node Group
    select group_name from PGXC_GROUP;
    增删改操作
  3. insert into t1 select * from t2;
    delete from t1 using t2 where t1.b = t2.c;
    update t1 set b = 1 from t2 where t1.c = t2.c;
  4. 基表扫描操作
    select b from t1 where c=6;
    关联操作
  5. select * from t1, t2 where t1.b = t2.c;
    集合操作
  6. select * from t1 union all select * from t2;
    select * from t1 intersect select * from t2;
  7. 聚集操作
    select b, sum(c) from t1 group by b;
    select t1.b, t2.b, avg(t1.c + t2.c) from t1, t2 where t1.d = t2.d group by t1.b, t2.b;

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/69959250/viewspace-3165211/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2020-01-06

  • 博文量
    2907
  • 访问量
    19256