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

Add unsorted decompressed chunk path even if we have sorted ones #6879

Open
wants to merge 187 commits into
base: main
Choose a base branch
from

Conversation

akuzm
Copy link
Member

@akuzm akuzm commented May 3, 2024

The unsorted paths are better for hash aggregation, but currently if we're doing aggregation and we can push down the sort, we are only going to add sorted paths.

Fixes #6836
Fixes #7084

akuzm added 30 commits May 3, 2024 17:03
The unsorted paths are better for hash aggregation, but currently in
this case we are only going to add sorted paths.
Add ANALYZE. To keep the desired MergeAppend plans, we also have to add
a LIMIT everywhere so that the MergeAppend is chosen based on its lower
startup cost. Otherwise the plain Sort over Append will be chosen
because for small tables its cost is less.
Add ANALYZE after compression. The plan changes are expected, SeqScans
are preferred over IndexScans and Sort over MergeAppend for small
tables.
We would add extra Sort nodes when adjusting the children of space
partitioning MergeAppend under ChunkAppend. This is not needed because
MergeAppend plans add the required Sort themselves, and in general no
adjustment seems to be required for the MergeAppend children
specifically there.
@akuzm akuzm marked this pull request as ready for review December 12, 2024 10:59
Copy link

@fabriziomello, @erimatnor: please review this pull request.

Powered by pull-review

Comment on lines 27 to 29
#define IS_UPDL_CMD(parse) \
((parse)->commandType == CMD_UPDATE || (parse)->commandType == CMD_DELETE)

Copy link
Member

Choose a reason for hiding this comment

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

can we just drop this macro, i dont think it adds much clarity

Comment on lines +1619 to +1624
Group Key: _hyper_31_114_chunk.device_id
-> Sort
Sort Key: _hyper_31_114_chunk.device_id
-> Gather
Workers Planned: 2
-> Parallel Append
Copy link
Member Author

Choose a reason for hiding this comment

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

This should be GatherMerge above Sort, will be addressed here: #7547

Comment on lines -933 to -942
/*
* Check if this path is parameterized on a compressed
* column. Ideally those paths wouldn't be generated
* in the first place but since we create compressed
* EquivalenceMembers for all EquivalenceClasses these
* Paths can happen and will fail at execution since
* the left and right side of the expression are not
* compatible. Therefore we skip any Path that is
* parameterized on a compressed column here.
*/
Copy link
Member Author

@akuzm akuzm Dec 19, 2024

Choose a reason for hiding this comment

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

I think I fixed this some time ago, we shouldn't be creating EquivalenceMembers on compressed columns of compressed chunk table anymore because they don't make sense anyway. Removed this check and the tests for older issues still pass.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants