-
Notifications
You must be signed in to change notification settings - Fork 6.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
custom partition: partition elimination issue? 1.1.54380. #2342
Comments
drop table test.testy; CREATE TABLE test.testy(d Int64, n Int64) ENGINE = MergeTree Partition by (ceil(d/2), n) Order by tuple(); insert into test.testy select 1, 33 n from numbers(1); SELECT count() FROM test.testy PREWHERE (n = 34); SELECT count() FROM test.testy PREWHERE (n = 34 and d>=1); SELECT count() FROM test.testy PREWHERE (n = 34 and d=1); select partition, rows from system.parts where active = 1 and table ='testy'
|
Another order in partition by drop table test.testy; CREATE TABLE test.testy(d Int64, n Int64) ENGINE = MergeTree Partition by (n,ceil(d/2)) Order by tuple(); insert into test.testy select 1, 33 n from numbers(1); SELECT count() FROM test.testy PREWHERE (n = 34); SELECT count() FROM test.testy PREWHERE (n = 34 and d>=1); SELECT count() FROM test.testy PREWHERE (n = 34 and d=1); select partition, rows from system.parts where active = 1 and table ='testy'
|
Changed the order of inserts: drop table test.testy; CREATE TABLE test.testy(d Int64, n Int64) ENGINE = MergeTree Partition by (ceil(d/2),n) Order by tuple(); insert into test.testy select 2, 33 n from numbers(10000000); SELECT count() FROM test.testy WHERE (n = 34 ); select partition, rows from system.parts where active = 1 and table ='testy'
optimize table test.testy; select partition, rows from system.parts where active = 1 and table ='testy'
SELECT count() FROM test.testy WHERE (n = 34 ); |
CH reads all partitions in some cases.
issue:
CREATE TABLE test.testy(d Date, n Int64, k Int64, arr Array(String))
ENGINE = MergeTree Partition by (n,toStartOfMonth(d)) Order by (k);
SELECT count() FROM test.testy PREWHERE (n = -1) AND (d >= '2018-05-01');
0 rows in set. Elapsed: 0.014 sec. Processed 14.68 million rows, 146.81 MB (1.05 billion rows/s., 10.55 GB/s.)
Key condition: unknown, unknown, and
MinMax index condition: (column 1 in [-1, -1]), (column 0 in [17652, +inf)), and
Selected 1 parts by date, 1 parts by key, 2433 marks to read from 1 ranges
Reading approx. 19931136 rows
If I change the order of inserts, then no issue?
SELECT count() FROM test.testy PREWHERE (n = -1) AND (d >= '2018-05-01');
0 rows in set. Elapsed: 0.002 sec.
Key condition: unknown, unknown, and
MinMax index condition: (column 1 in [-1, -1]), (column 0 in [17652, +inf)), and
Selected 0 parts by date, 0 parts by key, 0 marks to read from 0 ranges
The text was updated successfully, but these errors were encountered: