You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 5a0dc91
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: src/Core/Settings.cpp
+14Lines changed: 14 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -2193,13 +2193,27 @@ Answer `min`, `max` and `count` aggregations from per-part column statistics ins
2193
2193
When enabled, a query of the form `SELECT min(column), max(column), count() FROM table` without `GROUP BY` and filters
2194
2194
is answered from column statistics (e.g. MinMax statistics, see the `auto_statistics_types` MergeTree setting)
2195
2195
for the data parts that have them materialized, and only the remaining parts are read.
2196
+
`count()` is also answered together with the aggregations of `use_statistics_for_sum_avg_aggregation`.
2196
2197
2197
2198
Possible values:
2198
2199
2199
2200
- 0 — Disabled.
2200
2201
- 1 — Enabled.
2201
2202
)", 0, \
2202
2203
{"26.9", false, true, "New setting to answer `min`, `max` and `count` aggregations without `GROUP BY` and filters from per-part column statistics for parts that have them materialized, reading only the remaining parts. previous_value=false so `compatibility` with versions before 26.9 keeps the optimization disabled and restores the pre-existing plan."}) \
Answer `sum`, `avg` and `sumCount` aggregations over integer and `Decimal` columns that are not `Nullable` or
2206
+
`LowCardinality`, without `GROUP BY` and filters, from per-part column statistics (the `basic` statistics type, see the
2207
+
`auto_statistics_types` `MergeTree` setting) for the data parts that have them materialized, and read only the remaining
2208
+
parts. `count(column)` of a column that is not `Nullable` or `LowCardinality` is answered there from the number of rows.
2209
+
The result is exactly the same as when reading the data.
2210
+
2211
+
Possible values:
2212
+
2213
+
- 0 — Disabled.
2214
+
- 1 — Enabled.
2215
+
)", 0, \
2216
+
{"26.10", false, true, "New setting to answer `sum`, `avg`, `sumCount` and `count(column)` aggregations without `GROUP BY` and filters from per-part column statistics. previous_value=false so `compatibility` with versions before 26.10 keeps the optimization disabled and restores the pre-existing plan."}) \
Copy file name to clipboardExpand all lines: src/Storages/MergeTree/registerStorageMergeTree.cpp
+2-1Lines changed: 2 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -2582,7 +2582,8 @@ EXPLAIN indexes = 1 SELECT count() FROM test_stats WHERE value > 5000;
2582
2582
A compact bundle of single-value summaries derived from a column. Depending on the column type, the following pieces are populated:
2583
2583
- for any column: the number of rows equal to the type's default value (`0` for integers and floats, `''` for `String`, `[]` for `Array`, `NULL` for `Nullable`, etc.), which lets the optimizer estimate `col = <default>` predicates and `IS NULL` filters;
2584
2584
- for any column whose values are represented by a number (integers, floats, `Decimal*`, `Date*`, `DateTime*`, `Enum*`, `IPv4`, ...): the minimum and maximum value, which allow to estimate the selectivity of range filters and enable part pruning;
2585
-
- for `String` and `FixedString` columns: the total byte length of non-`NULL` values (from which the average string length can be derived).
2585
+
- for `String` and `FixedString` columns: the total byte length of non-`NULL` values (from which the average string length can be derived);
2586
+
- for integer and `Decimal` columns that are not `Nullable` or `LowCardinality`: the exact sum of values, from which `sum`, `avg` and `sumCount` without `GROUP BY` and filters are answered (see the `use_statistics_for_sum_avg_aggregation` setting).
2586
2587
2587
2588
A single `basic` statistic can populate several of these at once — for example on a `Nullable(UInt32)` column it tracks both numeric min/max and the `NULL` count. Because a default-value count is defined for every column type, `basic` can be declared on any column, including composite types such as `Array`, `Tuple`, and `Map`.
0 commit comments