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

docs/design: Support Spilling Unparalleled HashAgg #25792

Merged
merged 8 commits into from
Jul 12, 2021

Conversation

wshwsh12
Copy link
Contributor

What problem does this PR solve?

Issue Number: close #xxx

Problem Summary:

What is changed and how it works?

Proposal: xxx

What's Changed: Design docs.

How it Works:

Related changes

  • PR to update pingcap/docs/pingcap/docs-cn:

Release note

  • No release note

@ti-chi-bot ti-chi-bot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Jun 28, 2021
@wshwsh12 wshwsh12 requested a review from XuHuaiyu June 28, 2021 08:35
@wshwsh12 wshwsh12 mentioned this pull request Jul 2, 2021
5 tasks
docs/design/2021-06-23-spilled-unparallel-hashagg.md Outdated Show resolved Hide resolved
docs/design/2021-06-23-spilled-unparallel-hashagg.md Outdated Show resolved Hide resolved
docs/design/2021-06-23-spilled-unparallel-hashagg.md Outdated Show resolved Hide resolved
docs/design/2021-06-23-spilled-unparallel-hashagg.md Outdated Show resolved Hide resolved

## Impacts & Risks

* Memory will still grow without increasing the number of new tuples in HashMap for distinct aggregate function.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand this. It's seem that there is a contradiction between memory still grow and without increasing the number of new tuples.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In fact, it is not contradict. For the distinct agg function, it is necessary to record those values that have appeared. We are using a set to record this information. This set will still grow during the aggregation process without increasing the number of new tuples in aggPartialResultMapper.
For example,

type partialResult4CountDistinctInt struct {
	valSet set.Int64SetWithMemoryUsage
}

Copy link
Member

@mmyj mmyj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@ti-chi-bot ti-chi-bot added the status/LGT1 Indicates that a PR has LGTM 1. label Jul 7, 2021
# Proposal: Support Spilling Unparalleled HashAgg

- Author(s): [@wshwsh12](https://github.com/wshwsh12)
- Discussion PR: N/A
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- Discussion PR: N/A
- Discussion PR: https://github.com/pingcap/tidb/pull/25792

@wshwsh12 wshwsh12 requested a review from XuHuaiyu July 12, 2021 06:36
* When the unparallel-agg exceeds the memory quota, this feature helps reduce memory usage and run the sql successfully.
* When the parallel-agg exceeds the memory quota, the SQL will be canceled before. After the agg-concurrency args are set to 1, the SQL can run successfully.
* When the ndv of the data is low, the SQL contains distinct function will be canceled before. After the agg-concurrency args are set to 1, the SQL can run successfully.
* When the ndv of the data is high, the SQL contains distinct function will be canceled before. After the agg-concurrency args are set to 1, the SQL can be canceled successfully if there is insufficient memory.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need to set the concurrency-related args when there exists an aggregation function with the keyword distinct.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed

@wshwsh12 wshwsh12 requested a review from XuHuaiyu July 12, 2021 07:46
Copy link
Contributor

@XuHuaiyu XuHuaiyu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ti-chi-bot
Copy link
Member

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • XuHuaiyu
  • mmyj

To complete the pull request process, please ask the reviewers in the list to review by filling /cc @reviewer in the comment.
After your PR has acquired the required number of LGTMs, you can assign this pull request to the committer in the list by filling /assign @committer in the comment to help you merge this pull request.

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

Reviewer can indicate their review by submitting an approval review.
Reviewer can cancel approval by submitting a request changes review.

@ti-chi-bot ti-chi-bot added status/LGT2 Indicates that a PR has LGTM 2. and removed status/LGT1 Indicates that a PR has LGTM 1. labels Jul 12, 2021
@XuHuaiyu
Copy link
Contributor

/merge

@ti-chi-bot
Copy link
Member

This pull request has been accepted and is ready to merge.

Commit hash: d78daac

@ti-chi-bot ti-chi-bot added the status/can-merge Indicates a PR has been approved by a committer. label Jul 12, 2021
@XuHuaiyu XuHuaiyu added component/docs and removed status/can-merge Indicates a PR has been approved by a committer. labels Jul 12, 2021
@ti-chi-bot ti-chi-bot added the status/can-merge Indicates a PR has been approved by a committer. label Jul 12, 2021
@ti-chi-bot ti-chi-bot merged commit 52f1e0e into pingcap:master Jul 12, 2021
@wshwsh12 wshwsh12 deleted the design-docs branch January 29, 2022 07:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/docs size/M Denotes a PR that changes 30-99 lines, ignoring generated files. status/can-merge Indicates a PR has been approved by a committer. status/LGT2 Indicates that a PR has LGTM 2.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants