当前位置:网站首页>金仓数据库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 = ''
边栏推荐
- DAPP for getting started with eth
- 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 =
- [Blue Bridge Road - bug free code] pcf8591 - code analysis of AD conversion
- [set theory] inclusion exclusion principle (including examples of exclusion principle)
- 2022 Shandong Province safety officer C certificate examination questions and Shandong Province safety officer C certificate simulation examination question bank
- Arlo's thinking about himself
- [daily question] dichotomy - find a single dog (Bushi)
- In Net 6 project using startup cs
- The latest activation free version of Omni toolbox
- 类的基础语法
猜你喜欢

Mila, University of Ottawa | molecular geometry pre training with Se (3) invariant denoising distance matching

Daily question - ugly number

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

What are the Bluetooth headsets with good sound quality in 2022? Inventory of four high-quality Bluetooth headsets

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

Causal AI, a new paradigm for industrial upgrading of the next generation of credible AI?

因果AI,下一代可信AI的产业升级新范式?

JS实现图片懒加载

Bisher - based on SSM pet adoption center

Dismantle a 100000 yuan BYD "Yuan". Come and see what components are in it.
随机推荐
2022-07-02:以下go语言代码输出什么?A:编译错误;B:Panic;C:NaN。 package main import “fmt“ func main() { var a =
MySQL create table
『期末复习』16/32位微处理器(8086)基本寄存器
JMeter starts from zero (III) -- simple use of regular expressions
Reflection and planning of a sophomore majoring in electronic information engineering
SAP ui5 application development tutorial 105 - detailed introduction to the linkage effect implementation of SAP ui5 master detail layout mode
2022 tea master (primary) examination questions and tea master (primary) examination question bank
2022 tea master (intermediate) examination questions and analysis and tea master (intermediate) practical examination video
基于Pytorch和RDKit的QSAR模型建立脚本
"Final review" 16/32-bit microprocessor (8086) basic register
CVPR 2022 | Dalian Institute of technology proposes a self calibration lighting framework for low light level image enhancement of real scenes
Mutex and rwmutex in golang
300+ documents! This article explains the latest progress of multimodal learning based on transformer
How to process the current cell with a custom formula in conditional format- How to address the current cell in conditional format custom formula?
Arduino application development - LCD display GIF dynamic diagram
[no title] 2022 chlorination process examination content and free chlorination process examination questions
Social phobia of contemporary young people (III)
[brush questions] most elements (super water king problem)
[fairseq] 报错:TypeError: _broadcast_coalesced(): incompatible function arguments
How to connect WiFi with raspberry pie