Skip to content

Add vectorized filtering to constraint checking #7972

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

antekresic
Copy link
Contributor

When backfilling compressed chunks with constraint checking, we need to read and filter compressed tuples in order to confirm constraints are validated. This change adds the ability to do this operation using vectorized decompression and vectorized filtering if the types allow us to do so.

@antekresic antekresic added the enhancement An enhancement to an existing feature for functionality label Apr 16, 2025
@antekresic antekresic added this to the v2.20.0 milestone Apr 16, 2025
@antekresic antekresic self-assigned this Apr 16, 2025
When backfilling compressed chunks with constraint checking,
we need to read and filter compressed tuples in order to
confirm constraints are validated. This change adds the
ability to do this operation using vectorized decompression
and vectorized filtering if the types allow us to do so.
@antekresic antekresic force-pushed the antekresic/add_vectorized_filtering branch from 3357ca6 to 2b51915 Compare April 16, 2025 11:13
@antekresic antekresic marked this pull request as ready for review April 16, 2025 11:17
@antekresic antekresic requested review from akuzm and svenklemm April 16, 2025 11:17
Comment on lines +425 to +426
BatchMatcher *batch_matcher =
constraints && constraints->vectorized_filtering ? batch_matches_vectorized : batch_matches;
Copy link
Member

Choose a reason for hiding this comment

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

Is it complicated to do both at the same time? DecompressChunk does this, some filters can be vectorized and some not, and both are supported at the same time.

continue;
}

VectorPredicate *predicate = get_vector_const_predicate(scankeys[sk].sk_func.fn_oid);
Copy link
Member

Choose a reason for hiding this comment

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

Is it possible to use vector_qual_make + vector_qual_compute? This will be difficult to maintain, right now we're adding bools here, and then UUIDs, and it looks like it might require separate support here. An example of how this is used is in can_vectorize_aggref + vector_agg_exec.

Comment on lines +1654 to +1656
/* Ignore segmentby columns, they aren't compressed */
if (ts_array_is_member(settings->fd.segmentby, attname))
continue;
Copy link
Member

Choose a reason for hiding this comment

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

vector_qual_compute works for segmentby as well, we use that when computing FILTER clause

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement An enhancement to an existing feature for functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants