当前位置:网站首页>金仓数据库KingbaseES 插件kdb_exists_expand
金仓数据库KingbaseES 插件kdb_exists_expand
2022-07-03 04:15:00 【沉舟侧畔千帆过_】
1. 插件介绍
kdb_exists_expand插件用于优化EXISTS子链接,生成执行效率更高的执行计划。
对于在查询条件中存在EXISTS子连接的SQL语句,如果满足:
EXISTS子链接为SELECT类型的查询语句
EXISTS子链接中为OR条件,如:
SELECT * from a WHERE EXISTS (SELECT 1 from e cond1 OR cond2);
其中的cond1的查询条件和子链接中查询的表有关,cond2的查询条件和子链接中查询的表无关,如:
SELECT * from a WHERE EXISTS (SELECT 1 from e WHERE e.id =1 OR a.name = null);
其中cond1 为 e.id =1,与子链接中的表e相关
其中cond2 为 a.name = null,与子链接中的表e不相关
那么该插件将EXISTS子链接的不相关条件做提升优化,可以提高SQL查询的执行效率。
2. 加载插件
在使用 kdb_exists_expand 之前,需要将它添加到 kingbase.conf 文件的 shared_preload_libraries 中,并重启数据库。
shared_preload_libraries = 'kdb_exists_expand' # (change requires restart)
3. 参数配置
kdb_exists_expand.enable
exists子链接优化开关,boolean类型数据,默认为开启状态。
4. 示例
启动该功能后,本来应该是一个Semi join的执行计划,被改成了两个并列的子计划SubPlan 2和SubPlan 3去执行了,而SubPlan3就是提升上来的一个Exists子链接。
# explain (costs false) select p.parameter_value from sheet_parameter p join dep_b001 e on exists ( select 1 from dep_b001 e where e.dep_id in ('b8703c00fb4973aaa1723f95475dfa') and p.parameter_value like e.tree_level_code || '%' or p.parameter_value is null); QUERY PLAN ----------------------------------------------------------------------- Limit -> Result -> Sort Sort Key: b.sheet_no, d.ordinal -> Hash Left Join Hash Cond: (c.sheet_id = p.sheet_id) Filter: ((SubPlan 2) OR (SubPlan 3)) -> Nested Loop Left Join Join Filter: (d.design_id = b.id) -> Nested Loop Join Filter: (d.id = c.sheet_id) -> Seq Scan on sheet d -> Materialize -> Seq Scan on sheet_sheet_category c Filter: (category_id = '\x7a3ca091e24459a4f8c23eb10197f7'::bytea) -> Seq Scan on sheet_design b -> Hash -> Seq Scan on sheet_parameter p SubPlan 2 -> Seq Scan on dep_b001 e Filter: (((dep_id)::text = 'b8703c00fb4973aaa1723f95475dfa'::text) AND ((p.parameter_value)::text ~~ ((tree_level_code)::text || '%'::text))) SubPlan 3 -> Result One-Time Filter: (p.parameter_value IS NULL) -> Seq Scan on dep_b001 e_1 SubPlan 1 -> Aggregate -> Seq Scan on sheet_data a Filter: ((sheet_id = d.id) AND (status = '0'::numeric)) (29 rows)
5. 卸载插件
修改 kingbase.conf 文件中 shared_preload_libraries
参数后重启数据库。
shared_preload_libraries = ''
边栏推荐
- [mathematical logic] predicate logic (first-order predicate logic formula | example)
- DAPP for getting started with eth
- 多板块轮动策略编写技巧----策略编写学习教材
- 用户体验五要素
- 基于Pytorch和RDKit的QSAR模型建立脚本
- Practical operation of vim
- Five elements of user experience
- MySQL field userid comma separated save by userid query
- [Chongqing Guangdong education] reference materials for design and a better life of Zhongyuan Institute of science and technology
- 【刷题篇】接雨水(一维)
猜你喜欢
2022 tea master (intermediate) examination questions and analysis and tea master (intermediate) practical examination video
[brush questions] most elements (super water king problem)
When writing a web project, SmartUpload is used for file upload and new string () is used for transcoding, but in the database, there will still be random codes similar to poker
Interaction free shell programming
2022 tea master (primary) examination questions and tea master (primary) examination question bank
[文献阅读] Sparsity in Deep Learning: Pruning and growth for efficient inference and training in NN
第十届中国云计算大会·中国站:展望未来十年科技走向
【刷题篇】多数元素(超级水王问题)
2022 tea master (intermediate) examination questions and analysis and tea master (intermediate) practical examination video
Data Lake three swordsmen -- comparative analysis of delta, Hudi and iceberg
随机推荐
Deep dive kotlin synergy (19): flow overview
The time has come for the domestic PC system to complete the closed loop and replace the American software and hardware system
Introduction to eth
Bisher - based on SSM pet adoption center
解决bp中文乱码
[Apple Push] IMessage group sending condition document (push certificate) development tool pushnotification
Arduino application development - LCD display GIF dynamic diagram
MongoDB 慢查询语句优化分析策略
DAPP for getting started with eth
js实现在可视区内,文字图片动画效果
[brush questions] find the number pair distance with the smallest K
[Chongqing Guangdong education] reference materials for design and a better life of Zhongyuan Institute of science and technology
[untitled] 2022 safety production supervisor examination question bank and simulated safety production supervisor examination questions
2022deepbrainchain biweekly report no. 104 (01.16-02.15)
Design and implementation of kubelet garbage collection mechanism to protect nodes from being preempted by containers image GC high threshold
MPLS setup experiment
Redraw and reflow
服务器无法远程连接原因分析
sd卡数据损坏怎么回事,sd卡数据损坏怎么恢复
Basic MySQL operations