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

improve performance for index anding in AbstractDataAccessRule #2804

Open
normen662 opened this issue Jul 4, 2024 · 0 comments
Open

improve performance for index anding in AbstractDataAccessRule #2804

normen662 opened this issue Jul 4, 2024 · 0 comments

Comments

@normen662
Copy link
Contributor

I am investigating a case where the data access rule needs to enumerate candidates for index anding (intersection of index scans) for dozens of indexes. In my case the number of indexes is 12 and the number of combinations that need to be considered for intersections is around 4k. Since we compute the (among other things) the common ordering repeatedly we end up spending more than a second on this one rule.

Observations:

  1. A necessary condition for the intersection to be plan-able is for the common ordering to exist. In fact, this condition is the most filtering condition when planning the intersection of index scans.
  2. The intersection merge of n orderings is commutative and associative.
  3. If there is a set of two orderings among the n orderings for a combination of single access orderings that does not have a common intersection ordering, the entire intersection ordering also does not exist and the intersection of these n single accesses cannot be planned.
  4. If all combinations of size k <= n - 1 do not have a common intersection ordering, then there cannot be a combination of size k + 1. Reasoning: Under the assumption that there is such a common intersection ordering of size k + 1, there must be a common ordering of size k that then can be intersection merged with the (k + 1)th ordering. That contradicts the assumption.

To address this issue:

  1. define a data structure that records all two-element sets of orderings of single accesses that do not have a common intersection ordering,
  2. define an algorithm that allows us to quickly establish whether a set of n orderings contains a two-element set of orderings that is known to not have a common intersection ordering
  3. early out if we were unable to find combinations of size k that have a common intersection ordering
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant