I hava below two statement sql:

0. not in subquery

select a.schemaname, pg_size_pretty(pg_total_relation_size(a.schemaname||'.'||a.tablename)) from pg_tables a where a.tablename not in (select b.tablename from t b);

1. in subquery

select a.schemaname, pg_size_pretty(pg_total_relation_size(a.schemaname||'.'||a.tablename)) from pg_tables a where a.tablename in (select b.tablename from t b);



The [0. not in subquery] can't work well, it's occur error:

ERROR: query plan with multiple segworker groups is not supported (cdbdisp.c:500)

HINT: likely caused by a function that reads or modifies data in a distributed table

CONTEXT: SQL statement "select sum(pg_total_relation_size('information_schema.sql_languages'))::int8 from gp_dist_random('gp_id');"



The [1. in subquery] work well.



Detailed below test:

gtlions=# select version();
version
------------------------------------------------------------------------------------------------------------------------------------------------------
PostgreSQL 8.2.15 (Greenplum Database 4.2.7.3 build 1) on x86_64-unknown-linux-gnu, compiled by GCC gcc (GCC) 4.4.2 compiled on May 7 2014 14:31:08
(1 row) gtlions=# select a.schemaname, pg_size_pretty(pg_total_relation_size(a.schemaname||'.'||a.tablename)) from pg_tables a where a.tablename not in (select b.tablename from t b);
ERROR: query plan with multiple segworker groups is not supported (cdbdisp.c:500)
HINT: likely caused by a function that reads or modifies data in a distributed table
CONTEXT: SQL statement "select sum(pg_total_relation_size('information_schema.sql_languages'))::int8 from gp_dist_random('gp_id');"
gtlions=# explain select a.schemaname, pg_size_pretty(pg_total_relation_size(a.schemaname||'.'||a.tablename)) from pg_tables a where a.tablename not in (select b.tablename from t b);
QUERY PLAN
-----------------------------------------------------------------------------------------------
Hash Left Anti Semi Join (cost=568.98..235912.69 rows=676396 width=128)
Hash Cond: c.relname = "NotIn_SUBQUERY".tablename::name
-> Hash Left Join (cost=395.97..223194.68 rows=676419 width=128)
Hash Cond: c.relnamespace = n.oid
-> Hash Left Join (cost=2.62..112777.67 rows=676419 width=68)
Hash Cond: c.reltablespace = t.oid
-> Seq Scan on pg_class c (cost=0.00..2751.39 rows=676419 width=72)
Filter: relkind = 'r'::"char" AND relname IS NOT NULL
-> Hash (cost=1.02..1.02 rows=2 width=4)
-> Seq Scan on pg_tablespace t (cost=0.00..1.02 rows=128 width=4)
-> Hash (cost=365.35..365.35 rows=35 width=68)
-> Seq Scan on pg_namespace n (cost=0.00..365.35 rows=2240 width=68)
-> Hash (cost=106.61..106.61 rows=83 width=274)
-> Gather Motion 64:1 (slice1; segments: 64) (cost=0.00..106.61 rows=83 width=274)
-> Subquery Scan "NotIn_SUBQUERY" (cost=0.00..52.66 rows=2 width=274)
-> Seq Scan on t b (cost=0.00..51.83 rows=2 width=24)
(16 rows) gtlions=# select a.schemaname, pg_size_pretty(pg_total_relation_size(a.schemaname||'.'||a.tablename)) from pg_tables a where a.tablename in (select b.tablename from t b);
schemaname | size-1
-------------+---------
public | 32 kB
public | 32 kB
......
......
public | 96 kB
gtlions=# explain select a.schemaname, pg_size_pretty(pg_total_relation_size(a.schemaname||'.'||a.tablename)) from pg_tables a where a.tablename in (select b.tablename from t b);
QUERY PLAN
---------------------------------------------------------------------------------------------------------------------------------
Gather Motion 64:1 (slice7; segments: 64) (cost=445.41..10096.03 rows=1 width=128)
-> Hash Left Join (cost=445.41..10096.03 rows=1 width=128)
Hash Cond: c.reltablespace = t.oid
-> Redistribute Motion 64:64 (slice5; segments: 64) (cost=443.06..10092.81 rows=1 width=132)
Hash Key: c.reltablespace
-> Hash Left Join (cost=443.06..10092.22 rows=1 width=132)
Hash Cond: c.relnamespace = n.oid
-> Redistribute Motion 64:64 (slice3; segments: 64) (cost=54.53..9703.24 rows=1 width=72)
Hash Key: c.relnamespace
-> Hash EXISTS Join (cost=54.53..9702.65 rows=1 width=72)
Hash Cond: c.relname = b.tablename::name
-> Redistribute Motion 1:64 (slice1) (cost=0.00..9621.26 rows=10570 width=72)
Hash Key: c.relname
-> Seq Scan on pg_class c (cost=0.00..2751.39 rows=676419 width=72)
Filter: relkind = 'r'::"char"
-> Hash (cost=53.49..53.49 rows=2 width=24)
-> Redistribute Motion 64:64 (slice2; segments: 64) (cost=0.00..53.49 rows=2 width=24)
Hash Key: b.tablename::name
-> Seq Scan on t b (cost=0.00..51.83 rows=2 width=24)
-> Hash (cost=388.10..388.10 rows=1 width=68)
-> Redistribute Motion 1:64 (slice4) (cost=0.00..388.10 rows=35 width=68)
Hash Key: n.oid
-> Seq Scan on pg_namespace n (cost=0.00..365.35 rows=2240 width=68)
-> Hash (cost=2.32..2.32 rows=1 width=4)
-> Redistribute Motion 1:64 (slice6) (cost=0.00..2.32 rows=2 width=4)
Hash Key: t.oid
-> Seq Scan on pg_tablespace t (cost=0.00..1.02 rows=128 width=4)
(27 rows)

