Join tables separate PostgreSQL databases
1. Enable the PostgreSQL Foreign Data Wrapper
CREATE EXTENSION postgres_fdw;2. Create a Foreign Server Connection
CREATE SERVER foreign_server
FOREIGN DATA WRAPPER postgres_fdw
OPTIONS (host 'second-db-hostname.region.rds.amazonaws.com', port '5432', dbname 'second_database');3. Create a User Mapping
CREATE USER MAPPING FOR current_user
SERVER foreign_server
OPTIONS (user 'remote_username', password 'remote_password');4. Create Foreign Tables
5. Create a View Joining Local and Foreign Tables
6. Create a Materialized View (for performance)
AWS-Specific Considerations
PreviousOracle to PostgreSQL Time-Window Data Reload Implementation GuideNextMulti-Stage Migration Implementation Plan
Last updated