当前位置:网站首页>Kunlundb query optimization (III) sort push down

Kunlundb query optimization (III) sort push down

2022-06-22 23:49:00 Kunlunbase Kunlun database

Preface

front 2 In this article, we introduce KunlunDB Query optimization principle and Project and Filter Push down Demo (KunlunDB Query optimization ( One ),KunlunDB Query optimization ( Two )Project and Filter Push down ), This section describes sorting and query optimization .

One 、order by Push down

One contains order Of SQL The execution plan of is generated in the following process ,Sort Pushed down to RemoteScan Inside the operator .

Sort The push down operation is asynchronous , Instructions are executed in parallel at each data node , After filtering the data , Feed back the sorted results to the calculation node , Reduce the load of computing nodes .

Let's test and view the execution plan pushed down by query

Push down to support sorting , Need to be in kunlunDB Set the following parameters as true:

set enable_remote_orderby_pushdown=true;

  

Test statement :

select c_zip from customer1 order byc_zip;

View execution plan : 

explain select c_zip fromcustomer1 order by c_zip;

According to the above implementation plan ,RemoteScan After communicating the remote sort operation to each relevant storage node , The storage node feeds back the result to the computing node and then does the operation Merge Append.

If the sort push down feature is turned off , The implementation plan will change , The sorting operation will be performed at the calculation node .

The demonstration is as follows :

set enable_remote_orderby_pushdown=false;

The sorting operation will be performed at the calculation node :

Statement execution : Statement after the calculation node is rewritten , Send it to 2 Multiple data nodes execute , Pull the qualified value from the calculation node to sort the calculation node , Feedback to the client after sorting .

Two 、 Performance comparison

Performance comparison environment :

Copy the link below to log in kunlunDB Online experience system :

zettatech.tpddns.cn:8000/ci/index.php/Main/PGList

stay SQL Enter the statement of sorting operation in the box , Press the execute key to execute .

The left window is KunlunDB Implementation information of community version ( The community version does not support sorting and pushing down ), The window on the right is KunlunDB The enterprise version has the execution information of push down operation .

The comparison shows that ,order by Push down and back , Execution efficiency has improved ( The execution time is 4 Milliseconds down to 3 millisecond )

The project is open source

【GitHub:】
https://github.com/zettadb

【Gitee:】
https://gitee.com/zettadb

END

原网站

版权声明
本文为[Kunlunbase Kunlun database]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/173/202206222122589826.html