Concept Flow - Foreign data wrappers concept
Start Query on Local DB
Check if Table is Foreign
Use FDW to
Connect to
Remote Source
Return Local Data
Fetch Data
Return Data to Local DB
Query Result Returned
When a query accesses a foreign table, PostgreSQL uses the foreign data wrapper (FDW) to connect to the remote source, fetch data, and return it as if it were local.