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

sql: virtual table constrained scan #74806

Open
Azhng opened this issue Jan 13, 2022 · 4 comments
Open

sql: virtual table constrained scan #74806

Azhng opened this issue Jan 13, 2022 · 4 comments
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

@Azhng
Copy link
Contributor

Azhng commented Jan 13, 2022

Is your feature request related to a problem? Please describe.

Currently, there's no way perform an efficient constrained scan virtual table. That means, if a virtual table utilizes a regular SQL table under the hood, there's no way for the virtual table to utilize the indexes from the underlying SQL table, resulting in the bad bad query plans where SQL engine performs full table scan. This becomes more problematic if the sorting is involved which result in a small query fall back to disk spilling sort. E.g. #74680 #71245

Describe the solution you'd like
The virtual table generator / populate hook should have the predicate information in order to make smarter decisions.

Jira issue: CRDB-12275

Epic CRDB-14840

@Azhng Azhng added the C-enhancement Solution expected to add code/behavior + preserve backward-compat (pg compat issues are exception) label Jan 13, 2022
@Azhng
Copy link
Contributor Author

Azhng commented Jan 13, 2022

cc @cockroachdb/sql-queries

@ajwerner
Copy link
Contributor

Well, you can push down a predicate which fully specifies a row with the virtualIndex construct. The problem with it is that it doesn't work if you want to scan a constrained portion of the virtual table.

@Azhng Azhng changed the title sql: virtual table predicate push down sql: virtual table constrained scan Jan 13, 2022
@Azhng
Copy link
Contributor Author

Azhng commented Jan 13, 2022

Ah good point, changed the title.

@Azhng Azhng added the T-sql-queries SQL Queries Team label Jan 13, 2022
@blathers-crl blathers-crl bot added this to Triage in SQL Queries Jan 13, 2022
@rharding6373 rharding6373 moved this from Triage to Backlog in SQL Queries Jan 18, 2022
@yuzefovich yuzefovich moved this from Backlog to Triage in SQL Queries Jan 26, 2022
@yuzefovich yuzefovich moved this from Triage to Backlog in SQL Queries Feb 8, 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!

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
Status: Backlog
SQL Queries
Backlog (DO NOT ADD NEW ISSUES)
Development

No branches or pull requests

4 participants