Skip to content

Expand tuple comparisons into nested OR/AND form before normalization - #68

Closed
axiak wants to merge 1 commit into
release-22-hubspotfrom
ma-tuple-range-query-compiler
Closed

axiak wants to merge 1 commit into
release-22-hubspotfrom
ma-tuple-range-query-compiler

Conversation

@axiak

@axiak axiak commented May 7, 2026 •

Copy link
Copy Markdown

Description

Rewrites expressions like (a,b,c) > (x,y,z) into the equivalent nested form: (a>x OR (a=x AND (b>y OR (b=y AND c>z)))). This enables MySQL to use individual column indexes instead of requiring a composite index matching the tuple order.

Applies to >, >=, <, <= operators when the LHS consists entirely of column references.

Gated behind --expand_tuple_comparisons flag (default false).

Related Issue(s)

This is a workaround over this longstanding MySQL bug: https://bugs.mysql.com/bug.php?id=111952

Checklist

  • "Backport to:" labels have been added if this change should be back-ported to release branches
  • If this change is to be back-ported to previous releases, a justification is included in the PR description
  • Tests were added or are not required
  • Did the new or modified tests pass consistently locally and on CI?
  • Documentation was added or is not required

Deployment Notes

Rewrites expressions like (a,b,c) > (x,y,z) into the equivalent
nested form: (a>x OR (a=x AND (b>y OR (b=y AND c>z)))). This
enables MySQL to use individual column indexes instead of requiring
a composite index matching the tuple order.

Applies to >, >=, <, <= operators when the LHS consists entirely
of column references.

Gated behind --expand_tuple_comparisons flag (default false).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@github-actions

github-actions Bot commented Jun 7, 2026

Copy link
Copy Markdown

This PR is being marked as stale because it has been open for 30 days with no activity. To rectify, you may do any of the following:

  • Push additional commits to the associated branch.
  • Remove the stale label.
  • Add a comment indicating why it is not stale.

If no action is taken within 7 days, this PR will be closed.

@github-actions github-actions Bot added the Stale label Jun 7, 2026
@github-actions

Copy link
Copy Markdown

This PR was closed because it has been stale for 7 days with no activity.

@github-actions github-actions Bot closed this Jun 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants