统计功能和子对象的大小信息查询Bug
发布日期:2021-08-21 02:35:26 浏览次数:10 分类:技术文章

本文共 4868 字,大约阅读时间需要 16 分钟。

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 tableCONTEXT: 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 kBpublic | 32 kB............public | 96 kBgtlions=# 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-

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

转载地址:https://blog.csdn.net/weixin_33708432/article/details/86320021 如侵犯您的版权,请留言回复原文章的地址,我们会给您删除此文章,给您带来不便请您谅解!

上一篇:Ruby测试小代码[计算50以内的素数]
下一篇:DHT11温湿度传感器

发表评论

最新留言

留言是一种美德,欢迎回访!
[***.207.175.100]2024年04月02日 19时14分11秒

关于作者

    喝酒易醉,品茶养心,人生如梦,品茶悟道,何以解忧?唯有杜康!
-- 愿君每日到此一游!

推荐文章

ADB的安装和使用教程,小米手机连接adb实例演示 2021-06-30
windows 关闭粘滞键-解决Microsoft Remote Desktop输入自动变为快捷键问题 2021-06-30
测试工具 - Postman接口测试入门使用手册,Postman如何进行数据关联、自动更新cookies、简单编程 2021-06-30
PyQt5 技术篇-调用字体对话框(QFontDialog)获取字体,控件设置字体。 2021-06-30
Python 技术篇-将python项目打包成exe独立运行程序,pyinstaller库打包python代码实例演示 2021-06-30
Geany 权限问题:"Error opening file ... : permission denied.",原因及解决办法。 2021-06-30
CSDN博客主页增加赞赏码收钱模块,高端大气上档次! 2021-06-30
PyQt5 技术篇-调用文件对话框获取文件、文件夹路径。文件对话框返回选中的多个文件路径 2021-06-30
SSM 整合实现 增删改查、PageHelper 实现分页 2021-06-30
[增删改查] Lucene 5 索引 CRUD 2021-06-30
使用 SpringBoot 写增删改查接口 2021-06-30
初步使用 JFreeChart 生成报表与感受 2021-06-30
前端使用 BootStrap 写一些后台常用的界面 2021-06-30
使用 SpringBoot + Ckeditor 富文本编辑器、图片上传 2021-06-30
全栈式使用 SpringBoot + SpringSecurity 做登录认证 2021-06-30
[Java爬虫] 使用 Jsoup + HttpClient 爬取网页图片 2021-06-30
使用 Git 并借助 Eclipse + Coding 合作开发项目 2021-06-30
[Java爬虫] 使用 Xpath + HtmlUnit 爬取网页基本信息 2021-06-30
[人工智能] 使用百度 API 读取身份证照片的文字 2021-06-30
在SpringBoot中使用【阿里云OSS对象存储】存取图片 2021-06-30