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

opt: support constrained in between filters with multiple partitioning columns #81456

Open
rharding6373 opened this issue May 18, 2022 · 1 comment
Labels
C-enhancement Solution expected to add code/behavior + preserve backward-compat (pg compat issues are exception) T-sql-queries SQL Queries Team
Projects

Comments

@rharding6373
Copy link
Collaborator

rharding6373 commented May 18, 2022

Currently the optimizer may be unable to generate a constrained in between filter for a constrained scan if an index is partitioned by multiple columns that have different order, even if the partitions themselves are constrained.

For example the following query should be able to use a constrained scan, but the optimizer is currently unable to generate constrained spans for the in between filters:

CREATE TABLE tab_part (
    col0
        INT8 NOT NULL,
    col1
        INT8 NOT NULL,
    col2
        INT8 NOT NULL,
    INDEX (col0 DESC, col1, col2)
        PARTITION BY LIST (col0, col1)
            (
                PARTITION one VALUES IN ((1, 10)),
                PARTITION two VALUES IN ((2, 20))
            )
);

SELECT * FROM tab_part WHERE col2 > 4;

See #80820 (comment) for more details.

Jira issue: CRDB-15172

@rharding6373 rharding6373 added the C-enhancement Solution expected to add code/behavior + preserve backward-compat (pg compat issues are exception) label May 18, 2022
@rharding6373 rharding6373 added this to Triage in SQL Queries via automation May 18, 2022
@blathers-crl blathers-crl bot added the T-sql-queries SQL Queries Team label May 18, 2022
@rharding6373 rharding6373 moved this from Triage to Backlog in SQL Queries May 18, 2022
@jlinder jlinder added sync-me and removed sync-me labels May 20, 2022
Copy link

We have marked this issue as stale because it has been inactive for
18 months. If this issue is still relevant, removing the stale label
or adding a comment will keep it active. Otherwise, we'll close it in
10 days to keep the issue queue tidy. Thank you for your contribution
to CockroachDB!

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Nov 23, 2023
@yuzefovich yuzefovich reopened this May 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-enhancement Solution expected to add code/behavior + preserve backward-compat (pg compat issues are exception) T-sql-queries SQL Queries Team
Projects
Archived in project
SQL Queries
Backlog (DO NOT ADD NEW ISSUES)
Development

No branches or pull requests

3 participants