当前位置:网站首页>金仓数据库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 = ''
边栏推荐
- Dismantle a 100000 yuan BYD "Yuan". Come and see what components are in it.
- CVPR 2022 | 大连理工提出自校准照明框架,用于现实场景的微光图像增强
- Classes in TS
- 『期末复习』16/32位微处理器(8086)基本寄存器
- 2022deepbrainchain biweekly report no. 104 (01.16-02.15)
- Nodejs Foundation: shallow chat URL and querystring module
- 【刷题篇】接雨水(一维)
- Nat. Comm. | 使用Tensor-cell2cell对细胞通讯进行环境感知去卷积
- Which Bluetooth headset is cost-effective? Four Bluetooth headsets with high cost performance are recommended
- js/ts底层实现双击事件
猜你喜欢

JS realizes the animation effect of text and pictures in the visual area

Application of I2C protocol of STM32F103 (read and write EEPROM)

Mila、渥太华大学 | 用SE(3)不变去噪距离匹配进行分子几何预训练

JMeter starts from zero (III) -- simple use of regular expressions

2022 tea master (intermediate) examination questions and analysis and tea master (intermediate) practical examination video

Database management tool, querious direct download

CVPR 2022 | Dalian Institute of technology proposes a self calibration lighting framework for low light level image enhancement of real scenes

The 10th China Cloud Computing Conference · China Station: looking forward to the trend of science and technology in the next decade

2022deepbrainchain biweekly report no. 104 (01.16-02.15)

Mila, University of Ottawa | molecular geometry pre training with Se (3) invariant denoising distance matching
随机推荐
[fairseq] error: typeerror:_ broadcast_ coalesced(): incompatible function arguments
多板块轮动策略编写技巧----策略编写学习教材
2022 polymerization process examination questions and polymerization process examination skills
Deep dive kotlin synergy (19): flow overview
Two points -leetcode-540 A single element in an ordered array
Basic types of data in TS
sklearn数据预处理
js实现在可视区内,文字图片动画效果
Introduction to eth
Which Bluetooth headset is good about 400? Four Bluetooth headsets with strong noise reduction are recommended
Causal AI, a new paradigm for industrial upgrading of the next generation of credible AI?
毕设-基于SSM宠物领养中心
树莓派如何连接WiFi
Interface embedded in golang struct
ZIP文件的导出
[文献阅读] Sparsity in Deep Learning: Pruning and growth for efficient inference and training in NN
Sklearn data preprocessing
Mutex and rwmutex in golang
因果AI,下一代可信AI的产业升级新范式?
Reflection and planning of a sophomore majoring in electronic information engineering