Created
February 14, 2023 19:01
-
-
Save den-crane/9bb45d391313cf5580c050dd83bf5764 to your computer and use it in GitHub Desktop.
primary key is loaded on Clickhouse start
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 │ | |
└──────────────────────────────────┴────────────────────────────────────────────┘ | |
detach table idx; | |
attach table idx; | |
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 │ | |
└──────────────────────────────────┴────────────────────────────────────────────┘ | |
systemctl restart clickhouse-server | |
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 │ | |
└──────────────────────────────────┴────────────────────────────────────────────┘ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment