Intro to Clickhouse
What is Clickhouse
Clickhouse is column database.
Clickhouse is Online Analytical Processing (OLAP) Database.
Usually use for analytics and logging monitoring.
Syntax feels similar to Relational Databases like PostgreSQL and MySQL.
Main feature is able to analyze millions of data in seconds.
Main feature is able to analyze millions of data in seconds.
If not specify engine will default to MergeTree.
It is normal to have duplicate primary keys.
How to install Clickhouse
brew install clickhouse/clickhouse/clickhouse
Start Clickhouse service
brew services start clickhouse
Enter Clickhouse CLI
clickhouse client
Create database
CREATE DATABASE IF NOT EXISTS learning
Use created database
use learning
Create table
create table messages (id UInt32, timestamp DateTime, message String) ENGINE = MergeTree PRIMARY KEY id
Show tables
show tables
Insert data into table
INSERT INTO messages VALUES (1, now(), 'Message #1'), (2, now(), 'Message #2'), (3, now(), 'Message #3')
Drop table
drop table messages