Mastering cross-database operations with PostgreSQL FDW
A guide to schema import, archival policies, and automation
Introduction
Modern applications often rely on data scattered across multiple databases. PostgreSQL’s Foreign Data Wrapper (FDW) empowers you to query and manipulate external databases as if they were native PostgreSQL tables. Combined with pg_cron for scheduling and stored procedures for automation, you can build robust archival pipelines.
In this post we will talk about:
Setting up FDW to connect to external databases (ex: another PostgreSQL instance).
Importing foreign schemas.
Creating archival policies with stored procedures
Automating archival tasks with pg_cron



