Documentation Index
Fetch the complete documentation index at: https://private-7c7dfe99-page-updates.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
ClickHouse Cloud users are recommended to use ClickPipes for PostgreSQL replication to ClickHouse. This natively supports high-performance Change Data Capture (CDC) for PostgreSQL.
This table engine is experimental. To use it, set
allow_experimental_materialized_postgresql_table to 1 in your configuration files or by using the SET command:materialized_postgresql_tables_list setting, which specifies the tables to be replicated (will also be possible to add database schema). It will be much better in terms of CPU, fewer connections and fewer replication slots inside the remote PostgreSQL database.
Creating a table
host:port— PostgreSQL server address.database— Remote database name.table— Remote table name.user— PostgreSQL user.password— User password.
Requirements
-
The wal_level setting must have a value
logicalandmax_replication_slotsparameter must have a value at least2in the PostgreSQL config file. -
A table with
MaterializedPostgreSQLengine must have a primary key — the same as a replica identity index (by default: primary key) of a PostgreSQL table (see details on replica identity index). - Only database Atomic is allowed.
-
The
MaterializedPostgreSQLtable engine only works for PostgreSQL versions >= 11 as the implementation requires the pg_replication_slot_advance PostgreSQL function.
Virtual columns
-
_version— Transaction counter. Type: UInt64. -
_sign— Deletion mark. Type: Int8. Possible values:1— Row is not deleted,-1— Row is deleted.
SELECT query.
_version column equals LSN position in WAL, so it might be used to check how up-to-date replication is.
Replication of TOAST values is not supported. The default value for the data type will be used.