Disaggregated WAL log processing, PG 17+ index prefetch, Google Columnar Engine 10.6, Managed Connection Pooling on port 6432, and Zero-ETL Iceberg and BigQuery pipelines.
Series: A five-part series for database engineers moving from AlloyDB Express prototypes to enterprise production without lock-in. Part 1 covers AlloyDB Express, fast provisioning, and Cloud Run lazy connectors. Part 2 builds hybrid RAG with ScaNN, HNSW, and reciprocal rank fusion. Part 3 hardens autonomous database agents behind IAM, MCP policy, and parameterized secure views. Part 4 opens up the AlloyDB engine internals for HTAP, pooling, and Zero-ETL analytics. Part 5 delivers local parity with AlloyDB Omni, zero-downtime migration, and clean exit portability.
This is Part 4.
The problem: when PostgreSQL storage, analytics, and connection storms collide
Stock PostgreSQL was built for a single server where the query engine and the storage disk share one kernel, one page cache, and one I/O budget. Under light load that coupling is simple and predictable. Under enterprise load, three failure modes show up at once.
First, checkpoints and VACUUM contend with live OLTP transactions for the same local block device, turning tail latency into a sawtooth. Second, analytical SUM, GROUP BY, and hash joins over millions of rows thrash shared_buffers, evicting the hot B-tree index pages that OLTP transactions need. Third, a burst of serverless workers or microservices opens thousands of short-lived connections on port 5432, burning backend memory and CPU on connection setup instead of queries.
AlloyDB for PostgreSQL replaces that coupled single-node bottleneck with a disaggregated storage tier, a dual-format row and columnar execution engine, a built-in transaction pooler on port 6432, and Zero-ETL paths to Apache Iceberg and BigQuery. Every piece stays behind standard PostgreSQL wire protocol and SQL.
What you'll be able to do
By the end of this post you should be able to:
-
Identify the components of an AlloyDB cluster across compute (
N2,C4A,C4,Z3), disaggregated WAL storage (128 TiBper cluster), and pooling endpoints (5432vs.6432). -
Explain how WAL disaggregation eliminates checkpoint I/O storms, how PostgreSQL 17+ index prefetch avoids
shared_bufferspollution (ultra fast cache hit), and how Google Columnar Engine10.6executes vectorized scans and joins. -
Configure
google_columnar_enginememory and SSD storage cache, virtual JSON columns (->and->>), Managed Connection Pooling flags, and read pool autoscaling policies. -
Diagnose planner misestimates, stale columnar blocks (
invalid_block_count), index scan cost regressions (alloydb.enable_cache_aware_costing), and Transparent Query Forwarding disqualifications inEXPLAINoutput. -
Decide between
USING icebergdirect scans,bigquery_fdwfederation, andalloydb_syncmirroring, and evaluate machine series and pooling modes for mixed OLTP and HTAP workloads. -
Build a Zero-ETL operational and analytical pipeline that joins live AlloyDB tables with Iceberg and BigQuery data and feeds a governed Data Agent Kit Medallion (
BronzetoSilvertoGold) workflow.
Setup
To run the commands in this post, you need an AlloyDB for PostgreSQL cluster running PostgreSQL 17 or PostgreSQL 18 (PostgreSQL 18 is required for Hot Standby, USING iceberg direct Iceberg access, and alloydb_sync), plus psql and the gcloud CLI.
Your IAM principal needs the AlloyDB Admin predefined role (roles/alloydb.admin) to modify instances, enable Managed Connection Pooling, and update database flags. For Zero-ETL Iceberg and BigQuery labs, the AlloyDB cluster service account also needs roles/storage.objectViewer, roles/biglake.viewer (when using Lakehouse runtime catalog), roles/bigquery.dataViewer, roles/bigquery.readSessionUser, and roles/bigquery.jobUser.
Check your cluster's service account and existing flags before making changes:
gcloud beta alloydb clusters describe CLUSTER_ID \
--region=REGION_ID \
--project=PROJECT_ID \
--format="value(serviceAccountEmail)"
Keep one operational rule from the docs in mind before updating any flag: gcloud alloydb instances update --database-flags=... replaces the entire flag list on that instance. Always pass every existing non-default flag you want to preserve alongside any new flag.
Part A: Disaggregated storage, WAL offloads, and compute machine shapes
Compute, WAL, and storage as separate scaling planes
Standard PostgreSQL writes dirty 8 KB heap and index pages from shared_buffers to local disk during checkpoints. In AlloyDB, compute nodes are stateless PostgreSQL execution VMs separated from a regional, multi-AZ distributed storage engine that scales automatically up to 128 TiB per cluster.
Compute nodes hold memory and local SSD cache only; durable state lives in the regional log persistor and shared 8 KB block storage.
Follow the numbered path in the architecture diagram:
-
Client ingress: Applications connect over PostgreSQL wire protocol on port
5432directly or port6432when Managed Connection Pooling is enabled. - Compute execution plane: Managed Connection Pooling routes writes and transactions to the single Primary instance and read queries to optional Read Pool instances (up to 20 nodes total across all read pools in a cluster behind a load-balanced reader IP), with Transparent Query Forwarding (TQF) bridging eligible primary reads to the read pool.
- Synchronous WAL durability: When a transaction commits on the Primary, AlloyDB writes WAL records synchronously to the Regional Log Persistor with a quorum acknowledgment before confirming commit, guaranteeing zero data loss (RPO = 0) across zonal failovers. Dirty data pages stay in primary RAM without checkpoint flushes to disk.
- Asynchronous WAL transfer: The Regional Log Persistor streams WAL records asynchronously to Async Log Processing Servers.
- Block materialization: Async Log Processing Servers materialize WAL records into 8 KB data blocks inside Shared Distributed Storage across zones and clean up processed WAL segments, so compute nodes never pay checkpoint I/O storms.
- Zero-compute-impact backups: Storage-layer snapshots run independently of compute nodes. Continuous backup and recovery defaults to a 14-day point-in-time recovery (PITR) window (configurable from 1 to 35 days with microsecond granularity), alongside automated incremental backups and on-demand full backups. For regulated workloads, Enhanced backups store immutable, indelible backups in a centralized Backup and DR Service vault with enforced retention.
-
HTAP and Zero-ETL Iceberg: Compute nodes scan local in-memory and SSD columnar tiers in Google Columnar Engine (
10.6) and stream or cache Parquet data from Apache Iceberg on Cloud Storage (gs://orbl://). -
BigQuery federation and sync: Compute nodes push filters and aggregations to BigQuery via
bigquery_fdwor mirror tables locally viaalloydb_syncon PostgreSQL 18.
On PostgreSQL 18 clusters, Hot Standby keeps the primary's cross-zone standby node running as a live replica rather than a cold standby. During failover, the standby transitions faster to read-write mode and already holds warm caches, avoiding the post-failover performance cliff caused by cold shared_buffers.
Choosing compute shapes across N2, C4A, C4, and Z3
Because compute is decoupled from durable storage, AlloyDB supports cross-machine-series configurations: your primary instance and read pool instances in the same cluster can run on different Compute Engine platforms (though HA primary active and standby nodes match each other, and all nodes inside a single read pool share one shape).
| Machine series | Core platform and CPU | Max vCPU and RAM (in AlloyDB) | Workload fit |
|---|---|---|---|
N2 |
3rd Gen Intel x86 (Ice Lake) | Up to 128 vCPU, 864 GB RAM | General purpose, widest regional availability |
C4A |
Google Axion ARM | 1 to 72 vCPU, up to 576 GB RAM (c4a-highmem-72-lssd) |
Best price-performance and throughput for cache-fitting workloads |
C4 |
6th Gen Intel x86 (Granite Rapids) + Titanium SSD | 4 to 288 vCPU, 2,304 GB RAM (c4-highmem-288-lssd) |
Lowest latency and largest vertical scale |
Z3 |
4th Gen Intel x86 (Sapphire Rapids) + Titanium SSD | Up to 88 vCPU, 704 GB RAM (z3-highmem-88-standardlssd) |
Storage-dense working sets requiring more local SSD cache per vCPU |
Notice one quirk on C4A: the 1-vCPU tier (c4a-highmem-1, 8 GB RAM) has no local SSD, so its columnar engine storage cache size is 0 and its default columnar memory allocation drops from 30% to 10%. Every 2 vCPU and larger tier in C4A, C4, Z3, and N2 pairs compute RAM with local SSD cache.
Documented OLTP throughput baselines
To ground what the disaggregated log pipeline delivers without custom flag tuning, Google Cloud publishes reproducible HammerDB TPC-C and pgbench benchmarks for multi-zone HA AlloyDB clusters (run without read pools, with an e2-standard-32 or n2-standard-64 client in the same zone):
| Benchmark | Instance size | Cache scenario | Documented result |
|---|---|---|---|
| HammerDB TPC-C | 64 vCPU, 512 GB | 100% cached (2,304 warehouses, 1,024 users) |
716,138 NOPM (1,665,438 cumulative TPM, 27,757 TPS) |
| HammerDB TPC-C | 64 vCPU, 512 GB | 30% cached (12,800 warehouses, 1,024 users) |
589,598 NOPM (1,371,160 cumulative TPM, 22,853 TPS) |
| HammerDB TPC-C | 16 vCPU, 128 GB | 100% cached (576 warehouses, 256 users) |
428,316 NOPM (974,264 cumulative TPM) |
| HammerDB TPC-C | 16 vCPU, 128 GB | 30% cached (3,200 warehouses, 256 users) |
252,970 NOPM (582,385 cumulative TPM) |
pgbench Select Only |
64 vCPU, 512 GB | Scale 15,000 (~220 GB), 256 clients |
467,583 TPS (0.547 ms avg latency, ~95% CPU) |
pgbench Index Insert Only |
16 vCPU, 128 GB | Scale 25,000 (~365 GB), 5 extra indexes on pgbench_history
|
51,742 TPS (4.947 ms avg latency, ~88% CPU) |
Even when five secondary indexes sit on pgbench_history and the dataset exceeds RAM (365 GB on a 128 GB node), AlloyDB sustains 51,742 TPS of concurrent inserts because WAL writes commit to the Regional Log Persistor while background servers materialize blocks.
Part B: Storage engine read/write path, Index Prefetch, and Adaptive Autovacuum
Why B-tree range scans stall on cold working sets
In open-source PostgreSQL 18 and earlier, Bitmap Index Scan prefetches heap blocks, but standard Index Scan and Index Only Scan nodes read scattered table and index pages one I/O at a time. When a query scans thousands of rows across a timestamp range (BETWEEN or ORDER BY ... LIMIT) on a table larger than RAM, the execution thread blocks on every uncached page fetch.
Predict before you look: if an engine prefetches 1,000 scattered table pages ahead of an Index Scan and drops them directly into PostgreSQL shared_buffers, what happens to the rest of your active OLTP sessions?
Prefetched pages stage in the Ultra-Fast Local SSD Cache outside shared_buffers, keeping OLTP buffer pools untouched.
They would evict your hot transactional working set from shared_buffers. AlloyDB avoids that cache pollution by staging prefetched pages in the Ultra-Fast Local SSD Cache outside PostgreSQL shared_buffers.
On PostgreSQL 17 and later, Index Prefetch is enabled by default with zero flags or SQL changes. It looks ahead on both B-tree index pages and scattered heap pages in parallel, obeys three built-in guardrails (LIMIT boundary stops, index-only scans prefetch index pages only without touching the heap, and single-row PK lookups skip prefetch), and reports local SSD hits directly in EXPLAIN (ANALYZE, BUFFERS) as ultra fast cache hit.
Here is the Buffers line format documented in the AlloyDB execution plan guide:
EXPLAIN (ANALYZE, BUFFERS)
SELECT id, value, effective_date
FROM public.orders_ledger
WHERE effective_date BETWEEN DATE '2026-01-01' AND DATE '2026-01-31'
ORDER BY effective_date
LIMIT 5000;
-- Verbatim Buffers line format from AlloyDB's execution plan docs (full-scan example):
Buffers: shared hit=1185 read=842625 dirtied=1, ultra fast cache hit=842625
Notice how shared read=842625 matches ultra fast cache hit=842625 in the docs example: PostgreSQL requested those blocks from outside shared_buffers, and AlloyDB served every single one from its local ultra-fast SSD cache rather than remote storage. On a LIMIT 5000 range scan, you will see smaller counts matching the pages prefetched up to the LIMIT boundary.
Cache-Aware Costing: fixing planner index vs. Seq Scan flips
Even when your hot index and table pages already sit in shared_buffers, standard PostgreSQL cost planning still charges random_page_cost as if reads hit disk. That pessimistic I/O estimate can cause an Index Scan to lose to a Seq Scan.
AlloyDB addresses this with Cache-Aware Costing (alloydb.enable_cache_aware_costing, currently in Preview, no instance restart required). When enabled globally or per session, the planner inspects buffer residency at planning time and scales down the estimated I/O cost of index scans.
In the AlloyDB documentation example, a warmed Index Scan (Buffers: shared hit=926) drops its planner cost estimate from 3906.49 down to 27.49 once cache awareness is turned on:
SET alloydb.enable_cache_aware_costing = on;
EXPLAIN (ANALYZE, VERBOSE, BUFFERS)
SELECT count(d) FROM t1 WHERE a = 10 AND b > 100 AND c > 100;
Adaptive Autovacuum: preventing bloat and XID wraparound
On high-churn OLTP tables, static autovacuum throttling leaves dead tuples piling up until VACUUM hits emergency XID wraparound mode and steals I/O during peak traffic. AlloyDB enables Adaptive Autovacuum (enable_google_adaptive_autovacuum=on) by default with no restart required. It dynamically scales vacuum CPU, I/O, worker count, and memory to workload pressure, throttles transaction ID consumption if wraparound approaches, and emits blocker warnings in the postgres log when long-running transactions, orphan prepared transactions, or orphan replication slots pin dead tuples:
Found a backend process PROCESS_ID with a long running transaction whose transaction
id age AGE is larger than or equal to the transaction age threshold AGE_THRESHOLD.
Part C: Google Columnar Engine (10.6), SSD storage cache, and vectorized execution
Dual-format HTAP without ETL
Enabling google_columnar_engine.enabled=on (which triggers one instance restart) activates Google Columnar Engine 10.6 on PostgreSQL 16 and later (10.5 on PostgreSQL 15); run CREATE EXTENSION IF NOT EXISTS google_columnar_engine; in each target database to expose its SQL management functions and g_columnar_* views. It transforms row-oriented heap tables, materialized views, and HNSW/ScaNN vector indexes into a compressed, vectorized column store organized into two memory tiers:
-
In-Memory Column Store: Defaults to 30% of instance RAM (
10%on 1-vCPU instances;128 MBminimum;50%recommended max,70%hard max, or20%max on 1-vCPU). -
SSD Storage Cache: Automatically spills columnar blocks to local Titanium/NVMe SSD via
google_columnar_engine.storage_cache_size. Because RAM holds metadata indexes for the SSD tier, AlloyDB recommends sizing the SSD storage cache to 100x to 1,000x the columnar RAM allocation (for example,1 GBcolumnar RAM paired with100 GBto1,000 GBstorage cache).
| Instance vCPUs | Default Storage Cache (N2 Primary / Read Pool) |
Default Storage Cache (C4A Primary or Read Pool) |
Max Configurable (N2 Primary / N2 Read Pool / C4A) |
|---|---|---|---|
| 1 vCPU | N/A |
0 (no local SSD) |
0 |
| 8 vCPU |
18.75 GB / 37.5 GB
|
37.5 GB |
187.5 GB / 375 GB / 375 GB
|
| 16 vCPU |
37.5 GB / 37.5 GB
|
75 GB |
375 GB / 375 GB / 750 GB
|
| 64 vCPU |
150 GB / 150 GB
|
262.5 GB |
1,500 GB / 1,500 GB / 2,625 GB
|
The PostgreSQL optimizer compares row-store and columnar costs per table; you never rewrite SQL to hit the column store.
Virtual JSON columns, vectorized joins, and EXPLAIN (ANALYZE, COLUMNAR_ENGINE)
Three capabilities in Columnar Engine 10.6 matter for modern JSON-heavy and star-schema workloads:
-
Auto-columnarization: Enabled by default (
google_columnar_engine.enable_auto_columnarization=on), sampling queries every hour (EVERY 1 HOUR) to load high-value columns automatically. You can trigger it on demand withSELECT google_columnar_engine_recommend();or get RAM sizing advice viaSELECT * FROM google_columnar_engine_recommend(mode => 'RECOMMEND_SIZE');. -
Virtual columns for JSON expressions (Preview, PG 16+): Analytical filters on
JSONandJSONBpayloads (->and->>) normally burn CPU parsing JSON row by row. Settinggoogle_columnar_engine.enable_virtual_columns_scan=on(note: while the feature guide mentionsonby default, the flag reference listsoff, so set it explicitly; no restart required) pre-computes extracted paths into columnar virtual columns:
-- Pre-compute JSONB extraction paths into columnar virtual columns (no restart)
SET google_columnar_engine.enable_virtual_columns_scan = on;
SELECT google_columnar_engine_add(
relation => 'public.events',
columns => 'event_id, payload',
expressions => '"payload ->> ''region''", "payload -> ''metrics'' ->> ''latency_ms''"'
);
SELECT relation_name, description, column_data_type, status
FROM g_columnar_virtual_columns;
-
Vectorized Hash Joins and Late Materialization: Enabling
google_columnar_engine.enable_vectorized_join=on(defaultoff, no restart) turns on multithreadedVectorized Hash Joinnodes with runtime Bloom filters (Build bloom filter,Rows Removed by Bloom Filter) andColumnar projection mode: late materialization, which defers fetching non-filtered payload columns until rows survive join and filter predicates.
Predict before you look: you populated a 50-million-row table into the column store, enabled google_columnar_engine.enabled=on, and ran SELECT SUM(amount) FROM orders WHERE status = 'PAID', yet EXPLAIN still shows a Seq Scan or Index Scan. What option reveals the exact first reason the optimizer rejected the column store?
Run EXPLAIN (ANALYZE, COLUMNAR_ENGINE)! Any non-columnar scan node prints a Columnar Check: line telling you why it fell back (for example table is too small, a needed column of the table is not in the CE store, or a needed column has a CE unsupported data type):
EXPLAIN (COLUMNAR_ENGINE, COSTS OFF)
SELECT * FROM sample_small_table
WHERE col1 > 10000;
-- Schematic output matching AlloyDB columnar-engine/monitor-tune.md:
Seq Scan on sample_small_table
Filter: (col1 > 10000)
Columnar Check: table is too small
Once a multi-table join qualifies and google_columnar_engine.enable_vectorized_join=on is active, EXPLAIN (ANALYZE, COSTS OFF, BUFFERS, TIMING OFF, SUMMARY OFF) shows the Vectorized Hash Join operator, runtime Bloom filter, and Custom Scan (columnar scan) nodes:
EXPLAIN (ANALYZE, COSTS OFF, BUFFERS, TIMING OFF, SUMMARY OFF)
SELECT l_quantity, l_extendedprice, l_discount, l_tax
FROM lineitem, orders
WHERE l_shipdate <= DATE '2022-08-06'
AND l_orderkey = o_orderkey
AND o_orderdate <= DATE '2025-03-07';
-- Schematic output matching AlloyDB columnar-engine/monitor-tune.md:
Vectorized Hash Join (actual rows=3934686 loops=1)
Vectorized partitioning, Partitions: 16 (Disk usage: 208MB)
(Peak Memory Usage: 27MB, Threads: 1)
Hash Cond: (lineitem.l_orderkey = orders.o_orderkey)
Rows Removed by Bloom Filter: 0
Buffers: temp read=26728 written=26728
-> Append (actual rows=3934686 loops=1)
-> Custom Scan (columnar scan) on lineitem (actual rows=3934686 loops=1)
Filter: (l_shipdate <= '2022-08-06'::date)
Rows Removed by Columnar Filter: 56051366
Columnar cache search mode: native
-> Seq Scan on lineitem (never executed)
-> Vectorized Hash (actual rows=7245824 loops=1)
Build bloom filter, Memory Usage: 1024kB
...
Freshness failure mode: silent degradation from invalid blocks
Columnar blocks are not updated synchronously on every INSERT, UPDATE, or DELETE. Instead, DML marks affected columnar blocks as invalid, and queries transparently blend valid columnar blocks with row-store pages. As invalid_block_count climbs, queries slow down until background refresh kicks in at google_columnar_engine.refresh_threshold_percentage (default 25, meaning 25% invalid blocks).
Diagnose staleness and storage cache saturation directly in SQL:
-- 1. Check columnar freshness and invalid block ratio
SELECT relation_name, status, invalid_block_count, total_block_count,
invalid_percentage, auto_refresh_recent_status
FROM g_columnar_relations;
-- 2. Check RAM and SSD storage cache headroom
SHOW google_columnar_engine.storage_cache_size;
SELECT google_columnar_engine_memory_available() AS ram_free_mb,
google_columnar_engine_storage_cache_used() AS ssd_cache_used,
google_columnar_engine_storage_cache_available() AS ssd_cache_available;
-- 3. Check per-query columnar execution stats (requires pg_stat_statements)
SELECT query_id, columnar_unit_read, page_read, rows_filtered,
columnar_scan_time, vectorized_join_time
FROM g_columnar_stat_statements
WHERE page_read > 0;
Two operational gotchas from the docs: first, partitioned tables cannot be added as parent tables (google_columnar_engine_add must target leaf partitions individually); second, tables with fewer than roughly 5,000 rows or queries hitting an existing B-tree index may still prefer row-store execution. For large OLAP tables where a non-unique index exists solely for analytics, adding those columns to the column store lets you drop the index and remove its write-amplification penalty on the primary.
Part D: Managed Connection Pooling, Transparent Query Forwarding, and LDTM
Scaling to 262,042 client connections on port 6432
Every idle PostgreSQL backend process consumes memory and pollutes snapshot arrays (ProcArray). AlloyDB solves connection storms with Managed Connection Pooling, a built-in, PgBouncer-compatible multiplexer running directly on primary and read pool instances on TCP port 6432.
Managed Connection Pooling is disabled by default and requires roles/alloydb.admin. Enable it at creation or on an existing instance without restarting the database (instances created before November 2024 incur a one-time VPC network update under 15 seconds):
gcloud alloydb instances update INSTANCE_ID \
--project=PROJECT_ID \
--region=REGION_ID \
--cluster=CLUSTER_ID \
--enable-connection-pooling \
--connection-pooling-pool-mode=transaction \
--connection-pooling-max-client-connections=50000 \
--connection-pooling-max-pool-size=100 \
--connection-pooling-query-wait-timeout=120 \
--connection-pooling-stats-users=postgres
Key configuration bounds from the docs:
| Flag | Allowed range | Default | Notes |
|---|---|---|---|
--connection-pooling-pool-mode |
transaction or session
|
transaction |
transaction returns the server connection after each txn |
--connection-pooling-max-client-connections |
1 to 262,042
|
5,000 |
Simultaneous client sockets accepted on port 6432
|
--connection-pooling-max-pool-size |
1 to 262,042
|
50 |
Max backend server connections per (user, database) pair |
--connection-pooling-min-pool-size |
0 to 262,042
|
0 |
Warm server connections kept ready |
--connection-pooling-query-wait-timeout |
0 to 2,147,483 s |
120 s |
Wait limit before rejecting queued client queries |
--connection-pooling-max-prepared-statements |
0 to 262,042
|
0 |
Prepared statement cache in transaction mode |
--connection-pooling-server-idle-timeout |
0 to 2,147,483 s |
600 s |
Idle server connection tear-down |
Note three critical rules:
-
No Public IP: Managed Connection Pooling works over Private Services Access, Private Service Connect, AlloyDB Language Connectors, and AlloyDB Auth Proxy (
--auto-iam-authn, which maintains its own separate poolalloydb_mcp_stats_authproxy_pooler1). It is not supported for Public IP connections orREPLICATIONusers. -
Transaction-mode SQL traps: In default
transactionmode, session-scoped state does not survive across transactions.SET/RESET,LISTEN,WITH HOLD CURSOR, SQLPREPARE/DEALLOCATE,PRESERVE/DELETE ROWtemp tables,LOAD, session-level advisory locks, and protocol-level prepared plans (unless configured) are unsupported. -
Live PgBouncer admin console: Once
--connection-pooling-stats-usersis set, connect to databasealloydb_mcp_stats_1on port6432over private IP and runSHOW POOLS;,SHOW STATS;, andSHOW CLIENTS;.
Port 6432 absorbs connection spikes while Transparent Query Forwarding and Read Pool autoscaling offload heavy SELECT traffic.
Transparent Query Forwarding (Preview) and Read Pool autoscaling
Rewriting a legacy monolith to split READ/WRITE and READ_ONLY endpoints is slow, and reading from an async replica breaks read-your-writes consistency. On PostgreSQL 17 and 18, Transparent Query Forwarding (TQF, in Preview) solves this inside the Primary instance:
-- Enable for the current session or persistently per database (no restart)
SET alloydb.enable_query_forwarding = TRUE;
-- or:
ALTER DATABASE appdb SET alloydb.enable_query_forwarding = ON;
EXPLAIN SELECT count(*) FROM large_table t1, large_table t2;
-- Schematic EXPLAIN suffix when TQF qualifies:
Query Forwarding: Eligible. (overhead=1250.02)
Predict before you look: you enable alloydb.enable_query_forwarding = TRUE on a cluster with a 4-node Read Pool, connect via IAM auth from a Python psycopg service using server-side parameter binding (extended query protocol), and run SELECT id, created_at FROM orders WHERE created_at >= CURRENT_DATE. Does TQF forward it?
No, on three separate grounds! Check the strict TQF disqualifiers from transparent-query-forwarding.md:
-
Built-in auth only: TQF requires a built-in PostgreSQL user (
postgresor password role); IAM authentication is not supported. - Simple query protocol only: Extended query protocol is not supported.
-
No SQL value or volatile functions:
CURRENT_DATE,LOCALTIME,USER,CURRENT_SCHEMA,NEXTVAL(), UDFs, SQL procedures,FOR UPDATErow locks, temp/unlogged/catalog tables, and queries whose forwarding overhead exceeds query cost (such as cheap index scans) stay on the primary.
Watch Cloud Monitoring metric alloydb.googleapis.com/internal/database/postgresql/workload/distributed/tqf_query_count (status=completed, fallback, or disqualified) to verify forwarding rates.
For your Read Pool tier (up to 20 nodes across the cluster), enable autoscaling (Preview) combining CPU utilization, connection count, and cron schedule policies (--autoscaler-set-schedule, --autoscaler-schedule-cron-exp, --autoscaler-schedule-duration-seconds). When multiple policies are active, AlloyDB picks the highest recommended node count and waits 10 minutes below target before scaling in. Remember two limits: existing long-lived connections are not rebalanced onto newly added nodes (use Managed Connection Pooling or reconnect), and new nodes need a few minutes to warm caches.
Low Downtime Maintenance (LDTM): <1s primary, 0s read pool
During system patches, OS updates, or scaling operations, AlloyDB uses Low Downtime Maintenance (LDTM): it provisions replacement servers ahead of time, updates read pools concurrently first (0 seconds of read-pool downtime), and switches the primary in under 1 second. Active connections drop momentarily during the primary switchover, so applications should use connection pooling and exponential backoff. For non-production environments where speed matters more than uptime, gcloud beta alloydb instances update --update-mode=FORCE_APPLY completes machine-type changes faster in 10 to 15 minutes with roughly 1 minute of downtime.
Part E: Zero-ETL Lakehouse (USING iceberg), BigQuery Federation, and Data Agent Kit Medallion
Operational PostgreSQL data rarely lives in isolation. AlloyDB PG 18+ supports three native Zero-ETL and sync patterns alongside Google Cloud's Knowledge Catalog and Data Agent Kit Medallion pipelines.
AlloyDB connects directly to Iceberg in Cloud Storage, pushes SQL down to BigQuery, and participates in Knowledge Catalog and Medallion orchestration.
Pattern 1: Direct Apache Iceberg access (USING iceberg, Preview, PG 18+)
Rather than copying Parquet files out of Cloud Storage, AlloyDB PG 18+ implements a PostgreSQL Table Access Method (USING iceberg) wired directly into the Columnar Engine.
- Grant
roles/storage.objectVieweron the GCS bucket (androles/biglake.viewerif reading via abl://Lakehouse runtime catalog URI in end-user credentials mode) to the cluster service account. - Enable both
google_columnar_engine.enabled=onandgoogle_columnar_engine.enable_iceberg_reads=on(requires restart). - As an
alloydbsuperuser, declare the table and optionally load it into the columnar store:
CREATE TABLE customer_orders (
order_id BIGINT,
customer_id INT,
order_status TEXT,
total_amount DOUBLE PRECISION,
order_date DATE,
is_completed BOOLEAN
)
USING iceberg
WITH (
uri = 'gs://my-iceberg-analytics-bucket/datasets/sales/customer_orders'
);
-- Join Iceberg history with live operational heap tables in standard SQL:
SELECT c.customer_name, SUM(o.total_amount) AS historical_spend
FROM customer_orders o
JOIN customers c ON o.customer_id = c.customer_id
WHERE o.is_completed = true
GROUP BY c.customer_name;
-- Optional: cache in columnar memory (must fit in columnar RAM + SSD cache)
SELECT google_columnar_engine_add('customer_orders');
Know the four boundaries before shipping: USING iceberg is read-only (SELECT only), supports Parquet data files with JSON/Avro metadata (no ORC, no Iceberg v2 delete files or v3 deletion vectors, no ALTER TABLE schema evolution), always reads the latest snapshot on direct scans (ignoring REPEATABLE READ pinning), and requires full table population if loaded into columnar memory. If populating large Parquet row groups throws Columnar engine population heap is full, set SET google_job_scheduler.max_parallel_workers_per_job = 0; in that session before calling google_columnar_engine_add().
Pattern 2 & 3: bigquery_fdw (1.1, GA) vs. alloydb_sync (GA, PG 18)
-
Lakehouse Federation (
bigquery_fdw1.1, GA):bigquery_fdw.enabled=onby default. Maps BigQuery and BigLake tables into PostgreSQL viaCREATE FOREIGN TABLE ... SERVER bigquery_server, pushing downWHEREfilters,SUM/COUNT/AVG/MIN/MAXaggregates, andLIMIT/OFFSETover the BigQuery Storage Read API. Permissions are checked against the AlloyDB cluster service account (not individual IAM database users), and you can isolate BigQuery compute billing to a separateruntime_project. -
Managed BigQuery Sync (
alloydb_sync, GA, PG 18 only): Requiresalloydb_sync.enabled=on(restart),CREATE EXTENSION alloydb_sync;, and abigquery_fdwserver strictly namedbigquery_server. Usealloydb_sync.import_bq_table()for a one-time writable copy, oralloydb_sync.create_bq_sync_table(..., '12 hours', 'replace')for a periodic read-only mirror served locally with read pool scaling. Never runDROP TABLEon a periodic sync table (it orphans background scheduler hooks and leaks worker slots); always remove it withSELECT alloydb_sync.delete_bq_sync_table('public.customer_mirror');.
Governance and Medallion orchestration: Knowledge Catalog + Data Agent Kit
New AlloyDB clusters enable Knowledge Catalog (Dataplex) metadata sync by default (for clusters created or restored on or after April 3, 2026, updates sync in near real-time within 5 minutes). Granting roles/alloydb.viewer alongside a Dataplex Catalog role lets engineers and agents discover schemas via natural language search, attach business aspects (like PII tags), and track Auto-DQ quality rules without querying INFORMATION_SCHEMA manually.
When analytical pipelines land AlloyDB and BigQuery snapshots into a warehouse, Google's Data Agent Kit enforces a strict Medallion architecture:
-
Bronze: Raw full-fidelity immutable archive (ingested via
BigQueryInsertJobOperatoror Data Transfer Service). -
Silver: Type-cast, deduplicated, business-key-resolved truth (
stg_*andint_*CTEs, surgical casts with>1%null-cost assertions rather than blanketSAFE_CAST). -
Gold: Incremental Dataform SQLX aggregates pinned with explicit
uniqueKeyandpartitionBykeys for BI and agents. Gold reads only Silver; reading Gold directly from Bronze is a documented anti-pattern:
-- definitions/gold/daily_inventory.sqlx (illustrative Dataform SQLX pattern)
config {
type: "incremental",
uniqueKey: ["store_id", "sku_id", "event_date"],
bigquery: {
partitionBy: "event_date"
}
}
SELECT store_id, sku_id, event_date, SUM(net_units) AS total_units
FROM ${ref("silver_inventory_events")}
GROUP BY store_id, sku_id, event_date
Generated Cloud Composer (Managed Service for Apache Airflow) DAGs wire BigQueryInsertJobOperator, DataformCreateWorkflowInvocationOperator, PubSubPublishMessageOperator, and SlackWebhookOperator using pendulum timezone-aware schedules and Airflow Assets (formerly Datasets). By design, DAGs are never deployed from the development console: the agent writes them to dags/, a pull request runs CI where the agent parses and validates the DAG, and CD syncs merged code to staging before production. Backfills always bound run counts and concurrency (--limit-dag-runs / --max-active-runs) so replays never saturate the scheduler slot pool.
Decision table
| If you see... | Use... | Because... |
|---|---|---|
Mixed OLTP + heavy SUM/COUNT/hash joins on the same tables |
google_columnar_engine.enabled=on (10.6) + enable_vectorized_join=on
|
Runs SIMD columnar scans and Bloom-filtered joins without ETL |
Repeated JSONB -> / ->> filter predicates burning CPU |
google_columnar_engine.enable_virtual_columns_scan=on + expressions |
Pre-materializes JSON paths inside the columnar store |
EXPLAIN flipping a warm Index Scan to a Seq Scan
|
alloydb.enable_cache_aware_costing=on (Preview) |
Discounts I/O cost based on live shared_buffers residency |
High-concurrency serverless spikes saturating 5432
|
Managed Connection Pooling on port 6432 (transaction mode) |
Multiplexes up to 262,042 client sockets onto small server pools |
| Monolith needing read scaling + read-your-writes consistency |
alloydb.enable_query_forwarding=TRUE (PG 17/18, built-in auth) |
Offloads eligible SELECTs to read pools with primary consistency |
Cold Parquet/Iceberg datasets in GCS (gs://) joined with OLTP |
PG 18+ USING iceberg + enable_iceberg_reads=on
|
Streams or caches Iceberg tables directly via the columnar engine |
| Live BigQuery warehouse queries with minimal data transfer |
bigquery_fdw (1.1, GA) |
Pushes WHERE, aggregates, and LIMIT down to BigQuery |
| Low-latency local serving of BigQuery ML scores or segments | PG 18 alloydb_sync.create_bq_sync_table()
|
Mirrors BigQuery tables locally for Read Pool horizontal scaling |
Legacy N2 cluster hitting memory/IOPS or price-perf limits |
C4A (Axion ARM) or C4 (up to 288 vCPU / 2,304 GB) + Z3 read pools |
Cross-machine-series support lets read pools shift independently |
Try it yourself
-
Catch a columnar rejection in
EXPLAIN. Create a 100,000-row table with aJSONBcolumn on a PG 17/18 instance withgoogle_columnar_engine.enabled=on. RunEXPLAIN (ANALYZE, COLUMNAR_ENGINE)on aWHERE payload->>'tier' = 'enterprise'aggregation before adding columns or virtual expressions, and read theColumnar Check:line. Then add the column and virtual expression viagoogle_columnar_engine_add(), rerunEXPLAIN, and confirmCustom Scan (columnar scan)appears alongsideg_columnar_relationsandg_columnar_virtual_columns. -
Multiplex 5,000 burst clients onto 50 server backends. Enable Managed Connection Pooling (
--enable-connection-pooling --connection-pooling-stats-users=postgres) on a test instance, pointpgbench -C(connect-per-transaction) at port6432vs. port5432, and inspectSHOW POOLS;andSHOW STATS;insidealloydb_mcp_stats_1. Observemaxwaitand server backend reuse. -
Verify TQF eligibility boundaries. On a PG 17/18 cluster with a 1-node Read Pool, run
SET alloydb.enable_query_forwarding = TRUE;over a simple-protocolpsqlconnection aspostgres. CompareEXPLAIN SELECT count(*) FROM big_table;(looking forQuery Forwarding: Eligible.) againstEXPLAIN SELECT count(*) FROM big_table WHERE created_at >= CURRENT_DATE;and confirm whyCURRENT_DATEdisqualifies forwarding.
If you build a benchmark or architecture test on top of these patterns, post it with #AlloyDBSprint.
What's next
You now have the engine internals that keep AlloyDB fast under simultaneous OLTP, HTAP, and connection storms: disaggregated WAL materialization, local SSD index prefetch, Google Columnar Engine 10.6, Managed Connection Pooling on port 6432, and Zero-ETL Lakehouse access.
In Part 5 (AlloyDB Without Lock-In: Omni Local Parity, pglogical, and Exit Portability), we close the loop on architectural sovereignty: running the identical AlloyDB engine locally with AlloyDB Omni, setting up Private Services Access vs. Private Service Connect, executing zero-downtime DMS and pglogical migrations, and verifying cross-region DR and clean exit paths.
Sources and further reading
- AlloyDB architecture and machine series: Overview, Choose a machine type, High availability, Maintenance, Backup overview, OLTP benchmarks
- Storage engine optimizations: Index prefetch overview, Get and analyze execution plans, Cache-aware index scan costing, Adaptive autovacuum
- Google Columnar Engine (
10.6): About, Configure, Virtual columns for expressions, Monitor and tune, Maintain content freshness, Tune maintenance resources - Pooling and read scaling: Managed connection pooling, Transparent query forwarding, Scale an instance and read pool autoscaling
- Zero-ETL, Iceberg, BigQuery, and Governance: Direct Apache Iceberg access, Lakehouse federation (
bigquery_fdw), Sync BigQuery data (alloydb_sync), Knowledge Catalog integration, Supported extensions - Series repository and diagrams: alloydb-sprint-2026





Top comments (0)