Advanced

PostgreSQL for AI — Advanced

Operate Postgres vector workloads at scale: replication and read scaling, sharding with Citus, incremental embedding pipelines, production observability and drift, and a platform-design capstone.

5 lessons ~255 min total
  1. 1

    Replication & Read Scaling for pgvector

    Scale read-heavy vector workloads: streaming replication and read replicas, replication lag and read-your-writes, connection pooling with PgBouncer, and HA/failover.

    50 minReplicationPgBouncerRead Replicas
  2. 2

    Sharding with Citus for Billion-Scale Vectors

    Scale pgvector beyond one node with Citus: distributed tables and the distribution-key choice, co-location, distributed vector search and cross-shard top-K merging (and its recall pitfall).

    50 minCitusShardingDistributed ANN
  3. 3

    Incremental Embedding Pipelines

    Keep embeddings fresh as source data changes: a stale flag with triggers, LISTEN/NOTIFY to wake a worker, a job queue with FOR UPDATE SKIP LOCKED, CDC via logical replication, and idempotent backfill.

    50 minTriggersLISTEN/NOTIFYCDC
  4. 4

    Observability & Drift in Production

    Operate a Postgres vector store: pg_stat_statements and slow-query monitoring, index bloat and autovacuum tuning for high-churn tables, REINDEX CONCURRENTLY, and detecting retrieval-quality drift.

    50 minpg_statMonitoringReindexing
  5. 5

    Capstone: Postgres RAG Platform Design

    The synthesis — two worked case studies designing a production Postgres-backed RAG platform end-to-end, from schema and indexing through scaling, with capacity planning, cost modeling, and a launch playbook.

    55 minSystem DesignCapacity PlanningCase Studies