Similar to #93094, the statistic merging logic in:
|
func mergeExtremesStatistic( |
|
ctx context.Context, fullStat *TableStatistic, partialStat *TableStatistic, st *cluster.Settings, |
|
) (*TableStatistic, error) { |
breaks when either statistic has outer buckets. Outer buckets have column-type max or min values and will always overlap with the buckets of the other stats being merged with, and fail to produce a merged statistic.
Example:
SET enable_create_stats_using_extremes = on;
CREATE TABLE a (a PRIMARY KEY) WITH (sql_stats_automatic_collection_enabled = false) AS SELECT generate_series(0, 9999);
CREATE STATISTICS a_full ON a FROM a;
SHOW STATISTICS FOR TABLE a;
SHOW HISTOGRAM $full_stat_hist_id;
INSERT INTO a VALUES (10000);
CREATE STATISTICS a_partial ON a FROM a USING EXTREMES;
SHOW STATISTICS FOR TABLE a WITH MERGE;
Observe that the full stat histogram creates a histogram with outer buckets, and that there is no __merged__ statistic after creating partial stats.
Jira issue: CRDB-40154
Similar to #93094, the statistic merging logic in:
cockroach/pkg/sql/stats/merge.go
Lines 118 to 120 in b5ab804
Example:
Observe that the full stat histogram creates a histogram with outer buckets, and that there is no
__merged__statistic after creating partial stats.Jira issue: CRDB-40154