-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
sql/stats: store non-NULL histograms for empty tables
We have been storing NULL histograms / using nil HistogramData for all the following cases: 1. regular stats, GenerateHistogram=false 2. regular stats, GenerateHistogram=true, empty table 3. regular stats, GenerateHistogram=true, all NULL values 4. inverted stats, no inverted index 5. inverted stats, yes inverted index, empty table 6. inverted stats, yes inverted index, all NULL values When predicting histograms for statistics forecasts, we need to distinguish between case 1 and cases 2 and 3. In case 1 we cannot predict histograms, but in cases 2 and 3 we can (and the emptiness of the histogram is important). So, for cases 2 and 3 we now store an empty histogram instead of NULL, and correspondingly use an initialized HistogramData with 0-length Buckets instead of nil HistogramData. This also helps with testing statistics forecasts. (The inability to distinguish cases 4-6 doesn't matter, because we cannot predict histograms for inverted indexes anyway. I tried to change cases 5 and 6 to be non-NULL for consistency but ran into some problems, so I'll leave them as they are.) Release note: None
- Loading branch information
Showing
5 changed files
with
205 additions
and
3 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