Skip to content

Lift restriction that multi-col indices only allow = constraints #2872

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

Draft
wants to merge 1 commit into
base: mamcx/query-test-explain
Choose a base branch
from

Conversation

mamcx
Copy link
Contributor

@mamcx mamcx commented Jun 16, 2025

Description of Changes

Closes #1317

We had to disable this in #1316 but we should lift the restriction eventually for better query performance.

API and ABI breaking changes

Expected complexity level and risk

2

We optimize up to 3 columns in an index, and:

  • When all the comparisons are!= is always a full table scan
  • Multi-column indexes are only used if the query has a prefix match (ie all operators are =)
  • Else are converted to a single column index scan on the leftmost column and a filter on the rest

Testing

  • [*] Expand the testing to verify the plans to all the ops "=", ">", "<", ">=", "<=", !=
  • [*] Expand the testing to verify we return the same rows when executing the query with the above ops

@mamcx mamcx requested a review from joshua-spacetime June 16, 2025 16:59
@mamcx mamcx self-assigned this Jun 16, 2025
@mamcx mamcx added release-any To be landed in any release window Do not merge Do not merge PRs with this label without coordinating further labels Jun 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Do not merge Do not merge PRs with this label without coordinating further release-any To be landed in any release window
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant