forked from cockroachdb/cockroach
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This commit improves our statistics estimates so that we never estimate zero rows unless the row count is provably zero (e.g., SELECT ... WHERE false). We want to avoid estimating zero rows since the stats may be stale, and we can end up with weird and inefficient plans if we estimate zero rows. Therefore, this commit changes the logic in the statisticsBuilder so that a row count of 0 is replaced with 1, unless that would be inconsistent with the cardinality. This commit also updates all estimates for distinct count and null count to ensure that they are never larger than the row count. We also ensure that there is at least one distinct or null value if row count > 0. Fixes cockroachdb#32578 Release note: None
- Loading branch information
Showing
8 changed files
with
109 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.