Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

executor: Support Parallel Sort #49705

Merged
merged 168 commits into from
Feb 26, 2024
Merged

Conversation

xzhangxian1008
Copy link
Contributor

@xzhangxian1008 xzhangxian1008 commented Dec 22, 2023

What problem does this PR solve?

Issue Number: close #49217

Problem Summary:

What changed and how does it work?

Golang Builtin Benchmark

Unparallel Sort:
BenchmarkSortExec/(rows:300000,_orderBy:[0_1],_ndvs:_[0_0])-72       254143338 ns/op
BenchmarkSortExec/(rows:300000,_orderBy:[0_1],_ndvs:_[1_0])-72       355555629 ns/op
BenchmarkSortExec/(rows:300000,_orderBy:[0],_ndvs:_[1_0])-72          45852456 ns/op
BenchmarkSortExec/(rows:300000,_orderBy:[1],_ndvs:_[1_0])-72         254146326 ns/op
BenchmarkSortExec/(rows:300000,_orderBy:[0_1],_ndvs:_[10000_0])-72   296893378 ns/op
BenchmarkSortExec/(rows:300000,_orderBy:[0],_ndvs:_[10000_0])-72     219969174 ns/op
BenchmarkSortExec/(rows:300000,_orderBy:[1],_ndvs:_[10000_0])-72     252317562 ns/op
average                                                              239839694 ns/op

Parallel Sort:
BenchmarkSortExec/(rows:300000,_orderBy:[0_1],_ndvs:_[0_0])-72       139268537 ns/op
BenchmarkSortExec/(rows:300000,_orderBy:[0_1],_ndvs:_[1_0])-72       158654422 ns/op
BenchmarkSortExec/(rows:300000,_orderBy:[0],_ndvs:_[1_0])-72          35870240 ns/op
BenchmarkSortExec/(rows:300000,_orderBy:[1],_ndvs:_[1_0])-72         128380614 ns/op
BenchmarkSortExec/(rows:300000,_orderBy:[0_1],_ndvs:_[10000_0])-72   144901004 ns/op
BenchmarkSortExec/(rows:300000,_orderBy:[0],_ndvs:_[10000_0])-72     118420609 ns/op
BenchmarkSortExec/(rows:300000,_orderBy:[1],_ndvs:_[10000_0])-72     119021069 ns/op
average                                                              120645213 ns/op

Increase                                                             98.80%

TPCH10 Benchmark

Dataset: tpch10
Nodes: 1*tidb, 3*tikv
sql1: explain analyze select L_COMMENT, L_EXTENDEDPRICE from lineitem where L_SUPPKEY > 95000 order by L_COMMENT desc, L_EXTENDEDPRICE asc;
sql2: explain analyze select * from lineitem where L_SUPPKEY > 95000 order by L_COMMENT desc, L_EXTENDEDPRICE asc;

  Sql1 Sql2
Unparallel 18.19s 26.69s
Parallel 5.39s 11.43s
Increase 237.48% 133.51%

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
  • No need to test
    • I checked and no code files have been changed.

Side effects

  • Performance regression: Consumes more CPU
  • Performance regression: Consumes more Memory
  • Breaking backward compatibility

Documentation

  • Affects user behaviors
  • Contains syntax changes
  • Contains variable changes
  • Contains experimental features
  • Changes MySQL compatibility

Release note

Please refer to Release Notes Language Style Guide to write a quality release note.

None

@ti-chi-bot ti-chi-bot bot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Feb 4, 2024
@xzhangxian1008
Copy link
Contributor Author

/cc @wshwsh12

pkg/executor/sortexec/parallel_sort_worker.go Outdated Show resolved Hide resolved
pkg/executor/sortexec/sort.go Outdated Show resolved Hide resolved
pkg/executor/sortexec/sort.go Outdated Show resolved Hide resolved
pkg/executor/sortexec/sort.go Outdated Show resolved Hide resolved
@xzhangxian1008
Copy link
Contributor Author

/cc @wshwsh12

@ti-chi-bot ti-chi-bot bot requested a review from wshwsh12 February 21, 2024 08:18
@xzhangxian1008
Copy link
Contributor Author

/cc @wshwsh12

@xzhangxian1008
Copy link
Contributor Author

/retest

Copy link

tiprow bot commented Feb 23, 2024

@xzhangxian1008: Cannot trigger testing until a trusted user reviews the PR and leaves an /ok-to-test message.

In response to this:

/retest

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@ti-chi-bot ti-chi-bot bot added lgtm and removed needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Feb 23, 2024
Copy link

ti-chi-bot bot commented Feb 23, 2024

[LGTM Timeline notifier]

Timeline:

  • 2024-02-04 06:36:27.966867645 +0000 UTC m=+79513.533637536: ☑️ agreed by SeaRise.
  • 2024-02-23 05:55:08.187910315 +0000 UTC m=+595796.935533425: ☑️ agreed by wshwsh12.

@easonn7
Copy link

easonn7 commented Feb 26, 2024

/approve

Copy link

ti-chi-bot bot commented Feb 26, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: easonn7, SeaRise, wshwsh12

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@ti-chi-bot ti-chi-bot bot added the approved label Feb 26, 2024
@ti-chi-bot ti-chi-bot bot merged commit de16e0d into pingcap:master Feb 26, 2024
21 checks passed
@xzhangxian1008 xzhangxian1008 deleted the parallel-sort branch February 26, 2024 13:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved lgtm release-note-none Denotes a PR that doesn't merit a release note. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support parallel sort
6 participants