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: improve query plans on tables with ascending keys #83431

Closed
mgartner opened this issue Jun 27, 2022 · 2 comments
Closed

opt: improve query plans on tables with ascending keys #83431

mgartner opened this issue Jun 27, 2022 · 2 comments
Assignees
Labels
C-enhancement Solution expected to add code/behavior + preserve backward-compat (pg compat issues are exception) T-sql-queries SQL Queries Team

Comments

@mgartner
Copy link
Collaborator

mgartner commented Jun 27, 2022

This ascending query problem is a common problem for database optimizers. The problem is that the optimizer assumes that a columns has zero or very few values outside of the maximum (and minimum) values in the collected histograms. If newly inserted values are ever-increasing, then the optimizer can wildly underestimate the rows that match filters for the latest values, leading to query plans with very poor performance.

A detailed description of the problem can be found at #64570 (comment).

Jira issue: CRDB-17067

Epic: CRDB-13963

@mgartner mgartner added the C-enhancement Solution expected to add code/behavior + preserve backward-compat (pg compat issues are exception) label Jun 27, 2022
@blathers-crl blathers-crl bot added the T-sql-queries SQL Queries Team label Jun 27, 2022
@rytaft
Copy link
Collaborator

rytaft commented Jul 3, 2022

Is this a duplicate of #79872?

@mgartner
Copy link
Collaborator Author

mgartner commented Jul 5, 2022

Yes, closing.

@mgartner mgartner closed this as completed Jul 5, 2022
@mgartner mgartner moved this to Done in SQL Queries Jul 24, 2023
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
Development

No branches or pull requests

3 participants