Installs the BigQuery FDW extension in PostgreSQL so you can query Google BigQuery tables as if they were local.
Connecting BigQuery to PostgreSQL lets you join cloud-scale data with local tables, reuse existing SQL skills, and avoid manual exports.
You need PostgreSQL ≥ 13 compiled with FDW support, the bigquery_fdw
binaries, a Google Cloud service-account key, and network access to BigQuery.
After compiling or downloading the FDW, place the shared library in $PGHOME/lib
, copy the control file to $PGHOME/share/extension
, then run CREATE EXTENSION bigquery_fdw;
.
Use CREATE EXTENSION IF NOT EXISTS bigquery_fdw [WITH VERSION version] [CASCADE];
to register the FDW in your database.
Create a server with CREATE SERVER
, map users with CREATE USER MAPPING
, and import schemas with IMPORT FOREIGN SCHEMA
. Each step is shown in the example below.
Yes. Once the foreign tables are imported, you can join them with local tables like Orders
and Customers
using standard SQL.
Set use_cache
and batch_size
options to reduce API calls, secure service-account keys with file_fdw
configs, and monitor query costs in GCP.
No. It is community-maintained. Test thoroughly and pin a stable release.
No. Queries are pushed down; data streams on demand. Only result sets travel over the network.
Use EXPLAIN
to see estimated bytes processed, restrict columns, and cache results when possible.