9951 explained code solutions for 126 technologies

clickhouseCreate MergeTree table

CREATE TABLE tbl (event String, ts DateTime, val Int64) ENGINE = MergeTree PARTITION BY toYYYYMMDD(ts) ORDER BY (event, ts);ctrl + c

name of the table to create (e.g. table to store events)

(event String, ts DateTime, val Int64

columns declaration


engine definition


data will be partitioned by days (e.g. each day will represent it's own partition)

ORDER BY (event, ts)

these columns pair will be used as primary key (thus, making read access faster when specifying them is select query)