Stop Copying Data by Hand — Do It the Right Way | PostgreSQL Logical Replication

Turtle Code
413 views •

Most teams solve the "we need this data over there" problem the wrong way — they either duplicate the table manually, build a sync script that breaks at 2am, or just give the second service direct access to the main database and hope for the best. There's a cleaner way. PostgreSQL has logical replication built right in, and it lets you stream exactly the tables you want from one database to another — automatically, in real time, without touching your application code. In this video, we spin up two completely separate PostgreSQL instances and connect them using a Publication on the source side and a Subscription on the destination side. By the end, any row inserted into the main database shows up in the second one instantly — no scripts, no cron jobs, no manual work. ⏱️ Timestamps 0:00 - What's the Problem? 0:26 - What Is PostgreSQL Logical Replication? 1:04 - Setting Up With Docker Compose 2:50 - Publication, Subscription & Live Sync What we'll do: 🔸 Spin up two PostgreSQL 15 instances with Docker Compose 🔸 Enable logical replication with a single WAL-level config 🔸 Create a Publication on the source database for a specific table 🔸 Create a Subscription on the destination database to start listening 🔸 Insert a new row and watch it appear on the other side instantly ✅ GitHub https://github.com/turtlecode/Just-Turtle-Code-Youtube/blob/main/logical-replication-postgresql.txt ✅ Free Python Courses https://www.youtube.com/@turtlecode/courses

Keyboard shortcuts

On. Switch them off if they collide with your assistive tools; ? still opens this sheet.

Go to

Press g then the letter.

  • gh Latest
  • gs Sources
  • gm Media
  • gv Videos
  • gp Podcasts
  • gc Calendar
  • gd Decoder
  • gz Dataviz
  • ga Datasets
  • gb Blog
  • gk Markets
  • gj Careers
  • gn Prompt Notebook

On this page

  • / Focus search, where there is one
  • t Back to top
  • ? This list
  • Esc Close