CREATE TABLE wide_rows2(`A` Int64, `D` Date, `S` String)
ENGINE = MergeTree PARTITION BY toYYYYMM(D) ORDER BY A
settings merge_with_ttl_timeout=300, materialize_ttl_recalculate_only = 1;
insert into wide_rows2 select number, toDate('2020-01-01')+ number%20, arrayMap(i-> cityHash64((number*i)%999), range(2000)) from numbers(1e5);
insert into wide_rows2 select number, toDate('2020-01-01')+ number%20, arrayMap(i-> cityHash64((number*i)%899), range(2000)) from numbers(1e5);
insert into wide_rows2 select number, toDate('2020-01-01')+ number%20, arrayMap(i-> cityHash64((number*i)%799), range(2000)) from numbers(1e5);
insert into wide_rows2 select number, toDate('2020-01-01')+ number%20, arrayMap(i-> cityHash64((number*i)%699), range(2000)) from numbers(1e5);
set materialize_ttl_after_modify=0;
π
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 t | |
( | |
key_zstd1 Int64 CODEC(ZSTD(1)), | |
key_lz4 Int64 CODEC(LZ4), | |
key_t64_zstd Int64 CODEC(T64,ZSTD(1)), | |
key_int8 Int8 CODEC(ZSTD(1)), | |
r Int32 | |
) | |
ENGINE = MergeTree | |
ORDER BY (key_zstd1, r); |
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 x (a Int64, b Int64, c Int64, | |
u AggregateFunction(uniqHLL12, String), | |
t AggregateFunction(uniqTheta, String)) | |
Engine=MergeTree order by (a,b,c); | |
insert into x select number%11111 a, number%44 b, number%3 c, uniqHLL12State(number::String), uniqThetaState(number::String) | |
from numbers(1e7) group by a,b,c; | |
optimize table x final; |
CH 1-node
SELECT
count(),
min(paramkey),
max(paramkey),
min(ind),
max(ind)
FROM data_table
ββββcount()ββ¬ββββββββmin(paramkey)ββ¬βββββββmax(paramkey)ββ¬βmin(ind)ββ¬ββmax(ind)ββ
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
https://github.com/ClickHouse/ClickHouse/issues/47092#issuecomment-1485052499 | |
23.3.8.21 | |
<default> | |
<access_management>1</access_management> | |
</default> | |
create user foo; | |
grant all on *.* to foo; |
create table test(tenant_id UInt32, ts1 DateTime, timestamp DateTime)
engine=MergeTree
partition by toDate(ts1)
PRIMARY KEY (tenant_id, toStartOfHour(timestamp))
ORDER BY (tenant_id, toStartOfHour(timestamp), timestamp)
as select 1, now() - number/10 x, x from numbers(1e8);
insert into test select number%1000, now() - number/10 x, 0 from numbers(1e8);
create database test on cluster '{cluster}' Engine=Ordinary;
create table test.test on cluster '{cluster}' (A Int64)
Engine = ReplicatedMergeTree('/clickhouse/{cluster}/tables/{database}/{table}', '{replica}') order by A;
create table test.test_b on cluster '{cluster}' as test.test
Engine = Buffer(test, test, 1, 1, 2, 10, 100, 10000000, 100000000);
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 idx( A Int64, D Date) Engine=MergeTree order by A partition by D; | |
insert into idx select number, today() from numbers(1e8); | |
insert into idx select number, today()-1 from numbers(1e8); | |
select sum(primary_key_bytes_in_memory), sum(primary_key_bytes_in_memory_allocated) | |
from system.parts where table = 'idx' and active; | |
ββsum(primary_key_bytes_in_memory)ββ¬βsum(primary_key_bytes_in_memory_allocated)ββ | |
β 195360 β 264192 β | |
ββββββββββββββββββββββββββββββββββββ΄βββββββββββββββββββββββββββββββββββββββββββββ |