Oracle SQL execution plan operation (7) - sorting related operations

7.  Sorting related operations

This type of operation is related to the sorting operation in the SQL statement execution plan. Depending on the specific SQL statement and other related factors, the following operations may appear in the execution plan of the relevant SQL statement.

1)BUFFER SORT

Sorting or other related operations on a row source data in the memory of the session service process, this operation first appeared in Oracle 9.0.1 version. This operation is specifically shown as node 3 in Figure 7-1.

Figure 7-1 Example of sorting related operations BUFFER SORT

2)SORT AGGREGATE

Obtain the aggregation results of the data through functions such as sum, count, max, and min. During this period, the relevant row source data needs to be sorted to achieve. This operation is specifically shown in node 1 in Figure 7-2.

Figure 7-2 Example of sorting related operations SORT AGGREGATE

3)SORT CREATE INDEX

Sort operations that occur during index creation. This operation is specifically shown in node 2 in Figure 7-3.

Figure 7-3 Example of sorting related operations SORT CREATE INDEX

4)SORT GROUP BY

Sort and group rows of data based on column values. This operation is specifically shown in node 1 in Figure 7-4.

Figure 7-4 Example of sorting related operations SORT GROUP BY

5)SORT GROUP BY ROLLUP

Sort, group and aggregate rows of data based on column values. This operation is specifically shown in node 1 in Figure 7-5.

Figure 7-5 Example of sorting related operations SORT GROUP BY ROLLUP

6)SORT GROUP BY STOPKEY

Sort and group data rows based on column values, and limit the number of returned data rows through the rownum pseudo column. When the rownum related conditions are no longer satisfied, the related operations are terminated and the results are output.

--Note:

      1) rownum: A pseudo-column whose data is not real data, but the serial number of each row of data in the output result set when obtaining other field data. It can usually be used to limit the number of rows returned by an SQL statement to optimize the performance of related SQL statements.

This operation is specifically shown as node 3 in Figure 7-6.

Figure 7-6 Example of sorting related operations SORT GROUP BY STOPKEY

7)SORT GROUP BY NOSORT

Group data rows based on column values. Because the input order of data rows is consistent with the order of requirements, this operation can directly group data rows without sorting. For example: data rows output by index range or full scan can be directly grouped without sorting. This operation is specifically shown in node 1 in Figure 7-7.

Figure 7-7 Example of sorting related operations SORT GROUP BY NOSORT

8)SORT GROUP BY NOSORT ROLLUP

Group and aggregate data rows based on column values. Because the data input sequence is consistent with the required sequence, data rows can be directly grouped and aggregated without sorting. This operation is specifically shown as node 1 in Figure 7-8.

Figure 7-8 Example of sorting related operations SORT GROUP BY NOSORT ROLLUP

9)SORT ORDER BY

Sorts rows of data based on related column values ​​to achieve sequential output of data. This operation is specifically shown in node 1 in Figure 7-9.

Figure 7-9 Example of sorting related operations SORT ORDER BY

10) SORT ORDER BY STOPKEY

Sort data rows based on related column values ​​to achieve sequential output of data, and limit the number of returned data rows through the rownum pseudo-column. This operation is specifically shown as node 3 in Figure 7-10.

Figure 7-10 Example of sorting related operations SORT ORDER BY STOPKEY

11)SORT UNIQUE

Sort and deduplicate data rows based on related column values ​​to output a result set without duplicate data. This operation is specifically shown in node 1 in Figure 7-11.

Figure 7-11 Example of sorting related operations SORT UNIQUE

12)SORT UNIQUE NOSORT

Deduplicate ordered data rows based on related column values ​​to output a result set without duplicate data. This operation is specifically shown in node 1 in Figure 7-12.

Figure 7-12 Example of sorting related operations SORT UNIQUE NOSORT

13) SORT UNIQUE STOPKEY

Sort and deduplicate data rows based on related column values ​​to output a result set without duplicate data, and limit the number of returned data rows through the rownum pseudo-column. This operation is specifically shown in node 3 in Figure 7-13.

Figure 7-13 Example of sorting related operations SORT UNIQUE STOPKEY

14)SORT PARTITION JOIN

Sort and group (partition) data rows based on join column values ​​to complete subsequent join operations, which occur in group (partition) outer joins.

--Note:

      1) The "partition" here does not refer to the partition of the table, but refers to a specific operation in the execution plan.

This operation is specifically shown as node 6 in Figure 7-14.

Figure 7-14 Example of sorting related operations SORT PARTITION JOIN

Guess you like

Origin blog.csdn.net/LHDZ_BJ/article/details/127964279