mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-25 17:12:03 +00:00
149 lines
2.6 KiB
Plaintext
149 lines
2.6 KiB
Plaintext
Too many optimizations applied to query plan
|
|
Too many optimizations applied to query plan
|
|
> sipHash should be calculated after filtration
|
|
FUNCTION sipHash64
|
|
Filter column: equals
|
|
> sorting steps should know about limit
|
|
Limit 10
|
|
MergingSorted
|
|
Limit 10
|
|
MergeSorting
|
|
Limit 10
|
|
PartialSorting
|
|
Limit 10
|
|
-- filter push down --
|
|
> filter should be pushed down after aggregating
|
|
Aggregating
|
|
Filter
|
|
0 1
|
|
1 2
|
|
2 3
|
|
3 4
|
|
4 5
|
|
5 6
|
|
6 7
|
|
7 8
|
|
8 9
|
|
9 10
|
|
> filter should be pushed down after aggregating, column after aggregation is const
|
|
COLUMN Const(UInt8) -> notEquals(y, 0)
|
|
Aggregating
|
|
Filter
|
|
Filter
|
|
0 1 1
|
|
1 2 1
|
|
2 3 1
|
|
3 4 1
|
|
4 5 1
|
|
5 6 1
|
|
6 7 1
|
|
7 8 1
|
|
8 9 1
|
|
9 10 1
|
|
> one condition of filter should be pushed down after aggregating, other condition is aliased
|
|
Filter column
|
|
ALIAS notEquals(s, 4) :: 1 -> and(notEquals(y, 0), notEquals(s, 4))
|
|
Aggregating
|
|
Filter column: notEquals(y, 0)
|
|
0 1
|
|
1 2
|
|
2 3
|
|
3 4
|
|
5 6
|
|
6 7
|
|
7 8
|
|
8 9
|
|
9 10
|
|
> one condition of filter should be pushed down after aggregating, other condition is casted
|
|
Filter column
|
|
FUNCTION CAST(minus(s, 4) :: 1, UInt8 :: 3) -> and(notEquals(y, 0), minus(s, 4))
|
|
Aggregating
|
|
Filter column: notEquals(y, 0)
|
|
0 1
|
|
1 2
|
|
2 3
|
|
3 4
|
|
5 6
|
|
6 7
|
|
7 8
|
|
8 9
|
|
9 10
|
|
> one condition of filter should be pushed down after aggregating, other two conditions are ANDed
|
|
Filter column
|
|
FUNCTION and(minus(s, 8) :: 1, minus(s, 4) :: 2) -> and(notEquals(y, 0), minus(s, 8), minus(s, 4))
|
|
Aggregating
|
|
Filter column: notEquals(y, 0)
|
|
0 1
|
|
1 2
|
|
2 3
|
|
3 4
|
|
5 6
|
|
6 7
|
|
7 8
|
|
9 10
|
|
> two conditions of filter should be pushed down after aggregating and ANDed, one condition is aliased
|
|
Filter column
|
|
ALIAS notEquals(s, 8) :: 1 -> and(notEquals(y, 0), notEquals(s, 8), minus(y, 4))
|
|
Aggregating
|
|
Filter column: and(notEquals(y, 0), minus(y, 4))
|
|
0 1
|
|
1 2
|
|
2 3
|
|
4 5
|
|
5 6
|
|
6 7
|
|
7 8
|
|
9 10
|
|
> filter is split, one part is filtered before ARRAY JOIN
|
|
Filter column: and(notEquals(y, 2), notEquals(x, 0))
|
|
ARRAY JOIN x
|
|
Filter column: notEquals(y, 2)
|
|
1 3
|
|
> filter is pushed down before Distinct
|
|
Distinct
|
|
Distinct
|
|
Filter column: notEquals(y, 2)
|
|
0 0
|
|
0 1
|
|
1 0
|
|
1 1
|
|
> filter is pushed down before sorting steps
|
|
MergingSorted
|
|
MergeSorting
|
|
PartialSorting
|
|
Filter column: and(notEquals(x, 0), notEquals(y, 0))
|
|
1 2
|
|
1 1
|
|
> filter is pushed down before TOTALS HAVING and aggregating
|
|
TotalsHaving
|
|
Aggregating
|
|
Filter column: notEquals(y, 2)
|
|
0 12
|
|
1 15
|
|
3 10
|
|
|
|
0 37
|
|
> filter is pushed down before CreatingSets
|
|
CreatingSets
|
|
Filter
|
|
Filter
|
|
1
|
|
3
|
|
> one condition of filter is pushed down before LEFT JOIN
|
|
Join
|
|
Filter column: notEquals(number, 1)
|
|
Join
|
|
0 0
|
|
3 3
|
|
> one condition of filter is pushed down before INNER JOIN
|
|
Join
|
|
Filter column: notEquals(number, 1)
|
|
Join
|
|
3 3
|
|
> filter is pushed down before UNION
|
|
Union
|
|
Filter
|
|
Filter
|
|
2 3
|
|
2 3
|