forked from cockroachdb/cockroach
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
118556: colexecagg: use heuristic to grow alloc size for hash aggregation r=yuzefovich a=yuzefovich **colexecagg: use heuristic to grow alloc size for hash aggregation** This commit changes how we determine the size of allocations for the hash aggregation (used to batch-allocate things for multiple buckets or groups). Previously, we would always use a fixed allocation size of 128 which is quite suboptimal with small number of groups. This commit fixes that by growing the allocation size exponentially, starting at 1, and until it reaches 128. As a result, we should be significantly more efficient in cases when we have few groups and slightly less efficient when we have a lot of groups. Note that the following commit will use the optimizer-driven estimate for the total number of groups when computing the initial allocation size. Additionally, this commit makes it so that every time the same agg alloc object is shared between multiple functions we increase its alloc size accordingly. We were already doing that for ordered and window aggregation, but now it makes sense do so for the hash aggregation too. Exponentially growing alloc size is handled similarly. **sql: use optimizer-driven estimate for allocation size** This commit plumbs the estimated row count for the number of rows produced by the GroupBy from the optimizer all the way to the execution, and then it uses this estimate to come up with the initial allocation size in the hash aggregator in the vectorized engine (mentioned in the previous commit). As expected, benchmarks (assuming the perfect optimizer estimation) show noticeable improvement in some cases, both in speed and size of allocations, slightly increasing the number of allocated objects in a few cases: https://gist.github.com/yuzefovich/1546c9d133c6ba52cdda6ecd9297ba7d. Informs: cockroachdb#117546. Epic: CRDB-35243 Release note: None Co-authored-by: Yahor Yuzefovich <yahor@cockroachlabs.com>
- Loading branch information
Showing
14 changed files
with
116 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters