BigQuery on Azure lets you query Google BigQuery datasets directly from Azure-hosted PostgreSQL by using the bigquery_fdw extension.
Keeping analytics close to application data avoids egress fees, reduces latency, and lets engineers reuse familiar SQL against multi-cloud datasets without moving data.
Install the bigquery_fdw extension in your Azure Database for PostgreSQL Flexible Server instance, create a foreign server that points at your BigQuery project, supply a service-account key, and map BigQuery tables as foreign tables.
Connect as an admin and run: CREATE EXTENSION IF NOT EXISTS bigquery_fdw;
Use CREATE SERVER
with your project, region, and JSON credentials stored in Azure Key Vault or a local file.
Grant each PostgreSQL role a mapping that references the same service-account key or an OAuth token.
Run IMPORT FOREIGN SCHEMA
or define individual CREATE FOREIGN TABLE
statements for Customers
, Orders
, and related datasets in BigQuery.
Yes. Once the foreign tables exist, treat them like local tables. PostgreSQL’s planner decides when to push filters to BigQuery, minimizing transferred rows.
Select only required columns, push predicates early, use LIMIT
during exploration, and schedule heavy joins during off-peak hours to control BigQuery on-demand costs.
Store the JSON key in Azure Key Vault and reference it through an environment variable set at cluster startup. Revoke or rotate keys via IAM without changing SQL.
Yes, provided you enable the "Extensions" configuration category and run a supported version (PostgreSQL 13+).
bigquery_fdw currently supports INSERT
but not UPDATE
/DELETE
. For bulk loads, use BigQuery Data Transfer Service or COPY
into Cloud Storage.
BigQuery charges for scanned bytes. Reduce cost by selecting specific columns, partitioning tables, and limiting result sets.