Last active
March 11, 2019 15:37
-
-
Save den-crane/e73c81c6b4725406a889c34042ddc67a to your computer and use it in GitHub Desktop.
CH-skip-index
This file contains hidden or 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
create table BX(I Int64, S String) Engine=MergeTree order by I; | |
insert into BX select number, toString(rand()) from numbers(10000000); | |
ALTER TABLE BX ADD INDEX idx0 S TYPE minmax GRANULARITY 10; | |
optimize table BX final; | |
select count() from BX prewhere S = '666'; | |
0 rows in set. Processed 10.00 million rows, | |
select count() from BX prewhere S = 'A'; | |
0 rows in set. Elapsed: 0.001 sec. | |
-------------------------------------- | |
CREATE TABLE X | |
( u64 UInt64, | |
t UInt64, | |
INDEX z t TYPE minmax GRANULARITY 3 | |
) | |
ENGINE = MergeTree() ORDER BY u64 | |
insert into X select number,number from numbers(1000000000); | |
select * from X where t=1000; | |
1 rows in set. Elapsed: 0.011 sec. Processed 24.58 thousand rows, | |
select * from X where t+0=1000; | |
1 rows in set. Elapsed: 6.482 sec. Processed 1.00 billion rows |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment