# ClickHouse vs BigQuery for Analytics: Cost, Speed and When to Use Each

> Compare ClickHouse and BigQuery on pricing, speed, data modeling and CDC, with a worked cost example for a dashboard on a 1 TB table.

Source: https://www.erathos.com/en/blog/clickhouse-vs-bigquery
Em português: https://www.erathos.com/blog/clickhouse-vs-bigquery
Published: 2026-11-20
Category: Tool Guides

![ClickHouse vs BigQuery for Analytics](https://cms-media.erathos.com/ClickHouse vs BigQuery for Analytics.png)

A dashboard that updates every 5 minutes can feel cheap up to the point of getting the BigQuery bill – every update triggers a new query, and on-demand pricing means every query is paid for based on the data it reads. At the other extreme, teams that show charts to their product users often want results in sub-second times, with many users at once. Such a warehouse can feel slow if it responds in seconds.

ClickHouse can enter the picture at this point – both systems are [columnar analytical databases](https://www.erathos.com/en/blog/olap-vs-oltp-analytics-vs-transaction-databases?utm_source=blog&utm_medium=organic&utm_content=bydefault&utm_campaign=clickhouse-vs-bigquery) that support SQL queries on billions of rows. They have different focuses, however: BigQuery is good at running ad-hoc queries on many tables with no servers to maintain. ClickHouse is good for running fast, repeated queries on fresh event data, and lets you choose and pay for the machines yourself.

## BigQuery and ClickHouse in one paragraph each

**BigQuery**: This is Google Cloud’s serverless data warehouse. All the underlying infrastructure is [handled](https://cloud.google.com/bigquery/docs/introduction) for the user, meaning they just need to load data and write SQL. BigQuery is priced either based on the number of tebibytes (TiB, i.e. 1,024 GiB) of data scanned by queries or based on compute capacity hours (so-called slots). According to Google, BigQuery can “query terabytes in seconds and petabytes in minutes.”

**ClickHouse**: This is an open-source columnar database that is licensed under the [Apache 2.0 license](https://raw.githubusercontent.com/ClickHouse/ClickHouse/master/LICENSE). Users can run the database on their own servers or use ClickHouse Cloud, ClickHouse Inc.’s managed service. ClickHouse Cloud pricing is based on the compute used per hour and the storage used per compressed terabyte of data. ClickHouse is commonly used for product dashboards, logs, metrics, and other event data, where data is continuously written and low-latency queries are expected.

## Architecture: serverless slots vs a database you design

Both engines have separate storage and compute.

In BigQuery, there is a storage layer which stores tables in a columnar format and a compute layer which executes queries. The two components [operate independently of each other](https://cloud.google.com/bigquery/docs/introduction) over Google’s internal network. Compute is measured in slots, which are virtual compute units. When you submit a query, BigQuery will break the query down into small units of work and distribute the units of work to be performed across the slots. Under on-demand pricing, a project can use up to 2,000 slots at any one time, shared across all queries running in that project.

The “serverless” nature of BigQuery means that you do not select the size of the machine you use, and [cannot manually adjust the number of slots](https://cloud.google.com/bigquery/docs/slots) used for each query. In high-demand scenarios, if the number of units of work exceeds the number of slots, the work waits in a queue. Whilst BigQuery does not charge for wait time, it results in longer query times. On-demand and Standard edition queries are more likely to end up in a queue during peak loads than queries running in Enterprise projects with reserved slots.

The path of a BigQuery query is depicted below:

ClickHouse Cloud also has separate storage and compute components. Your data is stored in object storage like Amazon S3 or Google Cloud Storage, through a table engine called [SharedMergeTree](https://clickhouse.com/docs/products/cloud/features/infrastructure/shared-merge-tree). A service is a set of compute replicas (servers) used to read and write data. You determine the size of the replicas, and there can be hundreds of replicas for a table without the need to split data into shards.

In the Scale and Enterprise plans, multiple services can [share the same data](https://clickhouse.com/docs/cloud/reference/warehouses). Replicas and endpoints are specific to a service, meaning that high load jobs won’t degrade the performance of the service powering your dashboards. Services in the Basic plan are of a fixed size, whereas services in the Scale and Enterprise plans scale up and down automatically.

This is what the ClickHouse Cloud architecture looks like:

Self-hosted ClickHouse works differently: you run your own servers, replication, and upgrades using the open source ReplicatedMergeTree engines, which SharedMergeTree replaces in the cloud.

The practical split looks like this:

Option

Who sizes compute

Where data lives

Day-to-day work

BigQuery

Google (on-demand) or you, in slots (editions)

Google's managed storage

Watch bytes scanned and slot use

ClickHouse Cloud

You, in compute units

Object storage (S3, GCS, Azure Blob)

Pick service size, design tables

ClickHouse self-hosted

You, in servers

Disks on servers you run

Everything, including upgrades and backups

## How BigQuery and ClickHouse pricing works

The pricing models of the two services are different; BigQuery on-demand pricing is based on bytes read, while ClickHouse Cloud charges per hour of compute, regardless of the number of queries. All prices are current as of October 23, 2026, for Google’s US region (us-central1) and AWS us-east-1 on ClickHouse Cloud. Prices for both vendors vary by region.

### BigQuery

BigQuery has two ways to pay for queries, plus a separate storage bill. These are the [published BigQuery prices](https://cloud.google.com/bigquery/pricing):

BigQuery meter

Price

What to know

On-demand queries

$6.25 per TiB read

First 1 TiB per month is free. Minimum 10 MB per table and per query.

Standard edition

$0.04 per slot-hour

Pay as you go only. Billed per second, with a one-minute minimum.

Enterprise edition

$0.06 per slot-hour

$0.054 with a 1-year plan, $0.048 with 3 years.

Enterprise Plus edition

$0.10 per slot-hour

$0.09 with a 1-year plan, $0.08 with 3 years.

Active logical storage

$0.000031507 per GiB-hour

About $23.55 for 1 TiB for a full month. First 10 GiB free.

Long-term logical storage

$0.000021918 per GiB-hour

Applies to data nobody changed for 90 days.

BI Engine (in-memory cache)

$0.0416 per GiB-hour

Optional layer that speeds up dashboard queries.

On-demand pricing models have some specific rules, such as:

- BigQuery bills for all columns that are selected even if you have applied a LIMIT clause
- Failed queries, and results retrieved from cache are free of charge
- Free data ingestion for batch loading, while streaming rows with the Storage Write API is $0.025 per GiB after the first 2 TiB of data per month

For autoscaling-based Editions, the capacity is provisioned in blocks of 50 slots. BigQuery charges you [not based on the slots you used but those scaled up to](https://cloud.google.com/bigquery/docs/slots) and these are held for a minimum of 60 seconds. In the case of Enterprise and Enterprise Plus Editions, commitments for slots must be at least 50 slots. We have a dedicated guide to [BigQuery cost optimization](https://www.erathos.com/en/blog/bigquery-cost-optimization?utm_source=blog&utm_medium=organic&utm_content=bydefault&utm_campaign=clickhouse-vs-bigquery) that goes through the different pricing models.

### ClickHouse Cloud

ClickHouse Cloud bills compute in units. One unit is 8 GiB of RAM and 2 vCPUs, metered by the minute. These are the [published ClickHouse Cloud prices](https://clickhouse.com/pricing) on AWS us-east-1:

Plan

Compute per unit-hour

Storage per TB-month

What you get

Basic

$0.2181

$25.30

Up to 1 TB of storage, 8 to 12 GiB of memory, one availability zone, daily backups

Scale

$0.2985

$25.30

Unlimited storage, automatic scaling, separate services on the same data, 2+ zones

Enterprise

$0.3903

$25.30

Everything in Scale plus SSO and compliance features like HIPAA and PCI

Storage is billed based on compressed storage for data and backups. ClickHouse states that analytical data typically achieves a 10x compression ratio – meaning 1 TB of raw data typically leads to 100 GB of billed storage. This will vary depending on your data and the structure of your tables.

A service can also pause if no one is querying it. You don't pay any compute cost while the service is paused. Paused services need to wake up before they can serve queries, which can cause connection timeouts. ClickHouse [doesn't recommend idling](https://clickhouse.com/docs/products/cloud/features/autoscaling/idling) for customer-facing features with high usage. Data outbound to the internet costs $0.1152+ per GB and data inbound is free.

### Self-hosted ClickHouse

Free under Apache 2.0. You pay for your servers, your disks and the engineer time it takes to do upgrades, backups, and replication. This cost is not published and is based on your cloud or hardware and your team.

## Worked example: a 1 TB events table behind a 5-minute dashboard

Let’s try pricing out one workload on both engines. The numbers are our own math from the published prices above, so you can swap in your own.

Assumptions:

- The raw size of the events table is 1 TiB, and covers 365 days. We’re going with TiB because BigQuery charges in TiB.
- Events arrive throughout the day, and so the table changes between refreshes.
- There is one chart in a dashboard that is refreshed every 5 minutes throughout the day, every day in a 30-day month. This is one query.
- The chart only shows today’s data. This table is partitioned by day on BigQuery, and so we’re reading one day, i.e. 1/365 of the table.
- A month is 730 hours for always-on compute.
- ClickHouse data compression is 10 times, the typical ratio they quote. Let’s assume that one small service is fast enough to handle this query load. This is something we did not test, so consider it an assumption to check.

### BigQuery on-demand

1. Refreshes per month: 30 days × 24 hours × 12 per hour = 8,640 queries
2. Data processed per query: 1,024 GiB ÷ 365 days = 2.81 GiB
3. Total data processed per month: 8,640 × 2.81 GiB = 23.67 TiB
4. Cost of queries: (23.67 TiB − 1 free TiB) × $6.25 = $141.70
5. Cost of storing 1 TiB of active logical storage: $23.55
6. Total estimated cost per month: **$165**

Now imagine running that same query without the partition filter. Each query would result in a full table scan, and BigQuery charges for all the data each query reads. In that scenario, step 4 above would balloon to (8,640 − 1) × $6.25 = $53,993.75 per month. Clearly, partitioning makes a big difference.

And if you’re wondering why caching isn’t saving us here, BigQuery will [skip the cache](https://cloud.google.com/bigquery/docs/cached-results) when one of its underlying tables has been updated, when the table has recent streaming inserts, or when the query itself has a function like `CURRENT_TIMESTAMP()`. Because our table is constantly being updated throughout the day, each refresh results in a full-priced query.

### BigQuery Standard edition with autoscaling

1. Minimum step is 50 slots, which is what we need to scale up to per refresh.
2. BigQuery charges for at least one minute of usage: 50 slots × $0.04 ÷ 60 = $0.0333 per refresh.
3. Cost of queries: 8,640 × $0.0333 = $288.
4. Total cost of the solution including storage: about **$312 per month**.

The calculation assumes each query finishes within a minute and refreshes do not overlap. Google’s own docs advise against running queries one at a time for this reason: each query keeps the reservation scaled up for a one-minute minimum.

### ClickHouse Cloud

1. Basic plan, one compute unit, running the entire month: $0.2181 × 730 = $159.21.
2. Storage, 1 TiB is 1.1 TB, 10x compressed to 0.11 TB × $25.30 = $2.78.
3. Total: about **$162 per month**.

Since the Basic plan is single availability zone, a real production dashboard should run on the Scale plan. Three replicas with one compute unit each (as the ClickHouse pricing calculator recommends for real-time analytics): 3 × $0.2985 × 730 = $653.72, and storage adds up to about **$657 per month**.

The monthly totals side by side, including the 5-chart case from the next section:

### What swings the result

The table is about the same size in both cases. What changes the bill is how often people query it and how much each query reads:

- **Number of charts.** A dashboard with 5 charts runs 5 queries per refresh. On BigQuery on-demand that is 5 × 23.67 TiB = 118.36 TiB a month, about $757 with storage. ClickHouse's bill stays the same until the service runs out of capacity.
- **How fresh the data is.** If you load data once an hour in batches and the query text never changes, 11 of every 12 refreshes can come from BigQuery's free cache. The query bill drops to about $6.
- **How many users.** BigQuery runs each user's query separately. Sharing cached results between users needs Enterprise or Enterprise Plus.
- **Idle hours.** If the dashboard is only used during the workday, a ClickHouse service that pauses at night costs less. That only works for internal dashboards that can wait for a cold start.

BigQuery on-demand is cheap for a few well-pruned queries. ClickHouse is more cost-effective as the number of queries increases, because you pay for the hours of compute and not per read.

## Is ClickHouse faster than BigQuery?

In general, yes, the kind of queries that dashboards run (filters, totals over a big table) are typically faster on ClickHouse. In the October 2026 results of ClickBench, a public benchmark run by ClickHouse, most ClickHouse Cloud deployments could run the benchmark's queries several times faster than BigQuery, with only the smallest ClickHouse services trailing.

[ClickBench](https://benchmark.clickhouse.com/) runs 43 queries against one wide table of web traffic data and scores each system by its time compared with the fastest one. Lower is better. These are a few of the combined scores:

System

Setup

Result date

Relative time

ClickHouse Cloud (AWS)

1 replica, 236 GiB

2026-10-22

×3.77

ClickHouse Cloud (AWS)

3 replicas, 32 GiB each

2026-10-22

×8.31

ClickHouse Cloud (AWS)

1 replica, 16 GiB

2026-10-22

×15.39

BigQuery

Serverless

2025-10-28

×24.51

ClickHouse Cloud (AWS)

1 replica, 8 GiB

2026-10-22

×30.16

These numbers need to be interpreted with caution. The benchmark is run by ClickHouse, and tests a single table with no joins, which is exactly the kind of query ClickHouse is designed for. The BigQuery number is a year older than the ClickHouse ones. However, note that the smallest ClickHouse service (the size we used for our cost example) was actually slower than BigQuery. Faster performance with ClickHouse comes at the cost of compute units.

### Where ClickHouse is fast

ClickHouse tables are sorted by the columns specified in the ORDER BY clause. Each table has an index which contains one entry per [block of 8,192 rows](https://clickhouse.com/docs/engines/table-engines/mergetree-family/mergetree). This block is called a granule. If a query filters on those columns, ClickHouse will skip any granule which cannot match. This allows ClickHouse to read a small part of a table. Additionally, because each query reads the set of data parts which existed when the query started, new inserts do not block reads.

This makes ClickHouse great for:

- Dashboards integrated into your application. If you have many users viewing dashboards at the same time, ClickHouse can scale to handle that traffic.
- Logs, metrics and event streams. These arrive all day and get queried right away.
- Repeated queries with the same filters. This scenario is common for example when a customer wants to see their activity over the last week.

As your user base increases, you can scale the service by adding replicas.

### Where BigQuery is fast

BigQuery uses different data structures: it reads the columns used in the query and can skip reading partitions and even clustered blocks within partitions when it knows they won't match. It can handle large and unexpected queries well, because it can use up to 2000 slots per project on-demand without you sizing them.

Joins are the clearest difference: ClickHouse's default join algorithm builds the right side of the join [in memory](https://clickhouse.com/docs/sql-reference/statements/select/join) and happens before the WHERE filter, and it won't reorder joins for you. For small dimension tables, ClickHouse recommends using dictionaries instead of tables, which are lookup tables kept in memory. This means a query with many large tables joined together requires more careful planning to make sure it will run on ClickHouse. In BigQuery, because the query is spread across slots, you don't size its memory explicitly.

For dashboards, BigQuery offers [BI Engine](https://cloud.google.com/bigquery/docs/bi-engine-intro), which adds an in-memory cache in front of BigQuery tables, optimized for pre-joined or pre-aggregated data, with up to four small dimension tables of up to 5 million rows each. When a project is busy, BigQuery queues queries up to 1000 queued interactive queries per project, which is much better than failing the query.

## Data modeling: ordering keys vs partitioning and clustering

BigQuery can load a table as it is and you can start to query it the same day, partition it, cluster it and save money and time but it’ll still work with default settings. ClickHouse table design decides the majority of the performance so it’s something you plan before you load data.

### ClickHouse: pick an engine and an ORDER BY

Every ClickHouse table has a table engine. Most analytical tables will use a table engine from the MergeTree family. Some common MergeTree table engines include:

- MergeTree stores rows sorted by ORDER BY, and merges small parts into larger parts in the background.
- ReplacingMergeTree is the ClickHouse recommended table engine when you are updating large amounts of data, as it keeps the latest version of rows for rows with the same ORDER BY values.
- SummingMergeTree and AggregatingMergeTree can be used to merge rows into running totals.
- CollapsingMergeTree can be used to cancel out rows using a sign column, which can be useful when you need to be able to undo changes.

The ORDER BY is the most important choice. Put the columns your queries filter on most at the front. Here is an events table sorted by customer, then event type, then time, with 1,000,000 generated rows and a query for one customer:

`CREATE TABLE events`
`(`
`    event_date Date,`
`    customer_id UInt32,`
`    event_type LowCardinality(String),`
`    ts DateTime`
`)`
`ENGINE = MergeTree`
`PARTITION BY toYYYYMM(event_date)`
`ORDER BY (customer_id, event_type, ts);`

`INSERT INTO events`
`SELECT`
`    toDate('2026-01-01'),`
`    number % 1000,`
`    ['click', 'purchase', 'view'][1 + intDiv(number, 1000) % 3],`
`    toDateTime('2026-01-01 00:00:00') + number`
`FROM numbers(1000000);`

`EXPLAIN indexes = 1`
`SELECT event_type, count()`
`FROM events`
`WHERE customer_id = 42`
`GROUP BY event_type`
`ORDER BY event_type;`

The primary key part of the plan, from `clickhouse local`:

`          PrimaryKey`
`             Keys:`
`               customer_id`
`             Condition: (customer_id in [42, 42])`
`             Parts: 1/1`
`             Granules: 1/123`
`             Search Algorithm: binary search`
`           Ranges: 1`

This ClickHouse query scans 1 out of 123 granules, and skips the other 122. If we changed this query to filter only on some column not in the ORDER BY, the index wouldn't help.

There is another concept in ClickHouse called partitions, which are distinct from BigQuery partitions: ClickHouse [says](https://clickhouse.com/docs/engines/table-engines/mergetree-family/mergetree) that in most cases, you don't need a partition key, and rarely one finer than a month. Partitioning is not useful for query performance in the same way that ORDER BY is, and its main use is for dropping old data.

ClickHouse also advocates for wide flat tables; see its [denormalization guide](https://clickhouse.com/docs/data-modeling/denormalization), which basically advocates moving joins from query time to insert time, so that your dashboards only query one table. It says not to use this approach for frequently changing data. There are other tools for improving performance: incremental materialized views can be used to incrementally transform rows on insert into something like hourly totals, and projections can be used to store data in a table sorted differently as a second copy in the table (and ClickHouse will use it automatically).

### BigQuery: partition, then cluster

BigQuery keeps the design simpler:

- **Partitioning**: This can split a table based on a date/timestamp column, load time, or integer ranges. BigQuery tables can have [up to 10,000 partitions](https://cloud.google.com/bigquery/quotas). BigQuery only allows partitioning based on a single column. This means any queries that filter on the column will skip other partitions, and BigQuery will not charge for them.
- **Clustering**: This sorts data in the table based on [up to four columns](https://cloud.google.com/bigquery/docs/clustered-tables). The order of the columns is important, similar to ClickHouse. BigQuery reclusters in the background for free.
- **Require partition filter**: This table option makes BigQuery reject queries that do not have a partition filter. This is the option that protects you from the $54,000 full-scan month in our cost example.

Two gotchas to watch out for:

- You can't turn an existing table into a partitioned table in place, so you have to recreate it.
- On a clustered table, BigQuery can't provide the exact cost in the dry run. BigQuery only knows what blocks can be skipped once the query runs.

## Updates, deletes and CDC

Analytics data typically originates in a production database, where the rows in the database are changing over time. For example, an order might change from “pending” to “shipped”, or a customer might delete their account. These changes are replicated into the warehouse using CDC (change data capture), i.e. replicating the inserts, updates, and deletes, so that the analytics copy matches the source. This is hard to do well, and different analytics engines handle updates to existing rows in different ways.

### BigQuery: UPDATE, DELETE and MERGE

The standard UPDATE, DELETE and MERGE statements are available in BigQuery. MERGE combines inserts, updates and deletes into a single statement. In terms of transaction support, [each statement runs and commits as its own transaction](https://cloud.google.com/bigquery/docs/data-manipulation-language). This enables typical CDC behavior by first inserting a batch of changes into a staging table, and then performing a MERGE onto the main table.

Up to 2 concurrent statements can be running on the same table with BigQuery, and up to 20 statements can be queued on the same table. Further statements fail with a “Too many DML statements outstanding” error, which means BigQuery CDC is better handled in batches of statements (e.g. running a MERGE every few minutes) instead of running individual statements for each row changed.

BigQuery also has [built-in CDC ingestion](https://cloud.google.com/bigquery/docs/change-data-capture) through the Storage Write API, which requires the table to have a primary key (max 16 columns) declared, and each row streamed into the table to have a change type (e.g. `UPSERT` or `DELETE`). This is automatically handled by BigQuery itself. A guide to setting up [MySQL CDC into BigQuery](https://www.erathos.com/en/blog/mysql-cdc-to-bigquery?utm_source=blog&utm_medium=organic&utm_content=bydefault&utm_campaign=clickhouse-vs-bigquery) can be found here.

### ClickHouse: write new versions, let merges clean up

ClickHouse is [built for read-heavy analytics and for adding new rows](https://clickhouse.com/docs/updating-data/overview). It has three ways to change data:

Method

How it works

Good for

ReplacingMergeTree

Insert a new version of the row; background merges keep the latest

Steady streams of updates and deletes, like CDC

Lightweight UPDATE

Writes small patch parts that queries apply on read

Small, frequent changes, about 0.1% to 10% of rows

Mutation (ALTER TABLE ... UPDATE)

Rewrites every data part with a matching row

Rare bulk fixes; heavy on disk and slows queries

For a steady stream of updates and deletes, ClickHouse suggests a special engine like ReplacingMergeTree. Every change from the source becomes a new row with a version column, and a deleted row gets a delete flag. Here is an orders table where order 1 gets shipped and order 2 gets deleted:

`CREATE TABLE orders`
`(`
`    id UInt64,`
`    status String,`
`    amount Decimal(10,2),`
`    updated_at DateTime,`
`    is_deleted UInt8`
`)`
`ENGINE = ReplacingMergeTree(updated_at, is_deleted)`
`ORDER BY id;`

`SYSTEM STOP MERGES orders;`

`INSERT INTO orders VALUES`
`    (1, 'pending', 100.00, '2026-01-01 10:00:00', 0),`
`    (2, 'pending', 50.00, '2026-01-01 10:00:00', 0);`

`INSERT INTO orders VALUES`
`    (1, 'shipped', 100.00, '2026-01-01 11:00:00', 0);`

`INSERT INTO orders VALUES`
`    (2, 'pending', 50.00, '2026-01-01 11:00:00', 1);`

`SELECT * FROM orders ORDER BY id, updated_at;`

`SELECT * FROM orders FINAL ORDER BY id;`

We stop merges in the example so both reads show what happens before ClickHouse cleans up. This is the output, with the plain read first and the FINAL read on the last line:

`1	pending	100	2026-01-01 10:00:00	0`
`1	shipped	100	2026-01-01 11:00:00	0`
`2	pending	50	2026-01-01 10:00:00	0`
`2	pending	50	2026-01-01 11:00:00	1`
`1	shipped	100	2026-01-01 11:00:00	0`

The first query (without FINAL) returns all 4 versions of the order. The second (with FINAL) returns only the one that was shipped, and the deleted order is completely gone. Older versions are deleted during background merges, but since there is no way to control when this happens, any query that needs exact results must use FINAL, or GROUP BY on the last version of the order, which results in slightly lower performance on each read.

For CDC, BigQuery gives exact tables with MERGE but it’s done in batches. ClickHouse processes new data as soon as it’s inserted, but then each query needs to take versioning into account.

## Ecosystem: BI tools, dbt and SQL dialect

BigQuery is better-integrated with tooling. Google also develops Looker and Looker Studio. Most of the same tools also work with ClickHouse, but with some rough edges.

### BI tools

In the BigQuery world, [BI Engine works with](https://cloud.google.com/bigquery/docs/bi-engine-intro) Looker, Looker Studio, Tableau and Power BI. ClickHouse has [integrations for](https://clickhouse.com/docs/integrations) Looker Studio, Power BI, Superset, Tableau, Grafana, Looker, Metabase, Amazon QuickSight, Hex, Lightdash and Sigma. Seeing Grafana in the list of integrations with ClickHouse is a sign of ClickHouse’s strength in handling logs and metrics.

Make sure to look at how each tool works in practice; the ClickHouse [Looker integration](https://clickhouse.com/docs/integrations/looker) is a partner integration and treats arrays, decimals, UUIDs, JSON and some other types as strings by default. This integration also doesn’t support symmetric aggregates and full outer joins yet.

### dbt

Both integrate with dbt. The BigQuery adapter supports service accounts, OAuth and Workload Identity Federation for authenticating. The ClickHouse adapter built into dbt v2 is [still in beta](https://docs.getdbt.com/docs/local/connect-data-platform/clickhouse-setup) and dbt itself suggests not using it in production for the time being. On dbt v1, the `dbt-clickhouse` adapter is more featureful. Since there is no schema level in ClickHouse, a dbt schema maps to a ClickHouse database.

### SQL dialect

BigQuery relies on GoogleSQL, while ClickHouse has its own SQL dialect. Here are some of the most common [differences](https://clickhouse.com/docs/sql-reference/syntax) ClickHouse newcomers run into:

- **Functions are case-sensitive**: While standard SQL keywords (e.g. SELECT) are case-insensitive, most ClickHouse functions must be spelled exactly (e.g. `toStartOfHour`).
- **Strings are only single-quoted**: Double quotes are not supported for string literals.
- **LEFT JOIN fills with default values instead of NULL**: When there's no matching row in ClickHouse, 0 or empty string is returned, not NULL. To get standard SQL behavior, set `join_use_nulls = 1`.
- **Table names are shorter**: While BigQuery uses `project.dataset.table` inside backticks, ClickHouse uses `database.table` instead.

The LEFT JOIN default is the one to watch when you move a dbt project over. A query that checks `IS NULL` to find unmatched rows finds nothing on ClickHouse, and no error tells you. Here, Bob has no orders:

`CREATE TABLE customers (id UInt32, name String) ENGINE = Memory;`
`CREATE TABLE orders (customer_id UInt32, amount UInt32) ENGINE = Memory;`

`INSERT INTO customers VALUES (1, 'Alice'), (2, 'Bob');`
`INSERT INTO orders VALUES (1, 100);`

`SELECT c.id, o.amount`
`FROM customers c`
`LEFT JOIN orders o ON c.id = o.customer_id`
`ORDER BY c.id;`

`SELECT count()`
`FROM customers c`
`LEFT JOIN orders o ON c.id = o.customer_id`
`WHERE o.amount IS NULL;`

`SELECT count()`
`FROM customers c`
`LEFT JOIN orders o ON c.id = o.customer_id`
`WHERE o.amount IS NULL`
`SETTINGS join_use_nulls = 1;`

The output from `clickhouse local`:

`1	100`
`2	0`
`0`
`1`

For Bob we get 0 as amount, so the default count of customers without orders is 0, while with `join_use_nulls = 1` it would be 1, i.e. how BigQuery would do it.

## Which should you choose?

BigQuery is suitable for ad-hoc analytical queries on multiple tables where no server-management is required. ClickHouse is suitable for repetitive queries on newly arrived event-data that are expected to provide fast answers to numerous users.

Workload

Team

Budget

Recommended

Ad hoc analysis across many tables

Small data team, no infrastructure people

Pay only for what you use

BigQuery on-demand, with partitioned tables

Company BI in Looker or Looker Studio

Any size, already on Google Cloud

Predictable monthly bill

BigQuery, on editions once on-demand gets expensive

Charts inside your product for customers

Engineers who can design tables

Fixed compute cost

ClickHouse Cloud, Scale plan

Logs, metrics and event streams queried right away

Engineers or platform team

High query volume, flat cost

ClickHouse Cloud

One internal dashboard on one big table

Small team

Under a few hundred dollars a month

Run the numbers from the cost example; both fit

Copies of production databases with many updates

Small data team

Any

BigQuery, because MERGE keeps tables exact without FINAL

Very high volume with your own servers

Strong infrastructure team

Lowest software cost

Self-hosted ClickHouse

You don't need to choose between BigQuery and ClickHouse, you can use BigQuery for your analysts and ClickHouse for your product dashboard.

Erathos supports both as destinations for your connections, so you can choose between BigQuery and ClickHouse for the same sources. Our [ClickHouse destination](https://www.erathos.com/en/blog/clickhouse-data-destination?utm_source=blog&utm_medium=organic&utm_content=bydefault&utm_campaign=clickhouse-vs-bigquery) works with ClickHouse Cloud as well as self-hosted servers. It creates the tables, manages schema changes and allows you to set up your tables to run on different intervals (from minutes to daily depending on the source).

## FAQ

### Is ClickHouse cheaper than BigQuery?

BigQuery can be cheaper on-demand if you’re running a small number of well-filtered queries (since you pay for the amount of data your query scans) whereas ClickHouse Cloud is likely to be cheaper if you’re looking at a dashboard that refreshes throughout the day (since the compute cost is fixed). In our example, a single chart can cost about $162/month with ClickHouse Basic, or $165/month with BigQuery on-demand, whereas 5 charts will cost about $757/month on BigQuery on-demand.

### How much does a BigQuery query cost?

Queries are charged $6.25 per TiB of data read on on-demand queries, but the first 1 TiB per month is free. Queries that fail or are answered from the cache are free. BigQuery charges at least 10 MB per table for queries that read data.

### Can ClickHouse replace BigQuery?

Yes, for dashboards, logs and event analysis but for the warehouse case where analysts join several large tables in unplanned ways ClickHouse needs more table design and careful join planning than BigQuery which makes BigQuery easier to work with in that use case.

### Is ClickHouse free?

The open source version is free and under the Apache 2.0 license. Of course, you’ll have to pay for the servers you run it on, though. The ClickHouse Cloud version is paid. New accounts get $300 in trial credits for 30 days.

### Does ClickHouse support UPDATE and DELETE?

Yes, lightweight updates are meant for frequent small updates, while mutations are meant for infrequent heavy updates. For continuous updates from a production database ClickHouse recommends the ReplacingMergeTree table engine with a version column, combined with the FINAL modifier for reading.

### Does BigQuery cache dashboard queries?

Yes, for about 24 hours, and cached results are free. BigQuery does not use cached results if the table has changed, if there are recent streaming inserts on the table, or if the query text has changed (even if only by a single space).

Want to load the same sources into BigQuery or ClickHouse to compare them for yourself? [Try Erathos free for 14 days](https://app.erathos.com/signup?utm_source=blog&utm_medium=organic&utm_content=bydefault&utm_campaign=clickhouse-vs-bigquery).
