ClickHouse Cloud quick start

[Edit this page](https://github.com/ClickHouse/clickhouse-docs/blob/main/docs/getting-started/quick-start/cloud.mdx)

> The quickest and easiest way to get up and running with ClickHouse is to create a new
> service in [ClickHouse Cloud](https://console.clickhouse.cloud). In this quick start guide, we'll get you setup
> in three easy steps.

Create a ClickHouse service

## Create a ClickHouse service[​](#1-create-a-clickhouse-service "Direct link to Create a ClickHouse service")

To create a free ClickHouse service in [ClickHouse Cloud](https://console.clickhouse.cloud), you just need to sign up by completing the following steps:

- Create an account on the [sign-up page](https://console.clickhouse.cloud/signUp)
- You can choose to sign up using your email or via Google SSO, Microsoft SSO, AWS Marketplace, Google Cloud or Microsoft Azure
- If you sign up using an email and password, remember to verify your email address within the next 24h via the link you receive in your email
- Login using the username and password you just created

  

Once you're logged in, ClickHouse Cloud starts the onboarding wizard which walks you through creating a new ClickHouse service. Select your desired region for deploying the service, and give your new service a name:  

By default, new organizations are put on the Scale tier and will create 3 replicas each with 4 VCPUs and 16 GiB RAM. [Vertical autoscaling](/docs/cloud/features/autoscaling/vertical) will be enabled by default in the Scale tier. You can change your organization tier later on the 'Plans' page.

Customize the service resources if needed by specifying a minimum and maximum size for replicas to scale between. When ready, select `Create service`.  

Congratulations! Your ClickHouse Cloud service is up and running and onboarding is complete. Keep reading for details on how to start ingesting and querying your data.

Connect to ClickHouse

## Connect to ClickHouse[​](#2-connect-to-clickhouse "Direct link to Connect to ClickHouse")

There are 2 ways to connect to ClickHouse:

- Connect using our web-based SQL console
- Connect with your app

  

### Connect using SQL console[​](#connect-using-sql-console "Direct link to Connect using SQL console")

For getting started quickly, ClickHouse provides a web-based SQL console to which you will be redirected on completing onboarding.

Create a query tab and enter a simple query to verify that your connection is working:

```
SHOW databases
```

You should see 4 databases in the list, plus any that you may have added.  

That's it - you're ready to start using your new ClickHouse service!

### Connect with your app[​](#connect-with-your-app "Direct link to Connect with your app")

Press the connect button from the navigation menu. A modal will open offering the credentials to your service and offering you a set of instructions on how to connect with your interface or language clients.  

If you can't see your language client, you may want to check our list of [Integrations](/docs/integrations).

Add data

## Add data[​](#3-add-data "Direct link to Add data")

ClickHouse is better with data! There are multiple ways to add data and most of them are available on the Data Sources page, which can be accessed in the navigation menu.  

You can upload data using the following methods:

- Setup a ClickPipe to start ingesting data from data sources like S3, Postgres, Kafka, GCS
- Use the SQL console
- Use the ClickHouse client
- Upload a file - accepted formats include JSON, CSV and TSV
- Upload data from file URL

### ClickPipes[​](#clickpipes "Direct link to ClickPipes")

[ClickPipes](http://clickhouse.com/docs/integrations/clickpipes) is a managed integration platform that makes ingesting data from a diverse set of sources as simple as clicking a few buttons. Designed for the most demanding workloads, ClickPipes's robust and scalable architecture ensures consistent performance and reliability. ClickPipes can be used for long-term streaming needs or one-time data loading job.  

### Add data using the SQL Console[​](#add-data-using-the-sql-console "Direct link to Add data using the SQL Console")

Like most database management systems, ClickHouse logically groups tables into **databases**. Use the [`CREATE DATABASE`](/docs/sql-reference/statements/create/database) command to create a new database in ClickHouse:

```
CREATE DATABASE IF NOT EXISTS helloworld
```

Run the following command to create a table named `my_first_table` in the `helloworld` database:

```
CREATE TABLE helloworld.my_first_table
(
    user_id UInt32,
    message String,
    timestamp DateTime,
    metric Float32
)
ENGINE = MergeTree()
PRIMARY KEY (user_id, timestamp)
```

In the example above, `my_first_table` is a [`MergeTree`](/docs/engines/table-engines/mergetree-family/mergetree) table with four columns:

- `user_id`: a 32-bit unsigned integer ([UInt32](/docs/sql-reference/data-types/int-uint))
- `message`: a [String](/docs/sql-reference/data-types/string) data type, which replaces types like `VARCHAR`, `BLOB`, `CLOB` and others from other database systems
- `timestamp`: a [DateTime](/docs/sql-reference/data-types/datetime) value, which represents an instant in time
- `metric`: a 32-bit floating point number ([Float32](/docs/sql-reference/data-types/float))

Table engines

Table engines determine:

- How and where data is stored
- Which queries are supported
- Whether or not the data is replicated

  

There are many table engines to choose from, but for a simple table on a single-node ClickHouse server, [`MergeTree`](/docs/engines/table-engines/mergetree-family/mergetree) is your likely choice.

#### A Brief Intro to Primary Keys[​](#a-brief-intro-to-primary-keys "Direct link to A Brief Intro to Primary Keys")

Before you go any further, it is important to understand how primary keys work in ClickHouse (the implementation
of primary keys might seem unexpected!):

- primary keys in ClickHouse are ***not unique*** for each row in a table

The primary key of a ClickHouse table determines how the data is sorted when written to disk. Every 8,192 rows or 10MB of
data (referred to as the **index granularity**) creates an entry in the primary key index file. This granularity concept
creates a **sparse index** that can easily fit in memory, and the granules represent a stripe of the smallest amount of
column data that gets processed during `SELECT` queries.

The primary key can be defined using the `PRIMARY KEY` parameter. If you define a table without a `PRIMARY KEY` specified,
then the key becomes the tuple specified in the `ORDER BY` clause. If you specify both a `PRIMARY KEY` and an `ORDER BY`, the primary key must be a subset of the sort order.

The primary key is also the sorting key, which is a tuple of `(user_id, timestamp)`. Therefore, the data stored in each
column file will be sorted by `user_id`, then `timestamp`.

For a deep dive into core ClickHouse concepts, see ["Core Concepts"](/docs/managing-data/core-concepts).

#### Insert data into your table[​](#insert-data-into-your-table "Direct link to Insert data into your table")

You can use the familiar [`INSERT INTO TABLE`](/docs/sql-reference/statements/insert-into) command with ClickHouse, but it is important to understand that each insert into a [`MergeTree`](/docs/engines/table-engines/mergetree-family/mergetree) table causes a **part** to be created in storage.

ClickHouse best practice

Insert a large number of rows per batch - tens of thousands or even millions of
rows at once. Don't worry - ClickHouse can easily handle that type of volume - and it will [save you money](/docs/best-practices/selecting-an-insert-strategy#batch-inserts-if-synchronous) by sending fewer write requests to your service.

  

Even for a simple example, let's insert more than one row at a time: