---
title: "pg_crdt - an experimental CRDT extension for Postgres"
description: "pg_crdt is an experimental, open-source Postgres extension that adds CRDT column types (wrapping the Yjs and Automerge Rust libraries via pgx), so a column like a post's content can be a Yjs Doc whose updates are commutative and idempotent."
url: "https://swe.quest/articles/pg-crdt-an-experimental-crdt-extension-for-postgres-19dd4ebad247eefd"
canonical: "https://supabase.com/blog/postgres-crdt"
source: "Supabase"
published: "2022-12-10"
difficulty: "easy"
kind: "Announcement"
reading_minutes: 7
tags: ["postgres","consistency","local-first","realtime"]
---

# pg\_crdt - an experimental CRDT extension for Postgres

A post on [Supabase](https://swe.quest/sources/supabase.md), published 2022-12-10, 7 min read, Announcement. Original: [https://supabase.com/blog/postgres-crdt](https://supabase.com/blog/postgres-crdt)

## Summary

pg\_crdt is an experimental, open-source Postgres extension that adds CRDT column types (wrapping the Yjs and Automerge Rust libraries via pgx), so a column like a post's content can be a Yjs Doc whose updates are commutative and idempotent. Supabase argues for storing CRDTs in the database rather than making Realtime the authoritative server, to avoid coupling and enable tools like Debezium, while allowing per-column choice between last-write-wins and CRDT merging. Known limitations block production use: WAL-based broadcast sends the whole document on small edits, frequent updates generate heavy WAL and dead tuples, and large documents incur serialization overhead.

Written by swe.quest, not by the author.

**Difficulty:** Easy: no special background needed; explains what something is and why it matters

## Topics

- [PostgreSQL](https://swe.quest/tags/postgres.md) (Data & databases)
- [Consistency models](https://swe.quest/tags/consistency.md) (Distributed systems)
- [Local-first & sync](https://swe.quest/tags/local-first.md) (Architecture & design)
- [Real-time systems](https://swe.quest/tags/realtime.md) (Backend & APIs)

## Prerequisites

- Postgres extensions ([easy posts on PostgreSQL](https://swe.quest/tags/postgres.md?difficulty=easy))
- Postgres WAL basics ([easy posts on PostgreSQL](https://swe.quest/tags/postgres.md?difficulty=easy))

## Keywords

pg\_crdt, Yjs, Automerge, pgx, Supabase Realtime, CRDT

## Related posts

- [Comparing local-first frameworks and approaches](https://swe.quest/articles/comparing-local-first-frameworks-and-approaches-d0bd0fb78a9919b2.md): Neon · 2024-09-19 · Easy · 6 min read · Local-first & sync, Consistency models, Replication, PostgreSQL
  Local-first software keeps data on the user's device and syncs opportunistically, and three representative approaches take different routes to it.
- [Change Data Capture (CDC) with PostgreSQL and ClickHouse - Part 2](https://swe.quest/articles/change-data-capture-cdc-with-postgresql-and-clickhouse-part-2-2123f803752f2e9d.md): ClickHouse · 2023-06-15 · Medium · 22 min read · Event-driven architecture, PostgreSQL, Analytics & OLAP, Data pipelines, Replication
  A Postgres-to-ClickHouse CDC pipeline is built with Debezium, Kafka Connect and a ClickHouse materialized view, keeping a ReplacingMergeTree table in sync with the 28M-row UK property price dataset under a mix of inserts, updates and deletes.
- [Postgres to ClickHouse: Data Modeling Tips V2](https://swe.quest/articles/postgres-to-clickhouse-data-modeling-tips-v2-421af33ac59693d5.md): ClickHouse · 2025-03-06 · Medium · 21 min read · Analytics & OLAP, PostgreSQL, Event-driven architecture, Replication, SQL
  Postgres CDC into ClickHouse (via PeerDB or ClickPipes) uses logical decoding and maps tables to ReplacingMergeTree.
- [Introducing chdb Postgres extension: High-performance imports from cloud storage](https://swe.quest/articles/introducing-chdb-postgres-extension-high-performance-imports-from-cloud-storage-ca34f0fd59105471.md): ClickHouse · 2026-09-08 · Medium · 7 min read · PostgreSQL, Data pipelines, Storage systems, Performance engineering
  chdb is a new Postgres extension that uses the in-process ClickHouse engine chDB to import and export data in dozens of formats (CSV, JSON, Parquet, Avro, Arrow, ORC, Protobuf and more) from S3, GCS, Azure, HDFS, HTTP and local files, via a chdb\_query() function and a chdb\_hook module that extends COPY and CREATE TABLE.
- [Change Data Capture (CDC) with PostgreSQL and ClickHouse - Part 1](https://swe.quest/articles/change-data-capture-cdc-with-postgresql-and-clickhouse-part-1-10e3d601e2748dab.md): ClickHouse · 2023-06-15 · Medium · 23 min read · Event-driven architecture, PostgreSQL, Analytics & OLAP, Replication, Queues & messaging
  Postgres-to-ClickHouse CDC can be built by streaming row changes from Postgres logical decoding (pgoutput plugin, replication slots, LSN ordering) through Debezium and Kafka, then applying them in ClickHouse with the ReplacingMergeTree engine.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
