Skip to content

Commit

Permalink
[Improvement](sort) adjust HEAP_SORT usage threshold (apache#41288)
Browse files Browse the repository at this point in the history
## Proposed changes
adjust HEAP_SORT usage threshold

```sql
before
mysql [test]>SELECT/*+SET_VAR(parallel_pipeline_task_num=1)*/ COUNT() FROM (   SELECT URL   FROM hits_1m   ORDER BY FlashMajor   LIMIT 1000000   OFFSET 50000 ) t;
+----------+
| count(*) |
+----------+
|   950000 |
+----------+
1 row in set (0.82 sec)

after
mysql [test]>SELECT/*+SET_VAR(parallel_pipeline_task_num=1)*/ COUNT() FROM (   SELECT URL   FROM hits_1m   ORDER BY FlashMajor   LIMIT 1000000   OFFSET 50000 ) t;
+----------+
| count(*) |
+----------+
|   950000 |
+----------+
1 row in set (0.22 sec)
```
  • Loading branch information
BiteTheDDDDt authored Sep 27, 2024
1 parent ac7084c commit b5d0077
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ protected void toThrift(TPlanNode msg) {
} else if (hasRuntimePredicate || useTwoPhaseReadOpt) {
algorithm = TSortAlgorithm.HEAP_SORT;
} else {
if (limit + offset < 5000000) {
if (limit + offset < 50000) {
algorithm = TSortAlgorithm.HEAP_SORT;
} else if (limit + offset < 20000000) {
algorithm = TSortAlgorithm.FULL_SORT;
Expand Down

0 comments on commit b5d0077

Please sign in to comment.