mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-16 19:32:07 +00:00
Add a test
This commit is contained in:
parent
31de27b149
commit
d0d84a8401
@ -0,0 +1,18 @@
|
||||
100000
|
||||
14954
|
||||
798
|
||||
15908
|
||||
108
|
||||
120
|
||||
2334
|
||||
19
|
||||
Key size: 2400000
|
||||
100000
|
||||
14954
|
||||
798
|
||||
15907
|
||||
108
|
||||
120
|
||||
2334
|
||||
19
|
||||
Key size: 800008
|
33
tests/queries/0_stateless/02998_primary_key_skip_columns.sql
Normal file
33
tests/queries/0_stateless/02998_primary_key_skip_columns.sql
Normal file
@ -0,0 +1,33 @@
|
||||
DROP TABLE IF EXISTS test;
|
||||
|
||||
CREATE TABLE test (a UInt64, b UInt64, c UInt64) ENGINE = MergeTree ORDER BY (a, b, c) SETTINGS index_granularity = 1, primary_key_ratio_of_unique_prefix_values_to_skip_suffix_columns = 1;
|
||||
INSERT INTO test SELECT sipHash64(number, 1), sipHash64(number, 2), sipHash64(number, 3) FROM numbers(100000);
|
||||
|
||||
SELECT count() FROM test;
|
||||
SELECT count() FROM test WHERE a > 1849813033528774208 AND a < 4594276315503201760;
|
||||
SELECT count() FROM test WHERE b > 7898976344263989848 AND b < 8040320939819153137;
|
||||
SELECT count() FROM test WHERE c > 13239894303140990071 AND c < 16179795840886947236;
|
||||
SELECT count() FROM test WHERE a > 1849813033528774208 AND a < 4594276315503201760 AND b > 7898976344263989848 AND b < 8040320939819153137;
|
||||
SELECT count() FROM test WHERE b > 7898976344263989848 AND b < 8040320939819153137 AND c > 13239894303140990071 AND c < 16179795840886947236;
|
||||
SELECT count() FROM test WHERE a > 1849813033528774208 AND a < 4594276315503201760 AND c > 13239894303140990071 AND c < 16179795840886947236;
|
||||
SELECT count() FROM test WHERE a > 1849813033528774208 AND a < 4594276315503201760 AND b > 7898976344263989848 AND b < 8040320939819153137 AND c > 13239894303140990071 AND c < 16179795840886947236;
|
||||
|
||||
SELECT 'Key size: ', round(sum(primary_key_bytes_in_memory), -5) FROM system.parts WHERE database = currentDatabase() AND table = 'test';
|
||||
|
||||
ALTER TABLE test MODIFY SETTING primary_key_ratio_of_unique_prefix_values_to_skip_suffix_columns = 0.9;
|
||||
|
||||
DETACH TABLE test;
|
||||
ATTACH TABLE test;
|
||||
|
||||
SELECT count() FROM test;
|
||||
SELECT count() FROM test WHERE a > 1849813033528774208 AND a < 4594276315503201760;
|
||||
SELECT count() FROM test WHERE b > 7898976344263989848 AND b < 8040320939819153137;
|
||||
SELECT count() FROM test WHERE c > 13239894303140990071 AND c < 16179795840886947236;
|
||||
SELECT count() FROM test WHERE a > 1849813033528774208 AND a < 4594276315503201760 AND b > 7898976344263989848 AND b < 8040320939819153137;
|
||||
SELECT count() FROM test WHERE b > 7898976344263989848 AND b < 8040320939819153137 AND c > 13239894303140990071 AND c < 16179795840886947236;
|
||||
SELECT count() FROM test WHERE a > 1849813033528774208 AND a < 4594276315503201760 AND c > 13239894303140990071 AND c < 16179795840886947236;
|
||||
SELECT count() FROM test WHERE a > 1849813033528774208 AND a < 4594276315503201760 AND b > 7898976344263989848 AND b < 8040320939819153137 AND c > 13239894303140990071 AND c < 16179795840886947236;
|
||||
|
||||
SELECT 'Key size: ', round(sum(primary_key_bytes_in_memory), 5) FROM system.parts WHERE database = currentDatabase() AND table = 'test';
|
||||
|
||||
DROP TABLE test;
|
Loading…
Reference in New Issue
Block a user