该问题应该是个Bug,等一下TSE鉴于Fix或不Fix而只是等待,直到下一个版本升级.

-EOF-

版权声明:本文博主原创文章,博客,未经同意不得转载。

统计功能和子对象的大小信息查询Bug的更多相关文章

  1. Nginx 的 RTMP 模块的在线统计功能 stat 在 multi-worker 模式下存在 Bug

    < 让你的 Nginx 的 RTMP 直播具有统计某频道在线观看用户数量的功能>一文介绍了 Nginx 的在线统计模块.         我们的在线直播服务使用了 Nginx 的 Rtmp ...

  2. mtools 是由MongoDB 官方工程师实现的一套工具集,可以很快速的日志查询分析、统计功能,此外还支持本地集群部署管理.

    mtools 是由MongoDB 官方工程师实现的一套工具集,可以很快速的日志查询分析.统计功能,此外还支持本地集群部署管理 https://www.cnblogs.com/littleatp/p/9 ...

  3. Springboot项目配置druid数据库连接池,并监控统计功能

    pom.xml配置依赖 <!-- https://mvnrepository.com/artifact/com.alibaba/druid --> <dependency> & ...

  4. 部分具有统计功能的TSQL语句(例如DBCC语句,全局函数,系统存储过程)

    部分具有统计功能的TSQL语句(例如DBCC语句,全局函数,系统存储过程) 这些功能也能帮助用户了解和监控SQLSERVER的运行情况 DBCC语句,DBCC语句是SQL2005的数据库控制台命令 D ...

  5. atitit. 统计功能框架的最佳实践(1)---- on hibernate criteria

    atitit. 统计功能框架的最佳实践(1)---- on hibernate criteria 1. 关键字 1 2. 统计功能框架普通有有些条件选项...一个日期选项..一个日期类型(日,周,月份 ...

  6. SQL Server 游标运用:查看数据库所有表大小信息

    一.本文所涉及的内容(Contents) 本文所涉及的内容(Contents) 背景(Contexts) 实现代码(SQL Codes) 方法一:运用游标 方法二:运用系统存储过程 方法三:拼接SQL ...

  7. JSP使用网站访问人数统计功能,方法与技巧

    实现网站访问人数统计功能的步骤: 创建静态登录页面,并指定表单提交由登录处理页面进行处理. 创建登录处理页面获得登录信息,查询数据库,判断该用户是否注册,如果该用户已注册,把已登录用户的信息保存在一个 ...

  8. SQL Server 游标运用:查看一个数据库所有表大小信息(Sizes of All Tables in a Database)

    原文:SQL Server 游标运用:查看一个数据库所有表大小信息(Sizes of All Tables in a Database) 一.本文所涉及的内容(Contents) 本文所涉及的内容(C ...

  9. 如何Windows分页控件中增加统计功能

    在我的博客里面,很多Winform程序里面都用到了分页处理,这样可以不管是在直接访问数据库的场景还是使用网络方式访问WCF服务获取数据,都能获得较好的效率,因此WInform程序里面的分页控件的使用是 ...

随机推荐

  1. iOS - Responder Chain

     在iOS中,当发生事件响应时,必须知道由谁来响应事件.这就是由响应者链来对事件进行响应,所有事件响应的类都是UIResponder的子类,响应者链是一个由不同对象组成的层次结构,其中的每个对象将依次 ...

  2. 深入探究JavaScript中的比较问题

    先用最近遇到的几个问题做引子: 1 console.log(null==undefined); //true 2 console.log(null==false);//false 3 console. ...

  3. Python读写Redis数据库

    import redis class Database: def __init__(self): self.host = 'localhost' self.port = 6379 def write( ...

  4. [转贴]JAVA:RESTLET开发实例(三)基于spring的REST服务

    前面两篇文章,我们介绍了基于JAX-RS的REST服务以及Application的Rest服务.这里将介绍restlet如何整合spring框架进行开发.Spring 是一个开源框架,是为了解决企业应 ...

  5. jdk jre jvm 关系

    很多朋友可能跟我一样,已经使用JAVA开发很久了,可是对JDK,JRE,JVM这三者的联系与区别,一直都是模模糊糊的. 今天特写此文,来整理下三者的关系. JDK : Java Development ...

  6. 【HDOJ】1166 敌兵布阵

    线段树. #include <stdio.h> #define maxn 55555 ]; void PushUP(int rt) { sums[rt] = sums[rt<< ...

  7. bzoj3524 bzoj2223

    bzoj3524这是我主席树的第一题 什么是主席树呢,就是n棵线段树,每棵线段树记录前缀每个数值(显然想到里离散化)出现次数 由于第i棵树相对于第i-1棵树只有logS个点不同(S为数值的种类数) 所 ...

  8. bzoj1263

    观察可得,最大的拆分方法是尽量拆成3,特殊的,如果最后剩下了1,那么就把3+1变成2+2 然后高精度计算即可 var s2,s3,i,n,l:longint;     a:..] of longint ...

  9. sql server 2008中id如何设为自增

    通过 IDENTITY 来设置 参数有2个,一个是“初始值” 一个是“增量”.默认情况下 INSERT 语句中,不能对 IDENTITY 的字段进行赋值. create table web_produ ...

  10. 【转】Xcode7.1环境下上架iOS App到AppStore 流程 -- 不错!!

    原文网址:http://www.jianshu.com/p/a8bd16be122f 1.官网地址 Apple Developer 地址:https://developer.apple.com/mem ...