Skip to main content
Skip to main content

ClickHouse Quick Start

Tip

This page helps you set up open-source ClickHouse on your own machine. The fastest way to deploy ClickHouse and to get access to our exclusive SQL Console is to use ClickHouse Cloud.

New users get $300 in free trial credits. Click here to sign up.

1. Download the binary

ClickHouse runs natively on Linux, FreeBSD and macOS, and runs on Windows via the WSL. The simplest way to download ClickHouse locally is to run the following curl command. It determines if your operating system is supported, then downloads an appropriate ClickHouse binary:

Note

For Mac users: If you are getting errors that the developer of the binary cannot be verified, please see here.

2. Start the server

Run the following command to start the ClickHouse server:

3. Start the client

Use the clickhouse-client to connect to your ClickHouse service. Open a new Terminal, change directories to where your clickhouse binary is saved, and run the following command:

You should see a smiling face as it connects to your service running on localhost:

4. Create a table

Use CREATE TABLE to define a new table. Typical SQL DDL commands work in ClickHouse with one addition - tables in ClickHouse require an ENGINE clause. Use MergeTree to take advantage of the performance benefits of ClickHouse:

5. Insert data

You can use the familiar INSERT INTO TABLE command with ClickHouse, but it is important to understand that each insert into a MergeTree table causes a part (folder) to be created in storage. To minimize parts, bulk insert lots of rows at a time (tens of thousands or even millions at once).

6. Query your new table

You can write a SELECT query just like you would with any SQL database:

Notice the response comes back in a nice table format:

7. Insert your own data

The next step is to get your current data into ClickHouse. We have lots of table functions and integrations for ingesting data. We have some examples in the tabs below, or check out our Integrations for a long list of technologies that integrate with ClickHouse.

Use the s3 table function to read files from S3. It's a table function - meaning that the result is a table that can be:

  1. used as the source of a SELECT query (allowing you to run ad-hoc queries and leave your data in S3), or...
  2. insert the resulting table into a MergeTree table (when you are ready to move your data into ClickHouse)

An ad-hoc query looks like:

Moving the data into a ClickHouse table looks like the following, where nyc_taxi is a MergeTree table:

View our collection of AWS S3 documentation pages for lots more details and examples of using S3 with ClickHouse.

What's Next?