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

better match simple predicates to indexes using functions that are not invertable, and effectively invertible #2911

Open
normen662 opened this issue Sep 11, 2024 · 0 comments

Comments

@normen662
Copy link
Contributor

Example 1

We have an index on 15 - y, it can be used for a query predicate y < 10!
Something should turn minus(15, y) into f(y) and then that says

  1. invertible and
  2. order-preserving: reverse to yield f(y) > 5

This works because y < 10 can be matched to minus(15, y) if we then have a ComparisonCompensation that is applied to the right side obtaining minus(15, 10) and then 5.

This currently does not work because the underlying arithmetic function takes more than one argument.

Example 2

String prefix index, index is on something like prefix(a, 10), data indexes two records: 'United States of America',
'United States of Petoria'. Query is a = 'United States of America'.

In order to not return both entries the predicate needs to be reapplied as a residual. Mathematically, the function prefix(...) is not invertable, thus we would need to reapply the predicate.

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