bigquery_fdw lets PostgreSQL run SQL against Google BigQuery through an open-source Foreign Data Wrapper.
bigquery_fdw removes ETL overhead. You can join BigQuery datasets with local PostgreSQL tables in one statement, keeping your BI stack simple and lowering data-latency.
Install the extension package, then run CREATE EXTENSION bigquery_fdw;
in the target database. The server must have libpq, Google Cloud SDK, and valid service-account JSON credentials.
Create a foreign server that points at your GCP project and dataset, add a user mapping with a credential file path, then import or create foreign tables that mirror the BigQuery schema.
Once the foreign tables exist, use regular SELECT
, JOIN
, and WHERE
clauses. PostgreSQL pushes down filters and projections so only necessary rows come back.
Blend BigQuery click-stream data with local Orders
to run funnel analyses, enrich customer profiles, or validate nightly ETL jobs by comparing row counts.
Limit columns, add WHERE
clauses, and set costs
on foreign tables to reflect BigQuery pricing. Cache cold data locally with CREATE MATERIALIZED VIEW
for faster repeated reads.
Missing credentials: Verify the service account has BigQuery Data Viewer. Slow queries: Add predicates or aggregate in PostgreSQL instead of pulling entire tables.
Review the bigquery_fdw
GitHub README, or run \help CREATE SERVER
inside psql for parameter details.
Yes. Many teams use it in production, but you must monitor costs and query performance because BigQuery charges per scanned byte.
No. The FDW is read-only. Use bq load
or BigQuery APIs to insert data.
Yes. Postgres parameters are passed down, letting BigQuery apply filters server-side and reduce data transfer.