
{"id":8295,"date":"2025-05-14T12:39:23","date_gmt":"2025-05-14T12:39:23","guid":{"rendered":"https:\/\/test.opensource-db.in\/wp1\/?p=8295"},"modified":"2025-05-14T12:40:08","modified_gmt":"2025-05-14T12:40:08","slug":"postgresql-physical-replication-gone-wrong-a-lesson-in-archive-management","status":"publish","type":"post","link":"https:\/\/test.opensource-db.in\/wp1\/postgresql-physical-replication-gone-wrong-a-lesson-in-archive-management\/","title":{"rendered":"PostgreSQL Physical Replication Gone Wrong: A Lesson in Archive Management"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">While setting up physical streaming replication in PostgreSQL, one misstep can lead to critical issues. Even when all standard steps are followed.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">In one of my recent setups, I began by preparing the primary server. I enabled archive_mode, configured an archive_command, and tuned a few WAL parameters. Then, I used pg_basebackup to initialize the standby from the primary. Everything looked fine, the standby connected, streaming replication started, and WALs were flowing.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">But shortly after running write-heavy operations on the primary, the standby crashed.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The root cause? A misconfiguration that got silently copied during the base backup. The archive configuration from the primary was still active on the standby, but the archive destination didn\u2019t exist there. WAL segments started piling up, couldn&#8217;t be archived, and filled up disk space which eventually caused the standby to crash.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">In this blog, I\u2019ll walk you through<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>The steps I followed to set up replication<\/li>\n\n\n\n<li>What exactly went wrong and why<\/li>\n\n\n\n<li>How I fixed the issue and the lessons I learned<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">If you\u2019re using pg_basebackup for physical replication, this is a mistake worth learning from, it is not always the complex parts that fail, but the ones you didn\u2019t even think to double-check.<\/p>\n\n\n\n<h5 class=\"wp-block-heading\">Replication setup:<\/h5>\n\n\n\n<p class=\"wp-block-paragraph\">Here are the steps I followed to setup physical streaming replication.<\/p>\n\n\n\n<h5 class=\"wp-block-heading\">Create replication user:<\/h5>\n\n\n\n<p class=\"wp-block-paragraph\">CREATE ROLE rep_user with REPLICATION LOGIN ENCRYPTED \u2018password\u2019;<\/p>\n\n\n\n<h5 class=\"wp-block-heading\">Configure postgresql.conf file:<\/h5>\n\n\n\n<p class=\"wp-block-paragraph\">wal_level = replica<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">archive_mode = on<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">archive_command = \u2018cp %p \/test\/archive\/%f\u2019<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">min_wal_size = 2GB<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">max_wal_size = 8GB<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">hot_standby = on<\/p>\n\n\n\n<h5 class=\"wp-block-heading\">Update pg_hba.conf file for allowing replication:<\/h5>\n\n\n\n<p class=\"wp-block-paragraph\">host      replication      rep_user       standby_ip\/32 \u00a0        md5<\/p>\n\n\n\n<h5 class=\"wp-block-heading\">On Standby:<\/h5>\n\n\n\n<p class=\"wp-block-paragraph\">On the standby server, it\u2019s important to stop PostgreSQL before running pg_basebackup. This tool takes a binary copy of the primary server\u2019s data directory to initialize the standby, and if the standby is still running during this process, it can result in an incomplete or inconsistent backup. This may lead to issues like WAL corruption, recovery failures, or replication not starting properly. Stopping the standby ensures a clean snapshot of the primary\u2019s state and avoids complications during the replication setup.<\/p>\n\n\n\n<h5 class=\"wp-block-heading\">Remove old standby data directory:<\/h5>\n\n\n\n<p class=\"wp-block-paragraph\">rm -rf \/var\/lib\/pgsql\/13\/data\/*<\/p>\n\n\n\n<h5 class=\"wp-block-heading\">Run pg_basebackup on standby:<\/h5>\n\n\n\n<p class=\"wp-block-paragraph\">Pg_basebackup -h primary_ip -U rep_user -D \/var\/lib\/pgsql\/13\/data -X stream -P -R<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This made a complete copy of primary. With -R&nbsp; which automatically creates the standby.signal.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">restart the postgresql on the standby<\/p>\n\n\n\n<h6 class=\"wp-block-heading\"><br>Verify replication status immediately:<br><br>On Primary:<\/h6>\n\n\n\n<p class=\"wp-block-paragraph\">SELECT pid, username,application_name, client_addr, state, sync_state,&nbsp;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Sent_lsn, write_lsn, flush_lsn, replay_lsn&nbsp;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">FROM pg_stat_replication;<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/lh7-rt.googleusercontent.com\/docsz\/AD_4nXeIp8OPwiohYbAspp9tQvyDkMIlKVpI9Jo2kBJV80VsVF59HY-Z6cRuezplQWieVqwXnNryQfc-awJlgpFH8SlWJWqtjWKmKOvBoKx5w3CIUCOYRsWwP7EXEdpI-vA91wRNmNcR_w?key=Qwhv_s0rkMzOhD0C0qXQPA\" alt=\"\"\/><\/figure>\n\n\n\n<h6 class=\"wp-block-heading\">On standby:<\/h6>\n\n\n\n<p class=\"wp-block-paragraph\">SELECT pg_last_wal_receive_lsn(), pg_last_wal_replay_lsn();<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/lh7-rt.googleusercontent.com\/docsz\/AD_4nXdF2mHv2oD5X6S_zauh-y2-hpduOophUgNaomn9AKtlOOfv9wCtZxotrhz4kkLX4GzgD6KUzR_jllC9JbLyc6dWLUSDCi5iHSvgP28WhOAKSFeg8nAemVpW0C9tRsEu8Kpw6Y_xYQ?key=Qwhv_s0rkMzOhD0C0qXQPA\" alt=\"\"\/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">SELECT pg_is_in_recovery();<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/lh7-rt.googleusercontent.com\/docsz\/AD_4nXchAH-XZwt9pII4ZbJEwnvWSdIX6G61nGQWYWF3WqqQBX7bbSkWcGtDjrv4RWaO30XCEKs5CNONRdFuJG43p3LeGnMvCvPmTFyzdOrml_2XHU65aZzhkZrqqKIi39B6--PTNSrVzQ?key=2Aogug1Gvg_EyF7aCnFPfN-m\" alt=\"\"\/><\/figure>\n\n\n\n<h5 class=\"wp-block-heading\">Crash issues:<\/h5>\n\n\n\n<p class=\"wp-block-paragraph\">After running a batch of inserts on primary, I noticed the standby crashed. Steps observed:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>WAL generation on primary surged due to heavy insert activity.<\/li>\n\n\n\n<li>The standby, trying to stay in sync but started replaying WALs at a high rate.<\/li>\n\n\n\n<li>It also inherited the archive_command from the primary copied during pg_basebackup.<\/li>\n\n\n\n<li>Unfortunately, the directory \/test\/archive\/ doesn\u2019t exist on the standby.<\/li>\n\n\n\n<li>As a result the archive_command failed silently causing WALs to pile up.<\/li>\n\n\n\n<li>PostgreSQL couldn\u2019t recycle or remove old WALs because archiving was still marked in progress.<\/li>\n\n\n\n<li>Disk usage on standby exploded filling up pg_wal<\/li>\n\n\n\n<li>At same time memory usage spiked due to WAL replay buffers<\/li>\n\n\n\n<li>Both of these issues had eventually caused the standby to crash abruptly.<\/li>\n<\/ul>\n\n\n\n<h6 class=\"wp-block-heading\">Here are the logs:<\/h6>\n\n\n\n<pre class=\"wp-block-code\"><code>Here are the logs:\n\n-postgres@new-0LOG:  connection authenticated: identity=\"postgres\" method=peer (\/var\/lib\/pgsql\/13\/data\/pg_hba.conf:85)\n-postgres@new-0LOG:  connection authorized: user=postgres database=new application_name=psql\n-postgres@postgres-0LOG:  disconnection: session time: 0:00:06.593 user=postgres database=postgres host=&#91;local]\n-postgres@new-0LOG:  duration: 5.188 ms\n-postgres@new-0LOG:  duration: 0.972 ms\n--@-0LOG:  could not create archive status file \"pg_wal\/archive_status\/0000000100000000000000B2.done\": No space left on device\n--@-0FATAL:  could not extend file \"base\/16384\/16388.1\": No space left on device\n--@-0HINT:  Check free disk space.\n--@-0CONTEXT:  WAL redo at 0\/B224D8D8 for Heap\/INSERT+INIT: off 1 flags 0x00; blkref #0: rel 1663\/16384\/16388, blk 146658\n--@-0FATAL:  could not create file \"pg_wal\/xlogtemp.22337\": No space left on device\n--@-0LOG:  startup process (PID 22333) exited with exit code 1\n--@-0LOG:  terminating any other active server processes\n--@-0LOG:  could not open temporary statistics file \"pg_stat\/global.tmp\": No space left on device\n--@-0LOG:  shutting down due to startup process failure\n--@-0LOG:  database system is shut down\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The WAL files had consumed all the available disk space. Worse, PostgreSQL couldn\u2019t even write temporary stats files or archive status markers. It was stuck.<\/p>\n\n\n\n<h6 class=\"wp-block-heading\">Recovery steps:<\/h6>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Got to know which part consumed more space and found the pg_wal directory is flooded with wal files.<\/li>\n\n\n\n<li>Before moving further copied all wal files to separate location and cleaned up the pg_wal directory to free up space.<\/li>\n\n\n\n<li>After cleaning up the directory, I tried restarting the database and it failed again.<\/li>\n\n\n\n<li>The log showed PostgreSQL was still looking for a specific WAL segment. This made sense because the database needed that segment to recover.<\/li>\n\n\n\n<li>Searched for that WAL file in the backup location and copied it back to pg_wal directory and fixed ownership and permissions.<\/li>\n\n\n\n<li>This time the standby started successfully.<\/li>\n<\/ul>\n\n\n\n<h6 class=\"wp-block-heading\">Lessons learned:<\/h6>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Pg_basebackup copies postgresql.conf as it is, including the changes made to the parameters which are meant for primary.<\/li>\n\n\n\n<li>Always review configs on standby<\/li>\n\n\n\n<li>WAL bloat is deadly in replication<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">Let me know if you\u2019ve run into similar issues or have tricks for preventing archive-related mishaps in replication. Always learning.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n","protected":false},"excerpt":{"rendered":"<p>While setting up physical streaming replication in PostgreSQL, one misstep can lead to critical issues. Even when all standard steps [&hellip;]<\/p>\n","protected":false},"author":10,"featured_media":8297,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"categories":[23,42,89],"tags":[],"class_list":["post-8295","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-postgresql-14","category-postgresql-15","category-postgresql-16"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v25.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>PostgreSQL Physical Replication Gone Wrong: A Lesson in Archive Management - OpenSource DB<\/title>\n<meta name=\"robots\" content=\"noindex, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"PostgreSQL Physical Replication Gone Wrong: A Lesson in Archive Management - OpenSource DB\" \/>\n<meta property=\"og:description\" content=\"While setting up physical streaming replication in PostgreSQL, one misstep can lead to critical issues. Even when all standard steps [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/test.opensource-db.in\/wp1\/postgresql-physical-replication-gone-wrong-a-lesson-in-archive-management\/\" \/>\n<meta property=\"og:site_name\" content=\"OpenSource DB\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/people\/OpenSource-DB\/100072970755470\/\" \/>\n<meta property=\"article:published_time\" content=\"2025-05-14T12:39:23+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-05-14T12:40:08+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/test.opensource-db.in\/wp1\/wp-content\/uploads\/2025\/05\/PostgreSQL-Physical-Replication-Gone-Wrong-A-Lesson-in-Archive-Management-scaled.png\" \/>\n\t<meta property=\"og:image:width\" content=\"2560\" \/>\n\t<meta property=\"og:image:height\" content=\"1344\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Brahmini Ratnam\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@opensource_db\" \/>\n<meta name=\"twitter:site\" content=\"@opensource_db\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Brahmini Ratnam\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/test.opensource-db.in\/wp1\/postgresql-physical-replication-gone-wrong-a-lesson-in-archive-management\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/test.opensource-db.in\/wp1\/postgresql-physical-replication-gone-wrong-a-lesson-in-archive-management\/\"},\"author\":{\"name\":\"Brahmini Ratnam\",\"@id\":\"https:\/\/test.opensource-db.in\/wp1\/#\/schema\/person\/867a56696ebca29a93489ed53609f301\"},\"headline\":\"PostgreSQL Physical Replication Gone Wrong: A Lesson in Archive Management\",\"datePublished\":\"2025-05-14T12:39:23+00:00\",\"dateModified\":\"2025-05-14T12:40:08+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/test.opensource-db.in\/wp1\/postgresql-physical-replication-gone-wrong-a-lesson-in-archive-management\/\"},\"wordCount\":791,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/test.opensource-db.in\/wp1\/#organization\"},\"image\":{\"@id\":\"https:\/\/test.opensource-db.in\/wp1\/postgresql-physical-replication-gone-wrong-a-lesson-in-archive-management\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/test.opensource-db.in\/wp1\/wp-content\/uploads\/2025\/05\/PostgreSQL-Physical-Replication-Gone-Wrong-A-Lesson-in-Archive-Management-scaled.png\",\"articleSection\":[\"PostgreSQL 14\",\"PostgreSQL 15\",\"PostgreSQL 16\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/test.opensource-db.in\/wp1\/postgresql-physical-replication-gone-wrong-a-lesson-in-archive-management\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/test.opensource-db.in\/wp1\/postgresql-physical-replication-gone-wrong-a-lesson-in-archive-management\/\",\"url\":\"https:\/\/test.opensource-db.in\/wp1\/postgresql-physical-replication-gone-wrong-a-lesson-in-archive-management\/\",\"name\":\"PostgreSQL Physical Replication Gone Wrong: A Lesson in Archive Management - OpenSource DB\",\"isPartOf\":{\"@id\":\"https:\/\/test.opensource-db.in\/wp1\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/test.opensource-db.in\/wp1\/postgresql-physical-replication-gone-wrong-a-lesson-in-archive-management\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/test.opensource-db.in\/wp1\/postgresql-physical-replication-gone-wrong-a-lesson-in-archive-management\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/test.opensource-db.in\/wp1\/wp-content\/uploads\/2025\/05\/PostgreSQL-Physical-Replication-Gone-Wrong-A-Lesson-in-Archive-Management-scaled.png\",\"datePublished\":\"2025-05-14T12:39:23+00:00\",\"dateModified\":\"2025-05-14T12:40:08+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/test.opensource-db.in\/wp1\/postgresql-physical-replication-gone-wrong-a-lesson-in-archive-management\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/test.opensource-db.in\/wp1\/postgresql-physical-replication-gone-wrong-a-lesson-in-archive-management\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/test.opensource-db.in\/wp1\/postgresql-physical-replication-gone-wrong-a-lesson-in-archive-management\/#primaryimage\",\"url\":\"https:\/\/test.opensource-db.in\/wp1\/wp-content\/uploads\/2025\/05\/PostgreSQL-Physical-Replication-Gone-Wrong-A-Lesson-in-Archive-Management-scaled.png\",\"contentUrl\":\"https:\/\/test.opensource-db.in\/wp1\/wp-content\/uploads\/2025\/05\/PostgreSQL-Physical-Replication-Gone-Wrong-A-Lesson-in-Archive-Management-scaled.png\",\"width\":2560,\"height\":1344},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/test.opensource-db.in\/wp1\/postgresql-physical-replication-gone-wrong-a-lesson-in-archive-management\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/test.opensource-db.in\/wp1\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"PostgreSQL Physical Replication Gone Wrong: A Lesson in Archive Management\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/test.opensource-db.in\/wp1\/#website\",\"url\":\"https:\/\/test.opensource-db.in\/wp1\/\",\"name\":\"OpenSource DB\",\"description\":\"Your Trusted OpenSource Databases partner\",\"publisher\":{\"@id\":\"https:\/\/test.opensource-db.in\/wp1\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/test.opensource-db.in\/wp1\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/test.opensource-db.in\/wp1\/#organization\",\"name\":\"OPENSOURCE DB PRIVATE LIMITED\",\"url\":\"https:\/\/test.opensource-db.in\/wp1\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/test.opensource-db.in\/wp1\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/test.opensource-db.in\/wp1\/wp-content\/uploads\/2021\/10\/osdb-logo-tm-2.png\",\"contentUrl\":\"https:\/\/test.opensource-db.in\/wp1\/wp-content\/uploads\/2021\/10\/osdb-logo-tm-2.png\",\"width\":368,\"height\":120,\"caption\":\"OPENSOURCE DB PRIVATE LIMITED\"},\"image\":{\"@id\":\"https:\/\/test.opensource-db.in\/wp1\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/people\/OpenSource-DB\/100072970755470\/\",\"https:\/\/x.com\/opensource_db\",\"https:\/\/www.youtube.com\/channel\/UCmTI5h\",\"https:\/\/www.linkedin.com\/company\/opensource-db\",\"https:\/\/www.instagram.com\/opensource_db\/\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/test.opensource-db.in\/wp1\/#\/schema\/person\/867a56696ebca29a93489ed53609f301\",\"name\":\"Brahmini Ratnam\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/test.opensource-db.in\/wp1\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/05bcc95d3352ddae501c8cdae6b20b8e4e59c373cb7e506042427bca7fe13a3b?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/05bcc95d3352ddae501c8cdae6b20b8e4e59c373cb7e506042427bca7fe13a3b?s=96&d=mm&r=g\",\"caption\":\"Brahmini Ratnam\"},\"url\":\"https:\/\/test.opensource-db.in\/wp1\/author\/brahmini-ratnam-meruva\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"PostgreSQL Physical Replication Gone Wrong: A Lesson in Archive Management - OpenSource DB","robots":{"index":"noindex","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"og_locale":"en_US","og_type":"article","og_title":"PostgreSQL Physical Replication Gone Wrong: A Lesson in Archive Management - OpenSource DB","og_description":"While setting up physical streaming replication in PostgreSQL, one misstep can lead to critical issues. Even when all standard steps [&hellip;]","og_url":"https:\/\/test.opensource-db.in\/wp1\/postgresql-physical-replication-gone-wrong-a-lesson-in-archive-management\/","og_site_name":"OpenSource DB","article_publisher":"https:\/\/www.facebook.com\/people\/OpenSource-DB\/100072970755470\/","article_published_time":"2025-05-14T12:39:23+00:00","article_modified_time":"2025-05-14T12:40:08+00:00","og_image":[{"width":2560,"height":1344,"url":"https:\/\/test.opensource-db.in\/wp1\/wp-content\/uploads\/2025\/05\/PostgreSQL-Physical-Replication-Gone-Wrong-A-Lesson-in-Archive-Management-scaled.png","type":"image\/png"}],"author":"Brahmini Ratnam","twitter_card":"summary_large_image","twitter_creator":"@opensource_db","twitter_site":"@opensource_db","twitter_misc":{"Written by":"Brahmini Ratnam","Est. reading time":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/test.opensource-db.in\/wp1\/postgresql-physical-replication-gone-wrong-a-lesson-in-archive-management\/#article","isPartOf":{"@id":"https:\/\/test.opensource-db.in\/wp1\/postgresql-physical-replication-gone-wrong-a-lesson-in-archive-management\/"},"author":{"name":"Brahmini Ratnam","@id":"https:\/\/test.opensource-db.in\/wp1\/#\/schema\/person\/867a56696ebca29a93489ed53609f301"},"headline":"PostgreSQL Physical Replication Gone Wrong: A Lesson in Archive Management","datePublished":"2025-05-14T12:39:23+00:00","dateModified":"2025-05-14T12:40:08+00:00","mainEntityOfPage":{"@id":"https:\/\/test.opensource-db.in\/wp1\/postgresql-physical-replication-gone-wrong-a-lesson-in-archive-management\/"},"wordCount":791,"commentCount":0,"publisher":{"@id":"https:\/\/test.opensource-db.in\/wp1\/#organization"},"image":{"@id":"https:\/\/test.opensource-db.in\/wp1\/postgresql-physical-replication-gone-wrong-a-lesson-in-archive-management\/#primaryimage"},"thumbnailUrl":"https:\/\/test.opensource-db.in\/wp1\/wp-content\/uploads\/2025\/05\/PostgreSQL-Physical-Replication-Gone-Wrong-A-Lesson-in-Archive-Management-scaled.png","articleSection":["PostgreSQL 14","PostgreSQL 15","PostgreSQL 16"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/test.opensource-db.in\/wp1\/postgresql-physical-replication-gone-wrong-a-lesson-in-archive-management\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/test.opensource-db.in\/wp1\/postgresql-physical-replication-gone-wrong-a-lesson-in-archive-management\/","url":"https:\/\/test.opensource-db.in\/wp1\/postgresql-physical-replication-gone-wrong-a-lesson-in-archive-management\/","name":"PostgreSQL Physical Replication Gone Wrong: A Lesson in Archive Management - OpenSource DB","isPartOf":{"@id":"https:\/\/test.opensource-db.in\/wp1\/#website"},"primaryImageOfPage":{"@id":"https:\/\/test.opensource-db.in\/wp1\/postgresql-physical-replication-gone-wrong-a-lesson-in-archive-management\/#primaryimage"},"image":{"@id":"https:\/\/test.opensource-db.in\/wp1\/postgresql-physical-replication-gone-wrong-a-lesson-in-archive-management\/#primaryimage"},"thumbnailUrl":"https:\/\/test.opensource-db.in\/wp1\/wp-content\/uploads\/2025\/05\/PostgreSQL-Physical-Replication-Gone-Wrong-A-Lesson-in-Archive-Management-scaled.png","datePublished":"2025-05-14T12:39:23+00:00","dateModified":"2025-05-14T12:40:08+00:00","breadcrumb":{"@id":"https:\/\/test.opensource-db.in\/wp1\/postgresql-physical-replication-gone-wrong-a-lesson-in-archive-management\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/test.opensource-db.in\/wp1\/postgresql-physical-replication-gone-wrong-a-lesson-in-archive-management\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/test.opensource-db.in\/wp1\/postgresql-physical-replication-gone-wrong-a-lesson-in-archive-management\/#primaryimage","url":"https:\/\/test.opensource-db.in\/wp1\/wp-content\/uploads\/2025\/05\/PostgreSQL-Physical-Replication-Gone-Wrong-A-Lesson-in-Archive-Management-scaled.png","contentUrl":"https:\/\/test.opensource-db.in\/wp1\/wp-content\/uploads\/2025\/05\/PostgreSQL-Physical-Replication-Gone-Wrong-A-Lesson-in-Archive-Management-scaled.png","width":2560,"height":1344},{"@type":"BreadcrumbList","@id":"https:\/\/test.opensource-db.in\/wp1\/postgresql-physical-replication-gone-wrong-a-lesson-in-archive-management\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/test.opensource-db.in\/wp1\/"},{"@type":"ListItem","position":2,"name":"PostgreSQL Physical Replication Gone Wrong: A Lesson in Archive Management"}]},{"@type":"WebSite","@id":"https:\/\/test.opensource-db.in\/wp1\/#website","url":"https:\/\/test.opensource-db.in\/wp1\/","name":"OpenSource DB","description":"Your Trusted OpenSource Databases partner","publisher":{"@id":"https:\/\/test.opensource-db.in\/wp1\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/test.opensource-db.in\/wp1\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/test.opensource-db.in\/wp1\/#organization","name":"OPENSOURCE DB PRIVATE LIMITED","url":"https:\/\/test.opensource-db.in\/wp1\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/test.opensource-db.in\/wp1\/#\/schema\/logo\/image\/","url":"https:\/\/test.opensource-db.in\/wp1\/wp-content\/uploads\/2021\/10\/osdb-logo-tm-2.png","contentUrl":"https:\/\/test.opensource-db.in\/wp1\/wp-content\/uploads\/2021\/10\/osdb-logo-tm-2.png","width":368,"height":120,"caption":"OPENSOURCE DB PRIVATE LIMITED"},"image":{"@id":"https:\/\/test.opensource-db.in\/wp1\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/people\/OpenSource-DB\/100072970755470\/","https:\/\/x.com\/opensource_db","https:\/\/www.youtube.com\/channel\/UCmTI5h","https:\/\/www.linkedin.com\/company\/opensource-db","https:\/\/www.instagram.com\/opensource_db\/"]},{"@type":"Person","@id":"https:\/\/test.opensource-db.in\/wp1\/#\/schema\/person\/867a56696ebca29a93489ed53609f301","name":"Brahmini Ratnam","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/test.opensource-db.in\/wp1\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/05bcc95d3352ddae501c8cdae6b20b8e4e59c373cb7e506042427bca7fe13a3b?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/05bcc95d3352ddae501c8cdae6b20b8e4e59c373cb7e506042427bca7fe13a3b?s=96&d=mm&r=g","caption":"Brahmini Ratnam"},"url":"https:\/\/test.opensource-db.in\/wp1\/author\/brahmini-ratnam-meruva\/"}]}},"rttpg_featured_image_url":{"full":["https:\/\/test.opensource-db.in\/wp1\/wp-content\/uploads\/2025\/05\/PostgreSQL-Physical-Replication-Gone-Wrong-A-Lesson-in-Archive-Management-scaled.png",2560,1344,false],"landscape":["https:\/\/test.opensource-db.in\/wp1\/wp-content\/uploads\/2025\/05\/PostgreSQL-Physical-Replication-Gone-Wrong-A-Lesson-in-Archive-Management-scaled.png",2560,1344,false],"portraits":["https:\/\/test.opensource-db.in\/wp1\/wp-content\/uploads\/2025\/05\/PostgreSQL-Physical-Replication-Gone-Wrong-A-Lesson-in-Archive-Management-scaled.png",2560,1344,false],"thumbnail":["https:\/\/test.opensource-db.in\/wp1\/wp-content\/uploads\/2025\/05\/PostgreSQL-Physical-Replication-Gone-Wrong-A-Lesson-in-Archive-Management-150x150.png",150,150,true],"medium":["https:\/\/test.opensource-db.in\/wp1\/wp-content\/uploads\/2025\/05\/PostgreSQL-Physical-Replication-Gone-Wrong-A-Lesson-in-Archive-Management-300x158.png",300,158,true],"large":["https:\/\/test.opensource-db.in\/wp1\/wp-content\/uploads\/2025\/05\/PostgreSQL-Physical-Replication-Gone-Wrong-A-Lesson-in-Archive-Management-1024x538.png",1024,538,true],"1536x1536":["https:\/\/test.opensource-db.in\/wp1\/wp-content\/uploads\/2025\/05\/PostgreSQL-Physical-Replication-Gone-Wrong-A-Lesson-in-Archive-Management-1536x806.png",1536,806,true],"2048x2048":["https:\/\/test.opensource-db.in\/wp1\/wp-content\/uploads\/2025\/05\/PostgreSQL-Physical-Replication-Gone-Wrong-A-Lesson-in-Archive-Management-2048x1075.png",2048,1075,true],"ultp_layout_landscape_large":["https:\/\/test.opensource-db.in\/wp1\/wp-content\/uploads\/2025\/05\/PostgreSQL-Physical-Replication-Gone-Wrong-A-Lesson-in-Archive-Management-scaled.png",1200,630,false],"ultp_layout_landscape":["https:\/\/test.opensource-db.in\/wp1\/wp-content\/uploads\/2025\/05\/PostgreSQL-Physical-Replication-Gone-Wrong-A-Lesson-in-Archive-Management-scaled.png",870,457,false],"ultp_layout_portrait":["https:\/\/test.opensource-db.in\/wp1\/wp-content\/uploads\/2025\/05\/PostgreSQL-Physical-Replication-Gone-Wrong-A-Lesson-in-Archive-Management-scaled.png",600,315,false],"ultp_layout_square":["https:\/\/test.opensource-db.in\/wp1\/wp-content\/uploads\/2025\/05\/PostgreSQL-Physical-Replication-Gone-Wrong-A-Lesson-in-Archive-Management-scaled.png",600,315,false]},"rttpg_author":{"display_name":"Brahmini Ratnam","author_link":"https:\/\/test.opensource-db.in\/wp1\/author\/brahmini-ratnam-meruva\/"},"rttpg_comment":2,"rttpg_category":"<a href=\"https:\/\/test.opensource-db.in\/wp1\/category\/postgres\/postgresql-14\/\" rel=\"category tag\">PostgreSQL 14<\/a> <a href=\"https:\/\/test.opensource-db.in\/wp1\/category\/postgres\/postgresql-15\/\" rel=\"category tag\">PostgreSQL 15<\/a> <a href=\"https:\/\/test.opensource-db.in\/wp1\/category\/postgres\/postgresql-16\/\" rel=\"category tag\">PostgreSQL 16<\/a>","rttpg_excerpt":"While setting up physical streaming replication in PostgreSQL, one misstep can lead to critical issues. Even when all standard steps [&hellip;]","_links":{"self":[{"href":"https:\/\/test.opensource-db.in\/wp1\/wp-json\/wp\/v2\/posts\/8295","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/test.opensource-db.in\/wp1\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/test.opensource-db.in\/wp1\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/test.opensource-db.in\/wp1\/wp-json\/wp\/v2\/users\/10"}],"replies":[{"embeddable":true,"href":"https:\/\/test.opensource-db.in\/wp1\/wp-json\/wp\/v2\/comments?post=8295"}],"version-history":[{"count":2,"href":"https:\/\/test.opensource-db.in\/wp1\/wp-json\/wp\/v2\/posts\/8295\/revisions"}],"predecessor-version":[{"id":8298,"href":"https:\/\/test.opensource-db.in\/wp1\/wp-json\/wp\/v2\/posts\/8295\/revisions\/8298"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/test.opensource-db.in\/wp1\/wp-json\/wp\/v2\/media\/8297"}],"wp:attachment":[{"href":"https:\/\/test.opensource-db.in\/wp1\/wp-json\/wp\/v2\/media?parent=8295"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/test.opensource-db.in\/wp1\/wp-json\/wp\/v2\/categories?post=8295"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/test.opensource-db.in\/wp1\/wp-json\/wp\/v2\/tags?post=8295"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}