当前位置:网站首页>金仓数据库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 = ''
边栏推荐
- xrandr修改分辨率與刷新率
- vulnhub HA: Natraj
- 用户体验五要素
- 2022deepbrainchain biweekly report no. 104 (01.16-02.15)
- JS实现图片懒加载
- Which code editor is easy to use? Code editing software recommendation
- Daily question - ugly number
- 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
- 300+ documents! This article explains the latest progress of multimodal learning based on transformer
- 2022 tea master (intermediate) examination questions and analysis and tea master (intermediate) practical examination video
猜你喜欢

"Final review" 16/32-bit microprocessor (8086) basic register

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

第十届中国云计算大会·中国站:展望未来十年科技走向

解决bp中文乱码

540. Single element in ordered array
![[brush questions] find the number pair distance with the smallest K](/img/e1/4118e2b37b5cea0454d65b877b507f.png)
[brush questions] find the number pair distance with the smallest K

用户体验五要素

Redis persistence principle

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

Nat. Comm. | use tensor cell2cell to deconvolute cell communication with environmental awareness
随机推荐
Which code editor is easy to use? Code editing software recommendation
Mutex and rwmutex in golang
MySQL timestampdiff interval
服务器无法远程连接原因分析
Idea shortcut keys
Dismantle a 100000 yuan BYD "Yuan". Come and see what components are in it.
How to connect WiFi with raspberry pie
[Apple Push] IMessage group sending condition document (push certificate) development tool pushnotification
MySQL create table
Esp32 series (3): GPIO learning (take simple GPIO input and output, ADC, DAC as examples)
【毕业季·进击的技术er】职场人的自白
2022-07-02: what is the output of the following go language code? A: Compilation error; B:Panic; C:NaN。 package main import “fmt“ func main() { var a =
Appium自动化测试框架
Redraw and reflow
CVPR 2022 | 大连理工提出自校准照明框架,用于现实场景的微光图像增强
Interface in TS
GFS分布式文件系统(光是遇见已经很美好了)
用户体验五要素
Square root of X
China Mobile Internet of things oneos and onenet were selected in the list of 2021 Internet of things demonstration projects