Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions _site/redirects.json
Original file line number Diff line number Diff line change
Expand Up @@ -2678,5 +2678,17 @@
{
"source": "/sql-reference/formats",
"destination": "/core/reference/formats"
},
{
"source": "/integrations/pg_clickhouse",
"destination": "/cloud/managed-postgres/extensions/pg_clickhouse"
},
{
"source": "/integrations/pg_clickhouse/tutorial",
"destination": "/cloud/managed-postgres/extensions/pg_clickhouse/tutorial"
},
{
"source": "/integrations/pg_clickhouse/reference",
"destination": "/cloud/managed-postgres/extensions/pg_clickhouse/reference"
}
]
11 changes: 1 addition & 10 deletions integrations/connectors/navigation.json
Original file line number Diff line number Diff line change
Expand Up @@ -214,16 +214,7 @@
"integrations/connectors/data-integrations/integrations/retool",
"integrations/connectors/data-integrations/integrations/easypanel",
"integrations/connectors/data-integrations/integrations/middleware",
"integrations/connectors/data-integrations/integrations/splunk",
{
"group": "pg_clickhouse",
"expanded": false,
"pages": [
"integrations/connectors/tools/pg_clickhouse/introduction",
"integrations/connectors/tools/pg_clickhouse/reference",
"integrations/connectors/tools/pg_clickhouse/tutorial"
]
}
"integrations/connectors/data-integrations/integrations/splunk"
]
},
{
Expand Down
2 changes: 1 addition & 1 deletion products/managed-postgres/extensions.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ SELECT * FROM pg_available_extensions;

The `pg_clickhouse` extension is pre-installed on every Managed Postgres instance. It allows you to query ClickHouse databases directly from PostgreSQL, enabling a unified query layer for both transactions and analytics.

See the [pg_clickhouse documentation](/integrations/connectors/tools/pg_clickhouse/introduction) for setup instructions and usage details.
See the [pg_clickhouse documentation](/products/managed-postgres/extensions/pg_clickhouse/introduction) for setup instructions and usage details.

## pg_stat_ch extension {#pg-stat-ch}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
sidebarTitle: 'Introduction'
description: 'Run analytics queries on ClickHouse right from PostgreSQL without rewriting any SQL'
slug: '/integrations/pg_clickhouse'
slug: '/cloud/managed-postgres/extensions/pg_clickhouse'
title: 'pg_clickhouse reference documentation'
doc_type: 'landing-page'
keywords: ['PostgreSQL', 'Postgres', 'FDW', 'foreign data wrapper', 'pg_clickhouse', 'extension']
Expand All @@ -13,13 +13,13 @@ keywords: ['PostgreSQL', 'Postgres', 'FDW', 'foreign data wrapper', 'pg_clickhou
on ClickHouse right from PostgreSQL without rewriting any SQL. It supports
PostgreSQL 13 and later and ClickHouse v23 and later.

Once [ClickPipes](/integrations/clickpipes/home) starts syncing data ClickHouse,
Once [ClickPipes](/integrations/clickpipes) starts syncing data ClickHouse,
use pg_clickhouse to quickly and easily [import foreign tables] into a
PostgreSQL schema. Then run your existing PostgreSQL queries to against those
tables, preserving your existing code base while pushing execution down to
ClickHouse.

## Getting Started {#getting-started}
## Getting started {#getting-started}

The simplest way to try pg_clickhouse is the [Docker image], which contains
the standard PostgreSQL Docker image with the pg_clickhouse and [re2]
Expand All @@ -34,7 +34,7 @@ docker exec -it pg_clickhouse psql -U postgres -c 'CREATE EXTENSION pg_clickhous
See the [tutorial] to get started importing ClickHouse tables and pushing down
queries.

## Test Case: TPC-H {#test-case-tpc-h}
## Test case: TPC-H {#test-case-tpc-h}

This table compares [TPC-H] query performance between regular PostgreSQL
tables and pg_clickhouse connected to ClickHouse, both loaded at scaling
Expand Down Expand Up @@ -67,7 +67,7 @@ memory.
| [Query 21] | 1349 ms | 4434 ms | |
| [Query 22] | 258 ms | 1415 ms | |

### Compile From Source {#compile-from-source}
### Compile from source {#compile-from-source}

#### General Unix {#general-unix}

Expand Down Expand Up @@ -106,7 +106,7 @@ sudo yum install \

See [PostgreSQL Yum] for details on pulling from the PostgreSQL Yum repository.

#### Install From PGXN {#install-from-pgxn}
#### Install from PGXN {#install-from-pgxn}

With the above dependencies satisfied use the [PGXN client] (available as
[Homebrew], [Apt] and Yum packages named `pgxnclient`) to download, compile,
Expand Down Expand Up @@ -280,10 +280,10 @@ adding DML features. Our road map:

[pg_clickhouse]: https://github.com/clickHouse/pg_clickhouse
"pg_clickhouse on GitHub"
[import foreign tables]: /integrations/connectors/tools/pg_clickhouse/reference#import-foreign-schema
[import foreign tables]: /cloud/managed-postgres/extensions/pg_clickhouse/reference#import-foreign-schema
[Docker image]: https://github.com/ClickHouse/pg_clickhouse/pkgs/container/pg_clickhouse
"Latest Docker release"
[tutorial]: /integrations/connectors/tools/pg_clickhouse/tutorial "pg_clickhouse Tutorial"
[tutorial]: /cloud/managed-postgres/extensions/pg_clickhouse/tutorial "pg_clickhouse Tutorial"
[PostgreSQL Apt]: https://wiki.postgresql.org/wiki/Apt
[PostgreSQL Yum]: https://yum.postgresql.org
[PGXN client]: https://pgxn.github.io/pgxnclient/ "PGXN Client’s documentation"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
sidebarTitle: 'Reference'
description: 'Complete reference documentation for pg_clickhouse'
slug: '/integrations/pg_clickhouse/reference'
slug: '/cloud/managed-postgres/extensions/pg_clickhouse/reference'
title: 'pg_clickhouse reference documentation'
doc_type: 'reference'
keywords: ['PostgreSQL', 'Postgres', 'FDW', 'foreign data wrapper', 'pg_clickhouse', 'extension']
Expand All @@ -13,7 +13,7 @@ pg_clickhouse is a PostgreSQL extension that enables remote query execution
on ClickHouse databases, including a [foreign data wrapper]. It supports
PostgreSQL 13 and higher and ClickHouse 23 and higher.

## Getting Started {#getting-started}
## Getting started {#getting-started}

The simplest way to try pg_clickhouse is the [Docker image], which contains
the standard PostgreSQL Docker image with the pg_clickhouse and [re2][re2
Expand All @@ -25,7 +25,7 @@ docker run --name pg_clickhouse -e POSTGRES_PASSWORD=my_pass \
docker exec -it pg_clickhouse psql -U postgres
```

See the [tutorial](/integrations/connectors/tools/pg_clickhouse/tutorial) to get started importing ClickHouse tables and
See the [tutorial](/products/managed-postgres/extensions/pg_clickhouse/tutorial) to get started importing ClickHouse tables and
pushing down queries.

## Usage {#usage}
Expand All @@ -40,7 +40,7 @@ CREATE SCHEMA taxi;
IMPORT FOREIGN SCHEMA taxi FROM SERVER taxi_srv INTO taxi;
```

## Versioning Policy {#versioning-policy}
## Versioning policy {#versioning-policy}

pg_clickhouse adheres to [Semantic Versioning] for its public releases.

Expand Down Expand Up @@ -68,7 +68,7 @@ be accompanied by SQL upgrade scripts, and all existing database that contain
the extension must run `ALTER EXTENSION pg_clickhouse UPDATE` to benefit from
the upgrade.

## DDL SQL Reference {#ddl-sql-reference}
## DDL SQL reference {#ddl-sql-reference}

The following SQL [DDL] expressions use pg_clickhouse.

Expand Down Expand Up @@ -372,7 +372,7 @@ Use the `CASCADE` clause to drop them, too:
DROP FOREIGN TABLE acts CASCADE;
```

## DML SQL Reference {#dml-sql-reference}
## DML SQL reference {#dml-sql-reference}

The SQL [DML] expressions below may use pg_clickhouse. Examples depend on
these ClickHouse tables:
Expand Down Expand Up @@ -681,7 +681,7 @@ LOAD
```

It's not normally necessary to use [LOAD], as Postgres will automatically load
pg_clickhouse the first time any of of its features (functions, foreign
pg_clickhouse the first time any of its features (functions, foreign
tables, etc.) are used.

The one time it may be useful to [LOAD] pg_clickhouse is to [SET](#set)
Expand Down Expand Up @@ -823,7 +823,7 @@ shared_preload_libraries = pg_clickhouse
Useful to save memory and load overhead for every session, but requires the
cluster to be restart when the library is updated.

## Data Types {#data-types}
## Data types {#data-types}

pg_clickhouse maps the following ClickHouse data types to PostgreSQL data
types. [IMPORT FOREIGN SCHEMA](#import-foreign-schema) uses the first type in
Expand Down Expand Up @@ -974,7 +974,7 @@ As a rule, only use [TEXT] columns for encoded strings and use [BYTEA] columns
only for binary data, and never switch between them.
</Tip>

## Function and Operator Reference {#function-and-operator-reference}
## Function and operator reference {#function-and-operator-reference}

### Functions {#functions}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
sidebarTitle: 'Tutorial'
description: 'Learn how to connect pg_clickhouse to ClickHouse and query a New York City taxi example dataset.'
slug: '/integrations/pg_clickhouse/tutorial'
slug: '/cloud/managed-postgres/extensions/pg_clickhouse/tutorial'
title: 'pg_clickhouse tutorial'
doc_type: 'guide'
keywords: ['PostgreSQL', 'Postgres', 'FDW', 'foreign data wrapper', 'pg_clickhouse', 'extension', 'tutorial', 'taxi']
Expand All @@ -22,7 +22,7 @@ docker run -d --network host --name clickhouse -p 8123:8123 -p9000:9000 --ulimit
docker exec -it clickhouse clickhouse-client
```

## Create a Table {#create-a-table}
## Create a table {#create-a-table}

Let's borrow from the [ClickHouse tutorial] to create a simple database with The New York
City taxi dataset:
Expand Down Expand Up @@ -87,7 +87,7 @@ PARTITION BY toYYYYMM(pickup_date)
ORDER BY pickup_datetime;
```

## Add the Data Set {#add-the-data-set}
## Add the data set {#add-the-data-set}

And then import the data:

Expand Down Expand Up @@ -461,7 +461,7 @@ your own SQL query.
Time: 17.450 ms
```

## Create a Dictionary {#create-a-dictionary}
## Create a dictionary {#create-a-dictionary}

Create a dictionary associated with a table in your ClickHouse service. The
table and dictionary are based on a CSV file that contains a row for each
Expand Down Expand Up @@ -620,7 +620,7 @@ table.
Time: 2.012 ms
```

2. This query returns rows for the the 1000 trips with the highest tip
2. This query returns rows for the 1000 trips with the highest tip
amount, then performs an inner join of each row with the dictionary:

```sql
Expand Down
68 changes: 68 additions & 0 deletions products/managed-postgres/migrations/overview.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
---
slug: /cloud/managed-postgres/migrations/overview
sidebarTitle: 'Overview'
title: 'Managed Postgres data migration'
description: 'Compare the four migration paths into ClickHouse Managed Postgres and pick the one that fits your source database and downtime requirements.'
keywords: ['managed postgres', 'migration', 'postgres migration', 'clickpipes', 'peerdb', 'pg_dump', 'pg_restore', 'logical replication']
doc_type: 'guide'
---

import BetaBadge from "/snippets/components/BetaBadge/BetaBadge.jsx";

# Managed Postgres data migration

<BetaBadge link="https://clickhouse.com/cloud/postgres" galaxyTrack={true} galaxyEvent="docs.managed-postgres.migration-overview-beta" />
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BetaBadge component ignores all passed props

Medium Severity

The BetaBadge component at snippets/components/BetaBadge/BetaBadge.jsx is defined as a parameterless function (() => { ... }) that renders a static badge. The link, galaxyTrack, and galaxyEvent props passed here are silently ignored — no tracking fires and no link override takes effect. All other usages of BetaBadge in this repo pass zero props. The upstream component likely supports these props, but the local copy hasn't been synced to match.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit d519501. Configure here.


You can migrate to Managed Postgres through four different paths. Which one
fits depends on whether you need ongoing replication, what source you're
migrating from, and how much downtime your application can tolerate during
cutover.

| Method | Ongoing replication (CDC) | Where it runs | Best for |
| ------------------------------------------------------------------------------------- | ------------------------- | -------------------------- | ------------------------------------------------------------------------- |
| [ClickPipes](/products/managed-postgres/migrations/clickhouse-cloud) | Yes | ClickHouse Cloud console | Most migrations — guided wizard with initial load and CDC out of the box |
| [PeerDB](/products/managed-postgres/migrations/peerdb) | Yes | Self-hosted (Docker) | Sources or workflows not covered by the ClickPipes UI |
| [pg_dump and pg_restore](/products/managed-postgres/migrations/pg_dump-pg_restore) | No | Your local machine | One-time moves of small or static datasets where downtime is acceptable |
| [Logical replication](/products/managed-postgres/migrations/logical-replication) | Yes | Source and target Postgres | Direct control over native Postgres replication, no third-party tooling |

## ClickPipes {#clickpipes}

[ClickPipes](/products/managed-postgres/migrations/clickhouse-cloud) is the recommended
path for most migrations. It runs entirely inside the ClickHouse Cloud console
and walks you through connecting to the source, exporting and importing the
schema, and starting an initial load with or without CDC. Pre-built source
connectors cover Amazon RDS, Aurora, Supabase, Google Cloud SQL, Azure
Flexible Server, Neon, Crunchy Bridge, TimescaleDB, and any generic Postgres
instance.

## PeerDB {#peerdb}

[PeerDB](/products/managed-postgres/migrations/peerdb) is a self-hosted migration
tool you run via Docker. Use it when your source or workflow isn't a fit for
the ClickPipes wizard — for example, when you need to script peer creation
across many databases or run the migration entirely inside your own network.
PeerDB doesn't migrate indexes, constraints, or triggers automatically; you
recreate those on the target after the data lands.

## pg_dump and pg_restore {#pg-dump-pg-restore}

[pg_dump and pg_restore](/products/managed-postgres/migrations/pg_dump-pg_restore)
take a snapshot of the source and replay it on the target. There's no ongoing
replication, so writes must stop on the source for the duration of the dump
and restore. This is the right choice for small or static datasets, or
non-production environments where a maintenance window is acceptable.

## Logical replication {#logical-replication}

[Logical replication](/products/managed-postgres/migrations/logical-replication)
uses native Postgres publications and subscriptions to stream changes from
the source to the target. You configure `wal_level`, replication slots, and
the `REPLICATION` privilege yourself — no third-party tooling sits in the
middle. Pick this path when you want full control over the replication
mechanics or your environment rules out external migration tools.

## After the migration {#after-migration}

Once data is moving, use [data validation](/products/managed-postgres/migrations/data-validation)
to confirm row counts and content match between source and target before
cutting over application traffic.
Loading