The short answer
Postgres and ClickHouse are not rivals for the same job. Postgres is a transactional database that can also answer analytical questions; ClickHouse is an analytical database that is a poor home for your application's rows. For most Supabase teams the question is not which one to pick but whether analytics has outgrown the database you already run.
- Stay in Postgres while your analytical queries can be served from pre-calculated tables, materialized views or a read replica, and your metrics need the same row-level permissions as your app.
- Add ClickHouse when you are scanning large, append-heavy event or log tables (product events, API logs, LLM traces) on every dashboard load, or serving analytics to many customers at once, and pre-aggregation no longer keeps up.
- Keep Postgres as the source of truth either way. ClickHouse is fed from it, not the other way round.
Side by side
| Postgres (Supabase) | ClickHouse | |
|---|---|---|
| Built for | Transactions (OLTP): many small reads and writes to individual rows. | Analytics (OLAP): scanning and aggregating many rows over a few columns. |
| Storage layout | Row-oriented heap: each row's columns are stored together. | Column-oriented MergeTree tables: each column stored and compressed on its own, in parts sorted by the table's ORDER BY key. |
| Transactions | Full ACID transactions across statements and tables. | An insert into one MergeTree partition is atomic; multi-statement transactions are experimental and not supported in ClickHouse Cloud. |
| Updates and deletes | Routine, row by row, under MVCC. | Supported (lightweight UPDATE and DELETE, mutations), but the engine is designed around appends; CDC tables keep row versions and are read with FINAL. |
| Indexes | B-tree, GIN, BRIN and more, on any column. | A sparse primary index on the ORDER BY key, plus optional data-skipping indexes. |
| Access control | Roles and Row Level Security policies (what Supabase's auth relies on). | Its own users, roles and row policies; Postgres RLS does not travel with replicated data. |
| For a Supabase team | Already running: it is your project's database. | A second system: ClickHouse Cloud or self-hosted, fed by CDC (ClickPipes) and optionally queried back from Postgres through Supabase's ClickHouse wrapper. |
| Price | Part of your Supabase plan and compute size; see supabase.com/pricing. | Separate bill for compute, storage and ClickPipes; see clickhouse.com/pricing. |
Prices change and depend on usage, region and plan, so this page quotes none. Check Supabase's pricing (including how read replicas are billed) and ClickHouse Cloud's pricing for your own workload.
Why the same query behaves so differently
A typical analytics query (“daily active users by plan for the last 90 days”) touches a handful of columns across a very large number of rows. Postgres stores each row's columns together, so it reads whole rows off disk to get at the two or three columns it needs, and it competes with your application for the same CPU, memory and connections while it does. Our piece on analytical query performance on Supabase Postgres goes through where that cost shows up.
ClickHouse stores each column separately and compressed, keeps table data sorted by its ORDER BY key, and processes columns in vectorized batches. A query reads only the columns it names and can skip whole blocks of rows using the sparse primary index. The trade-off is the other direction: fetching or changing a single row is relatively expensive, and multi-statement transactions are experimental and unavailable in ClickHouse Cloud. ClickHouse's own documentation points transactional workloads back to Postgres.
When Postgres is enough
Most early-stage analytics is a small set of numbers asked for repeatedly: revenue, signups, activation, retention. Those rarely need a scan of raw history on every request. Postgres covers them well when you:
- Pre-calculate. Refresh materialized views or maintain aggregate tables on a schedule (for example with Supabase Cron), so dashboards read a few hundred rows instead of millions.
- Move heavy reads off the primary. A read replica isolates analytical load from your app, though it stores data the same row-oriented way, so large scans stay slow.
- Need your permissions to hold.Analytics that must respect Supabase's Row Level Security, per tenant or per user, is simplest when it never leaves Postgres. RLS has its own cost on large scans; see how RLS affects analytical queries.
- Want one system to run. A second database means a second schema, a replication pipeline to watch and a second bill.
If you want columnar speed without a second database, there is a middle path: an embedded engine such as DuckDB reading your Postgres data or exported Parquet files. Our guide to DuckDB queries over Supabase Postgres data covers it, and warehouse-free analytics tooling ranked compares the options. Which Postgres extensions you can install depends on your project's Postgres version; check Supabase's extensions list before planning around one.
When ClickHouse earns its place
The signals that analytics has outgrown Postgres are about shape and volume, not about headcount:
- Your largest tables are append-only events: clicks, page views, API requests, AI agent or LLM traces. You query them ad hoc by arbitrary dimensions, so you cannot pre-aggregate every question.
- Dashboards or customer-facing analytics run scans over that history many times a minute, and adding replicas or bigger compute has stopped helping.
- You are ingesting events at a rate that bloats Postgres tables and indexes, and keeping them vacuumed is becoming its own job.
Supabase itself describes Postgres plus ClickHouse as a common stack for AI companies that generate a lot of logs and analytical data, in its ClickHouse partnership announcement. If your events arrive through a product-analytics SDK today, our piece on querying events directly in Postgres is a useful check on how far Postgres alone takes you first.
Running both: how Supabase and ClickHouse connect
Postgres to ClickHouse: ClickPipes CDC
ClickHouse Cloud's Postgres CDC ClickPipe (built on PeerDB, which ClickHouse acquired) replicates tables from Postgres using logical replication, and has a setup guide for Supabase. Things to know before you start:
- It connects to the database host directly. Poolers, including the Supabase pooler, are not supported for CDC.
- Replicated tables are ReplacingMergeTree by default: updates and deletes arrive as new row versions. Read the current state with
FINALand filter out deleted rows with_peerdb_is_deleted = 0. - Self-hosting ClickHouse? PeerDB is open source and can run the same kind of pipeline outside ClickHouse Cloud; see the PeerDB docs.
ClickHouse from Postgres: Supabase's ClickHouse wrapper
Supabase's ClickHouse wrapper is a foreign data wrapper that reads and writes ClickHouse tables from inside Postgres, so an app, a PostgREST view or an RPC can return ClickHouse results without a second client. It speaks ClickHouse's native protocol (ports 9000 and 9440) only, and Supabase recommends keeping the connection string in Vault.
Permissions do not come along
Rows replicated into ClickHouse leave your Postgres RLS policies behind. If you serve tenant-level analytics from ClickHouse, you have to rebuild that isolation there (its row policies, separate tables, or a query layer that always filters by tenant). Our piece on multi-tenant analytics isolation in Supabase sets out the patterns.
A quick way to decide
- List the ten questions your dashboards, reports and agents ask most. If each can be answered from a table you refresh on a schedule, stay in Postgres.
- Find the slowest of them with
EXPLAIN ANALYZEon a replica or a copy. If the time goes on scanning one large event table, that table is your ClickHouse candidate, not the whole database. - Replicate only that table (or those few) with CDC, keep everything else in Postgres, and decide where per-tenant permissions will live before anyone queries it.
- Price both setups for your volume on the vendors' own pricing pages before committing; neither cost is fixed.