forked from docs/doc-exports
Reviewed-by: Pruthi, Vineet <vineet.pruthi@t-systems.com> Co-authored-by: luhuayi <luhuayi@huawei.com> Co-committed-by: luhuayi <luhuayi@huawei.com>
332 lines
37 KiB
HTML
332 lines
37 KiB
HTML
<a name="EN-US_TOPIC_0000002088734277"></a><a name="EN-US_TOPIC_0000002088734277"></a>
|
|
|
|
<h1 class="topictitle1">Execution Plan Operator</h1>
|
|
<div id="body8662426"><div class="section" id="EN-US_TOPIC_0000002088734277__en-us_topic_0000002043470758_section27465253810"><h4 class="sectiontitle">Operator Introduction</h4><p id="EN-US_TOPIC_0000002088734277__en-us_topic_0000002043470758_en-us_topic_0000001610880741_en-us_topic_0000001188482136_en-us_topic_0000001233563189_a1e0fa245530744908b4411c762439d3b">In an SQL execution plan, each step indicates a database operator, also called an execution operator. In GaussDB(DWS), operators are the building blocks of data processing. By combining them effectively and optimizing their sequence and execution, you can significantly improve data processing efficiency.</p>
|
|
<p id="EN-US_TOPIC_0000002088734277__en-us_topic_0000002043470758_p2068910234453">GaussDB(DWS) operators are classified into scan operators, control operators, materialization operators, join operators, and other operators.</p>
|
|
</div>
|
|
<div class="section" id="EN-US_TOPIC_0000002088734277__en-us_topic_0000002043470758_section1468016131011"><h4 class="sectiontitle">Scan Operators</h4><p id="EN-US_TOPIC_0000002088734277__en-us_topic_0000002043470758_p129594113308">A scan operator scans data in a table, processing one tuple at a time for the upper-layer node. It operates at the leaf node of the query plan tree and can scan tables, result sets, linked lists, and subquery results. The following table lists common scan operators.</p>
|
|
|
|
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="EN-US_TOPIC_0000002088734277__en-us_topic_0000002043470758_table20126105915451" frame="border" border="1" rules="all"><caption><b>Table 1 </b>Scan operators</caption><thead align="left"><tr id="EN-US_TOPIC_0000002088734277__en-us_topic_0000002043470758_row1212785910454"><th align="left" class="cellrowborder" valign="top" width="20%" id="mcps1.3.2.3.2.4.1.1"><p id="EN-US_TOPIC_0000002088734277__en-us_topic_0000002043470758_p7127159194515">Operator</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="20%" id="mcps1.3.2.3.2.4.1.2"><p id="EN-US_TOPIC_0000002088734277__en-us_topic_0000002043470758_p512745944512">Description</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="60%" id="mcps1.3.2.3.2.4.1.3"><p id="EN-US_TOPIC_0000002088734277__en-us_topic_0000002043470758_p1312755944516">Scenario</p>
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody><tr id="EN-US_TOPIC_0000002088734277__en-us_topic_0000002043470758_row15128205974519"><td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.2.3.2.4.1.1 "><p id="EN-US_TOPIC_0000002088734277__en-us_topic_0000002043470758_p12992822174717">SeqScan</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.2.3.2.4.1.2 "><p id="EN-US_TOPIC_0000002088734277__en-us_topic_0000002043470758_p1599272214714">Sequential scanning</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="60%" headers="mcps1.3.2.3.2.4.1.3 "><p id="EN-US_TOPIC_0000002088734277__en-us_topic_0000002043470758_p1399212244712">It is a basic operator used to scan physical tables in sequence, not an index-assisted scan.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0000002088734277__en-us_topic_0000002043470758_row1612818595454"><td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.2.3.2.4.1.1 "><p id="EN-US_TOPIC_0000002088734277__en-us_topic_0000002043470758_p999218227476">IndexScan</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.2.3.2.4.1.2 "><p id="EN-US_TOPIC_0000002088734277__en-us_topic_0000002043470758_p1099282213475">Index scanning</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="60%" headers="mcps1.3.2.3.2.4.1.3 "><p id="EN-US_TOPIC_0000002088734277__en-us_topic_0000002043470758_p3992182213474">Indexes are created for the attributes involved in selection conditions.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0000002088734277__en-us_topic_0000002043470758_row41291259124514"><td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.2.3.2.4.1.1 "><p id="EN-US_TOPIC_0000002088734277__en-us_topic_0000002043470758_p1992522164717">IndexOnlyScan</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.2.3.2.4.1.2 "><p id="EN-US_TOPIC_0000002088734277__en-us_topic_0000002043470758_p0992122114716">Obtaining a tuple from an index</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="60%" headers="mcps1.3.2.3.2.4.1.3 "><p id="EN-US_TOPIC_0000002088734277__en-us_topic_0000002043470758_p17993172264711">The index column completely overwrites the result set column.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0000002088734277__en-us_topic_0000002043470758_row16129105912454"><td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.2.3.2.4.1.1 "><p id="EN-US_TOPIC_0000002088734277__en-us_topic_0000002043470758_p1993172234713">BitmapScan(BitmapIndexScan, BitmapHeapScan)</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.2.3.2.4.1.2 "><p id="EN-US_TOPIC_0000002088734277__en-us_topic_0000002043470758_p13993172217473">Obtaining a tuple using a bitmap</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="60%" headers="mcps1.3.2.3.2.4.1.3 "><p id="EN-US_TOPIC_0000002088734277__en-us_topic_0000002043470758_p18993102212473">BitmapIndexScan uses indexes for attributes to scan data and returns a bitmap. BitmapHeapScan then uses this bitmap to retrieve tuples.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0000002088734277__en-us_topic_0000002043470758_row10130175904513"><td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.2.3.2.4.1.1 "><p id="EN-US_TOPIC_0000002088734277__en-us_topic_0000002043470758_p89931022184713">TidScan</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.2.3.2.4.1.2 "><p id="EN-US_TOPIC_0000002088734277__en-us_topic_0000002043470758_p899311227471">Obtaining a tuple by tuple tid</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="60%" headers="mcps1.3.2.3.2.4.1.3 "><ol id="EN-US_TOPIC_0000002088734277__en-us_topic_0000002043470758_ol1028124533519"><li id="EN-US_TOPIC_0000002088734277__en-us_topic_0000002043470758_li1728124503519">WHERE conditions(like CTID = tid or CTID IN (tid1, tid2, ...)) ;</li><li id="EN-US_TOPIC_0000002088734277__en-us_topic_0000002043470758_li172811145103518">UPDATE/DELETE ... WHERE CURRENT OF cursor;</li></ol>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0000002088734277__en-us_topic_0000002043470758_row159801993461"><td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.2.3.2.4.1.1 "><p id="EN-US_TOPIC_0000002088734277__en-us_topic_0000002043470758_p09935228473">SubqueryScan</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.2.3.2.4.1.2 "><p id="EN-US_TOPIC_0000002088734277__en-us_topic_0000002043470758_p59943226474">Subquery scanning</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="60%" headers="mcps1.3.2.3.2.4.1.3 "><p id="EN-US_TOPIC_0000002088734277__en-us_topic_0000002043470758_p4994182294717">Another query plan tree (subplan) is used as the scanning object to scan tuples.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0000002088734277__en-us_topic_0000002043470758_row6981159154620"><td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.2.3.2.4.1.1 "><p id="EN-US_TOPIC_0000002088734277__en-us_topic_0000002043470758_p13994182211477">FunctionScan</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.2.3.2.4.1.2 "><p id="EN-US_TOPIC_0000002088734277__en-us_topic_0000002043470758_p9994022114719">Function scanning</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="60%" headers="mcps1.3.2.3.2.4.1.3 "><p id="EN-US_TOPIC_0000002088734277__en-us_topic_0000002043470758_p0994122184711">FROM function_name</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0000002088734277__en-us_topic_0000002043470758_row2982295468"><td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.2.3.2.4.1.1 "><p id="EN-US_TOPIC_0000002088734277__en-us_topic_0000002043470758_p39941229474">ValuesScan</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.2.3.2.4.1.2 "><p id="EN-US_TOPIC_0000002088734277__en-us_topic_0000002043470758_p10994022154715">Values linked list scanning</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="60%" headers="mcps1.3.2.3.2.4.1.3 "><p id="EN-US_TOPIC_0000002088734277__en-us_topic_0000002043470758_p3994422174717">It scans the given tuple set in VALUES clauses.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0000002088734277__en-us_topic_0000002043470758_row1098218954618"><td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.2.3.2.4.1.1 "><p id="EN-US_TOPIC_0000002088734277__en-us_topic_0000002043470758_p699420227471">ForeignScan</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.2.3.2.4.1.2 "><p id="EN-US_TOPIC_0000002088734277__en-us_topic_0000002043470758_p189941922184711">External table scanning</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="60%" headers="mcps1.3.2.3.2.4.1.3 "><p id="EN-US_TOPIC_0000002088734277__en-us_topic_0000002043470758_p899413226475">It queries external tables.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0000002088734277__en-us_topic_0000002043470758_row1098314914466"><td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.2.3.2.4.1.1 "><p id="EN-US_TOPIC_0000002088734277__en-us_topic_0000002043470758_p19945227473">CteScan</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.2.3.2.4.1.2 "><p id="EN-US_TOPIC_0000002088734277__en-us_topic_0000002043470758_p16995112274719">CTE table scanning</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="60%" headers="mcps1.3.2.3.2.4.1.3 "><p id="EN-US_TOPIC_0000002088734277__en-us_topic_0000002043470758_p8995142244720">It scans the subquery defined by the WITH clause in the SELECT query.</p>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
<div class="section" id="EN-US_TOPIC_0000002088734277__en-us_topic_0000002043470758_section64611516104"><h4 class="sectiontitle">Join Operators</h4><div class="p" id="EN-US_TOPIC_0000002088734277__en-us_topic_0000002043470758_p10682191781219">In relational algebra, a join operation is equivalent to a join operator. Take a simple example: joining two tables, t1 and t2. There are several types of joins, including inner join, left join, right join, full join, semi join, and anti join. These joins can be implemented using three methods: Nestloop, HashJoin, and MergeJoin.
|
|
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="EN-US_TOPIC_0000002088734277__en-us_topic_0000002043470758_table713913186414" frame="border" border="1" rules="all"><caption><b>Table 2 </b>Join operators</caption><thead align="left"><tr id="EN-US_TOPIC_0000002088734277__en-us_topic_0000002043470758_row1613981818412"><th align="left" class="cellrowborder" valign="top" width="15%" id="mcps1.3.3.2.1.2.5.1.1"><p id="EN-US_TOPIC_0000002088734277__en-us_topic_0000002043470758_p31398181842">Operator</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="20%" id="mcps1.3.3.2.1.2.5.1.2"><p id="EN-US_TOPIC_0000002088734277__en-us_topic_0000002043470758_p813913183418">Description</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="20%" id="mcps1.3.3.2.1.2.5.1.3"><p id="EN-US_TOPIC_0000002088734277__en-us_topic_0000002043470758_p191391018945">Scenario</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="45%" id="mcps1.3.3.2.1.2.5.1.4"><p id="EN-US_TOPIC_0000002088734277__en-us_topic_0000002043470758_p14795504108">Implementation Feature</p>
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody><tr id="EN-US_TOPIC_0000002088734277__en-us_topic_0000002043470758_row17140718948"><td class="cellrowborder" valign="top" width="15%" headers="mcps1.3.3.2.1.2.5.1.1 "><p id="EN-US_TOPIC_0000002088734277__en-us_topic_0000002043470758_p16941920778">NestLoop</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.3.2.1.2.5.1.2 "><p id="EN-US_TOPIC_0000002088734277__en-us_topic_0000002043470758_p136944209718">Nested loop join, which is a brute force approach. It scans the inner table for each row.</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.3.2.1.2.5.1.3 "><p id="EN-US_TOPIC_0000002088734277__en-us_topic_0000002043470758_p369422017710">Inner Join, Left Outer Join, Semi Join, Anti Join</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="45%" headers="mcps1.3.3.2.1.2.5.1.4 "><p id="EN-US_TOPIC_0000002088734277__en-us_topic_0000002043470758_p17639122011014">It is used for queries that have a smaller subset connected. In a nested loop, the foreign table drives the internal table. Each row returned by the foreign table is retrieved from the internal table to find the matched row. Therefore, the result set returned by the entire query cannot be greater than 10,000. The table with a smaller subset returned is used as the foreign table. It is recommended that indexes be created for the join fields in the internal table.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0000002088734277__en-us_topic_0000002043470758_row11406180413"><td class="cellrowborder" valign="top" width="15%" headers="mcps1.3.3.2.1.2.5.1.1 "><p id="EN-US_TOPIC_0000002088734277__en-us_topic_0000002043470758_p16694520073">MergeJoin</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.3.2.1.2.5.1.2 "><p id="EN-US_TOPIC_0000002088734277__en-us_topic_0000002043470758_p206941020473">A merge join on ordered input sorts both the inner and outer tables, identifies the first and last matching rows, and then joins tuples at a time. Equi-join.</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.3.2.1.2.5.1.3 "><p id="EN-US_TOPIC_0000002088734277__en-us_topic_0000002043470758_p26951820179">Inner Join, Left Outer Join, Right Outer Join, Full Outer Join, Semi Join, Anti Join</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="45%" headers="mcps1.3.3.2.1.2.5.1.4 "><p id="EN-US_TOPIC_0000002088734277__en-us_topic_0000002043470758_p863922018105">In a merge join, data in the two joined tables is sorted by join columns. Then, data is extracted from the two tables to a sorted table for matching.</p>
|
|
<p id="EN-US_TOPIC_0000002088734277__en-us_topic_0000002043470758_p13639920161017">A merge join requires more resources for sorting and its performance is lower than that of a hash join. However, if the source data has been pre-sorted and no more sorting is needed during the merge join, its performance excels.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0000002088734277__en-us_topic_0000002043470758_row014020181143"><td class="cellrowborder" valign="top" width="15%" headers="mcps1.3.3.2.1.2.5.1.1 "><p id="EN-US_TOPIC_0000002088734277__en-us_topic_0000002043470758_p126951202713">(Sonic) Hash Join</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.3.2.1.2.5.1.2 "><p id="EN-US_TOPIC_0000002088734277__en-us_topic_0000002043470758_p66958201711">Hash join: The inner and outer tables use the join column's hash value to create a hash table. Matching values are then stored in the same bucket. The two ends of an equal join must be of the same type and support hash.</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.3.2.1.2.5.1.3 "><p id="EN-US_TOPIC_0000002088734277__en-us_topic_0000002043470758_p196954206712">Inner Join, Left Outer Join, Right Outer Join, Full Outer Join, Semi Join, Anti Join</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="45%" headers="mcps1.3.3.2.1.2.5.1.4 "><p id="EN-US_TOPIC_0000002088734277__en-us_topic_0000002043470758_p12639112011107">A hash Join is used for large tables. The optimizer creates a hash table in memory using the join key and the smaller table. It then scans the larger table and uses the hash table to quickly identify matching rows. While Sonic and non-Sonic hash joins have different internal structures, this does not impact the final result set.</p>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="section" id="EN-US_TOPIC_0000002088734277__en-us_topic_0000002043470758_section1224814016114"><h4 class="sectiontitle">Materialization Operators</h4><div class="p" id="EN-US_TOPIC_0000002088734277__en-us_topic_0000002043470758_p136420315122">Materialization operators are a class of nodes that can cache tuples. During execution, many extended physical operations can be performed only after all tuples are obtained, such as aggregation function operations and sorting without indexes. Materialization operators can cache all the tuples.
|
|
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="EN-US_TOPIC_0000002088734277__en-us_topic_0000002043470758_table161451536544" frame="border" border="1" rules="all"><caption><b>Table 3 </b>Materialization operators</caption><thead align="left"><tr id="EN-US_TOPIC_0000002088734277__en-us_topic_0000002043470758_row151461936543"><th align="left" class="cellrowborder" valign="top" width="20%" id="mcps1.3.4.2.1.2.4.1.1"><p id="EN-US_TOPIC_0000002088734277__en-us_topic_0000002043470758_p14146123612420">Operator</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="20%" id="mcps1.3.4.2.1.2.4.1.2"><p id="EN-US_TOPIC_0000002088734277__en-us_topic_0000002043470758_p01463363413">Description</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="60%" id="mcps1.3.4.2.1.2.4.1.3"><p id="EN-US_TOPIC_0000002088734277__en-us_topic_0000002043470758_p3147336943">Scenario</p>
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody><tr id="EN-US_TOPIC_0000002088734277__en-us_topic_0000002043470758_row1314720361644"><td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.4.2.1.2.4.1.1 "><p id="EN-US_TOPIC_0000002088734277__en-us_topic_0000002043470758_p2168131715219">Material</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.4.2.1.2.4.1.2 "><p id="EN-US_TOPIC_0000002088734277__en-us_topic_0000002043470758_p4168617112110">Materialization</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="60%" headers="mcps1.3.4.2.1.2.4.1.3 "><p id="EN-US_TOPIC_0000002088734277__en-us_topic_0000002043470758_p11680179212">Caches the subnode result.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0000002088734277__en-us_topic_0000002043470758_row81481736946"><td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.4.2.1.2.4.1.1 "><p id="EN-US_TOPIC_0000002088734277__en-us_topic_0000002043470758_p1916814176216">Sort</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.4.2.1.2.4.1.2 "><p id="EN-US_TOPIC_0000002088734277__en-us_topic_0000002043470758_p11681417142115">Sorting</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="60%" headers="mcps1.3.4.2.1.2.4.1.3 "><p id="EN-US_TOPIC_0000002088734277__en-us_topic_0000002043470758_p1616817172219">ORDER BY clause, which is used for join, group, and set operations and works with Unique.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0000002088734277__en-us_topic_0000002043470758_row614816364415"><td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.4.2.1.2.4.1.1 "><p id="EN-US_TOPIC_0000002088734277__en-us_topic_0000002043470758_p516910171211">Group</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.4.2.1.2.4.1.2 "><p id="EN-US_TOPIC_0000002088734277__en-us_topic_0000002043470758_p2016911172219">Grouping</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="60%" headers="mcps1.3.4.2.1.2.4.1.3 "><p id="EN-US_TOPIC_0000002088734277__en-us_topic_0000002043470758_p15169101762117">GROUP BY clause.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0000002088734277__en-us_topic_0000002043470758_row414910365416"><td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.4.2.1.2.4.1.1 "><p id="EN-US_TOPIC_0000002088734277__en-us_topic_0000002043470758_p4170121702111">Agg</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.4.2.1.2.4.1.2 "><p id="EN-US_TOPIC_0000002088734277__en-us_topic_0000002043470758_p18170517172119">Executes aggregate functions.</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="60%" headers="mcps1.3.4.2.1.2.4.1.3 "><ol id="EN-US_TOPIC_0000002088734277__en-us_topic_0000002043470758_ol19556324113911"><li id="EN-US_TOPIC_0000002088734277__en-us_topic_0000002043470758_li755672417395">Aggregate functions such as COUNT, SUM, AVG, MAX, and MIN.</li><li id="EN-US_TOPIC_0000002088734277__en-us_topic_0000002043470758_li105568249399">DISTINCT clause.</li><li id="EN-US_TOPIC_0000002088734277__en-us_topic_0000002043470758_li1055642453915">UNION deduplication.</li><li id="EN-US_TOPIC_0000002088734277__en-us_topic_0000002043470758_li1855614243394">GROUP BY clause.</li></ol>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0000002088734277__en-us_topic_0000002043470758_row114912360410"><td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.4.2.1.2.4.1.1 "><p id="EN-US_TOPIC_0000002088734277__en-us_topic_0000002043470758_p18171417162113">WindowAgg</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.4.2.1.2.4.1.2 "><p id="EN-US_TOPIC_0000002088734277__en-us_topic_0000002043470758_p6171141792111">Window functions</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="60%" headers="mcps1.3.4.2.1.2.4.1.3 "><p id="EN-US_TOPIC_0000002088734277__en-us_topic_0000002043470758_p17171181712212">WINDOW clause.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0000002088734277__en-us_topic_0000002043470758_row1315053615415"><td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.4.2.1.2.4.1.1 "><p id="EN-US_TOPIC_0000002088734277__en-us_topic_0000002043470758_p11171131716219">Unique</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.4.2.1.2.4.1.2 "><p id="EN-US_TOPIC_0000002088734277__en-us_topic_0000002043470758_p917111171215">Deduplication (with sorted lower-layer data)</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="60%" headers="mcps1.3.4.2.1.2.4.1.3 "><ol id="EN-US_TOPIC_0000002088734277__en-us_topic_0000002043470758_ol19969559143917"><li id="EN-US_TOPIC_0000002088734277__en-us_topic_0000002043470758_li0969259153913">DISTINCT clause.</li><li id="EN-US_TOPIC_0000002088734277__en-us_topic_0000002043470758_li296919592399">UNION deduplication.</li></ol>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0000002088734277__en-us_topic_0000002043470758_row71507361243"><td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.4.2.1.2.4.1.1 "><p id="EN-US_TOPIC_0000002088734277__en-us_topic_0000002043470758_p131715171216">Hash</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.4.2.1.2.4.1.2 "><p id="EN-US_TOPIC_0000002088734277__en-us_topic_0000002043470758_p417118171215">HashJoin auxiliary node</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="60%" headers="mcps1.3.4.2.1.2.4.1.3 "><p id="EN-US_TOPIC_0000002088734277__en-us_topic_0000002043470758_p13171141713214">Constructs a hash table and use it together with HashJoin.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0000002088734277__en-us_topic_0000002043470758_row21502363417"><td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.4.2.1.2.4.1.1 "><p id="EN-US_TOPIC_0000002088734277__en-us_topic_0000002043470758_p181718176219">SetOp</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.4.2.1.2.4.1.2 "><p id="EN-US_TOPIC_0000002088734277__en-us_topic_0000002043470758_p1717218177212">Processing set operations</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="60%" headers="mcps1.3.4.2.1.2.4.1.3 "><p id="EN-US_TOPIC_0000002088734277__en-us_topic_0000002043470758_p161722178212">INTERSECT/INTERSECT ALL, EXCEPT/EXCEPT ALL</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0000002088734277__en-us_topic_0000002043470758_row1815110361946"><td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.4.2.1.2.4.1.1 "><p id="EN-US_TOPIC_0000002088734277__en-us_topic_0000002043470758_p317221732119">LockRows</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.4.2.1.2.4.1.2 "><p id="EN-US_TOPIC_0000002088734277__en-us_topic_0000002043470758_p101721017152112">Processing row-level locks</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="60%" headers="mcps1.3.4.2.1.2.4.1.3 "><p id="EN-US_TOPIC_0000002088734277__en-us_topic_0000002043470758_p51727175213">SELECT ... FOR SHARE/UPDATE</p>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="section" id="EN-US_TOPIC_0000002088734277__en-us_topic_0000002043470758_section488712691117"><h4 class="sectiontitle">Control Operators</h4><div class="p" id="EN-US_TOPIC_0000002088734277__en-us_topic_0000002043470758_p176752047181210">Control operators are a type of node that handles exceptional scenarios and executes custom workflows.
|
|
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="EN-US_TOPIC_0000002088734277__en-us_topic_0000002043470758_table194964213417" frame="border" border="1" rules="all"><caption><b>Table 4 </b>Control operators</caption><thead align="left"><tr id="EN-US_TOPIC_0000002088734277__en-us_topic_0000002043470758_row1395054216416"><th align="left" class="cellrowborder" valign="top" width="20%" id="mcps1.3.5.2.1.2.4.1.1"><p id="EN-US_TOPIC_0000002088734277__en-us_topic_0000002043470758_p17950842043">Operator</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="30%" id="mcps1.3.5.2.1.2.4.1.2"><p id="EN-US_TOPIC_0000002088734277__en-us_topic_0000002043470758_p495024220413">Description</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="50%" id="mcps1.3.5.2.1.2.4.1.3"><p id="EN-US_TOPIC_0000002088734277__en-us_topic_0000002043470758_p2095019421149">Scenario</p>
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody><tr id="EN-US_TOPIC_0000002088734277__en-us_topic_0000002043470758_row59501242448"><td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.5.2.1.2.4.1.1 "><p id="EN-US_TOPIC_0000002088734277__en-us_topic_0000002043470758_p17318115872112">Result</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="30%" headers="mcps1.3.5.2.1.2.4.1.2 "><p id="EN-US_TOPIC_0000002088734277__en-us_topic_0000002043470758_p1931985811214">Performing calculation directly</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.3.5.2.1.2.4.1.3 "><ol id="EN-US_TOPIC_0000002088734277__en-us_topic_0000002043470758_ol1374750673"><li id="EN-US_TOPIC_0000002088734277__en-us_topic_0000002043470758_li18747503720">Table scanning is not included.</li><li id="EN-US_TOPIC_0000002088734277__en-us_topic_0000002043470758_li157414509714">The <strong id="EN-US_TOPIC_0000002088734277__en-us_topic_0000002043470758_b960914315467">INSERT</strong> statement contains only one <strong id="EN-US_TOPIC_0000002088734277__en-us_topic_0000002043470758_b59731074466">VALUES</strong> clause.</li></ol>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0000002088734277__en-us_topic_0000002043470758_row1395115421943"><td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.5.2.1.2.4.1.1 "><p id="EN-US_TOPIC_0000002088734277__en-us_topic_0000002043470758_p13319145819211">ModifyTable</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="30%" headers="mcps1.3.5.2.1.2.4.1.2 "><p id="EN-US_TOPIC_0000002088734277__en-us_topic_0000002043470758_p131985852114">INSERT/UPDATE/DELETE upper-layer node</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.3.5.2.1.2.4.1.3 "><p id="EN-US_TOPIC_0000002088734277__en-us_topic_0000002043470758_p9319958132118"><strong id="EN-US_TOPIC_0000002088734277__en-us_topic_0000002043470758_b1521412460468">INSERT</strong>, <strong id="EN-US_TOPIC_0000002088734277__en-us_topic_0000002043470758_b2529148114616">UPDATE</strong>, and <strong id="EN-US_TOPIC_0000002088734277__en-us_topic_0000002043470758_b38271449134618">DELETE</strong></p>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0000002088734277__en-us_topic_0000002043470758_row1951842845"><td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.5.2.1.2.4.1.1 "><p id="EN-US_TOPIC_0000002088734277__en-us_topic_0000002043470758_p183191058112111">Append</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="30%" headers="mcps1.3.5.2.1.2.4.1.2 "><p id="EN-US_TOPIC_0000002088734277__en-us_topic_0000002043470758_p1531905810216">Appending</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.3.5.2.1.2.4.1.3 "><ol id="EN-US_TOPIC_0000002088734277__en-us_topic_0000002043470758_ol85861301671"><li id="EN-US_TOPIC_0000002088734277__en-us_topic_0000002043470758_li11587180374"><strong id="EN-US_TOPIC_0000002088734277__en-us_topic_0000002043470758_b1559451524619">UNION(ALL)</strong></li><li id="EN-US_TOPIC_0000002088734277__en-us_topic_0000002043470758_li5587500714">Table inheritance</li></ol>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0000002088734277__en-us_topic_0000002043470758_row2951242248"><td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.5.2.1.2.4.1.1 "><p id="EN-US_TOPIC_0000002088734277__en-us_topic_0000002043470758_p17319058152119">MergeAppend</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="30%" headers="mcps1.3.5.2.1.2.4.1.2 "><p id="EN-US_TOPIC_0000002088734277__en-us_topic_0000002043470758_p83195586212">Appending (ordered input)</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.3.5.2.1.2.4.1.3 "><ol id="EN-US_TOPIC_0000002088734277__en-us_topic_0000002043470758_ol17118471569"><li id="EN-US_TOPIC_0000002088734277__en-us_topic_0000002043470758_li712470620"><strong id="EN-US_TOPIC_0000002088734277__en-us_topic_0000002043470758_b346319229466">UNION(ALL)</strong></li><li id="EN-US_TOPIC_0000002088734277__en-us_topic_0000002043470758_li11847069">Table inheritance</li></ol>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0000002088734277__en-us_topic_0000002043470758_row1795214421420"><td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.5.2.1.2.4.1.1 "><p id="EN-US_TOPIC_0000002088734277__en-us_topic_0000002043470758_p53192058152118">RecursiveUnion</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="30%" headers="mcps1.3.5.2.1.2.4.1.2 "><p id="EN-US_TOPIC_0000002088734277__en-us_topic_0000002043470758_p14320858172113">Processing the UNION subquery defined recursively in the WITH clause</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.3.5.2.1.2.4.1.3 "><p id="EN-US_TOPIC_0000002088734277__en-us_topic_0000002043470758_p1732010588218"><strong id="EN-US_TOPIC_0000002088734277__en-us_topic_0000002043470758_b12929959174614">WITH RECURSIVE... SELECT...</strong> statement</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0000002088734277__en-us_topic_0000002043470758_row295210421646"><td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.5.2.1.2.4.1.1 "><p id="EN-US_TOPIC_0000002088734277__en-us_topic_0000002043470758_p1320125812213">BitmapAnd</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="30%" headers="mcps1.3.5.2.1.2.4.1.2 "><p id="EN-US_TOPIC_0000002088734277__en-us_topic_0000002043470758_p932065813218">Bitmap logical AND operation</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.3.5.2.1.2.4.1.3 "><p id="EN-US_TOPIC_0000002088734277__en-us_topic_0000002043470758_p1732045882113">BitmapScan for multi-dimensional index scanning</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0000002088734277__en-us_topic_0000002043470758_row1295219423415"><td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.5.2.1.2.4.1.1 "><p id="EN-US_TOPIC_0000002088734277__en-us_topic_0000002043470758_p332020580219">BitmapOr</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="30%" headers="mcps1.3.5.2.1.2.4.1.2 "><p id="EN-US_TOPIC_0000002088734277__en-us_topic_0000002043470758_p6320145862111">Bitmap logical OR operation</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.3.5.2.1.2.4.1.3 "><p id="EN-US_TOPIC_0000002088734277__en-us_topic_0000002043470758_p8320195812111">BitmapScan for multi-dimensional index scanning</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0000002088734277__en-us_topic_0000002043470758_row99536424419"><td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.5.2.1.2.4.1.1 "><p id="EN-US_TOPIC_0000002088734277__en-us_topic_0000002043470758_p113201958142110">Limit</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="30%" headers="mcps1.3.5.2.1.2.4.1.2 "><p id="EN-US_TOPIC_0000002088734277__en-us_topic_0000002043470758_p113201558192114">Processing the LIMIT clause</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.3.5.2.1.2.4.1.3 "><p id="EN-US_TOPIC_0000002088734277__en-us_topic_0000002043470758_p432075802113"><strong id="EN-US_TOPIC_0000002088734277__en-us_topic_0000002043470758_b9988141624718">OFFSET ... LIMIT ...</strong></p>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="section" id="EN-US_TOPIC_0000002088734277__en-us_topic_0000002043470758_section896181416117"><h4 class="sectiontitle">Other Operators</h4><p id="EN-US_TOPIC_0000002088734277__en-us_topic_0000002043470758_p2611155317212">Other operators include Stream and RemoteQuery. There are three types of Stream operators: Gather stream, Broadcast stream, and Redistribute stream.</p>
|
|
<ul id="EN-US_TOPIC_0000002088734277__en-us_topic_0000002043470758_ul534118161452"><li id="EN-US_TOPIC_0000002088734277__en-us_topic_0000002043470758_li199421413451">Gather stream: Each source node sends its data to the target node for aggregation.</li><li id="EN-US_TOPIC_0000002088734277__en-us_topic_0000002043470758_li395171494510">Broadcast stream: A source node sends its data to N target nodes for calculation.</li><li id="EN-US_TOPIC_0000002088734277__en-us_topic_0000002043470758_li7961414194510">Redistribute stream: Each source node calculates the hash value of its data based on the join condition, distributes the data based on the hash value, and sends the data to the corresponding target node.</li></ul>
|
|
|
|
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="EN-US_TOPIC_0000002088734277__en-us_topic_0000002043470758_table20914173915227" frame="border" border="1" rules="all"><caption><b>Table 5 </b>Other Operators</caption><thead align="left"><tr id="EN-US_TOPIC_0000002088734277__en-us_topic_0000002043470758_row29141839132219"><th align="left" class="cellrowborder" valign="top" width="20%" id="mcps1.3.6.4.2.4.1.1"><p id="EN-US_TOPIC_0000002088734277__en-us_topic_0000002043470758_p8914739112215">Operator</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="20%" id="mcps1.3.6.4.2.4.1.2"><p id="EN-US_TOPIC_0000002088734277__en-us_topic_0000002043470758_p18914173918227">Description</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="60%" id="mcps1.3.6.4.2.4.1.3"><p id="EN-US_TOPIC_0000002088734277__en-us_topic_0000002043470758_p7915639162210">Scenario</p>
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody><tr id="EN-US_TOPIC_0000002088734277__en-us_topic_0000002043470758_row1891515393221"><td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.6.4.2.4.1.1 "><p id="EN-US_TOPIC_0000002088734277__en-us_topic_0000002043470758_p1748045192214">Stream</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.6.4.2.4.1.2 "><p id="EN-US_TOPIC_0000002088734277__en-us_topic_0000002043470758_p148019515225">Multi-node data exchange</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="60%" headers="mcps1.3.6.4.2.4.1.3 "><p id="EN-US_TOPIC_0000002088734277__en-us_topic_0000002043470758_p24806515223">When a distributed query plan is executed, data is exchanged between nodes.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0000002088734277__en-us_topic_0000002043470758_row159151039172211"><td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.6.4.2.4.1.1 "><p id="EN-US_TOPIC_0000002088734277__en-us_topic_0000002043470758_p2480125142219">Partition Iterator</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.6.4.2.4.1.2 "><p id="EN-US_TOPIC_0000002088734277__en-us_topic_0000002043470758_p1948020517226">Partition iterator</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="60%" headers="mcps1.3.6.4.2.4.1.3 "><p id="EN-US_TOPIC_0000002088734277__en-us_topic_0000002043470758_p1548016515229">Scans partitioned tables and iteratively scans each partition.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0000002088734277__en-us_topic_0000002043470758_row12915183913223"><td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.6.4.2.4.1.1 "><p id="EN-US_TOPIC_0000002088734277__en-us_topic_0000002043470758_p4480105112217">RowToVec</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.6.4.2.4.1.2 "><p id="EN-US_TOPIC_0000002088734277__en-us_topic_0000002043470758_p17480175152217">Rows-to-column conversion</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="60%" headers="mcps1.3.6.4.2.4.1.3 "><p id="EN-US_TOPIC_0000002088734277__en-us_topic_0000002043470758_p54801451192214">Hybrid row-column.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0000002088734277__en-us_topic_0000002043470758_row5916133919226"><td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.6.4.2.4.1.1 "><p id="EN-US_TOPIC_0000002088734277__en-us_topic_0000002043470758_p34801351192219">DfsScan / DfsIndexScan</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.6.4.2.4.1.2 "><p id="EN-US_TOPIC_0000002088734277__en-us_topic_0000002043470758_p548012512223">HDFS table (index) scanning</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="60%" headers="mcps1.3.6.4.2.4.1.3 "><p id="EN-US_TOPIC_0000002088734277__en-us_topic_0000002043470758_p5480135118221">HDFS table scanning.</p>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div>
|
|
<div class="familylinks">
|
|
<div class="parentlink"><strong>Parent topic:</strong> <a href="dws_04_0430.html">SQL Tuning</a></div>
|
|
</div>
|
|
</div>
|
|
|