当前位置:网站首页>金仓数据库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 = ''
边栏推荐
- Drf--- quick start 01
- 2022 Shandong Province safety officer C certificate examination questions and Shandong Province safety officer C certificate simulation examination question bank
- 2022 tea master (intermediate) examination questions and analysis and tea master (intermediate) practical examination video
- How to connect WiFi with raspberry pie
- [mathematical logic] predicate logic (judge whether the first-order predicate logic formula is true or false | explain | example | predicate logic formula type | forever true | forever false | satisfi
- The latest analysis of the main principals of hazardous chemical business units in 2022 and the simulated examination questions of the main principals of hazardous chemical business units
- 拆一辆十万元的比亚迪“元”,快来看看里面的有哪些元器件。
- Basic syntax of class
- Mila, University of Ottawa | molecular geometry pre training with Se (3) invariant denoising distance matching
- The longest subarray length with a positive product of 1567 recorded by leecode
猜你喜欢

2022 tea master (primary) examination questions and tea master (primary) examination question bank

Arduino application development - LCD display GIF dynamic diagram

Competitive product analysis and writing

『期末复习』16/32位微处理器(8086)基本寄存器

Pdf editing tool movavi pdfchef 2022 direct download

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

2022 mobile crane driver examination registration and mobile crane driver operation examination question bank

Supervised pre training! Another exploration of text generation!
![[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

What are the Bluetooth headsets with good sound quality in 2022? Inventory of four high-quality Bluetooth headsets
随机推荐
2022 polymerization process examination questions and polymerization process examination skills
nodejs基础:浅聊url和querystring模块
PostgreSQL database high availability Patroni source code learning - etcd class
sd卡数据损坏怎么回事,sd卡数据损坏怎么恢复
How to process the current cell with a custom formula in conditional format- How to address the current cell in conditional format custom formula?
Five elements of user experience
How to connect WiFi with raspberry pie
mysql字段userid逗号分开保存按userid查询
服务器无法远程连接原因分析
The latest analysis of the main principals of hazardous chemical business units in 2022 and the simulated examination questions of the main principals of hazardous chemical business units
中移物联网OneOS与OneNET入选《2021年物联网示范项目名单》
Social phobia of contemporary young people (II)
JS realizes lazy loading of pictures
2022 tea master (intermediate) examination questions and analysis and tea master (intermediate) practical examination video
Is it better to speculate in the short term or the medium and long term? Comparative analysis of differences
[set theory] set concept and relationship (set family | set family examples | multiple sets)
拆一辆十万元的比亚迪“元”,快来看看里面的有哪些元器件。
Reflection and planning of a sophomore majoring in electronic information engineering
[graduation season · aggressive technology Er] Confessions of workers
[Blue Bridge Road - bug free code] pcf8591 - code analysis of AD conversion