A PostgreSQL deployment can pass its failover test and still fail its users when a reader returns stale data, a maintenance event resets connections, or a restore procedure has never been exercised.

TL;DR

  • Problem: Identical feature-matrix checkmarks hide incompatible operational contracts across read routing, local NVMe SSD caching, planned maintenance drops, and PITR log retention.
  • Answer: Classify read queries by freshness contract, match local SSD features to actual bottlenecks (temp spills vs. L2 page cache), and size PITR and fallback load-shedding explicitly.
  • Watch out: Cloud SQL read pools route to any healthy node regardless of replication lag, and Enterprise Plus near-zero planned maintenance empties UNLOGGED tables.

PostgreSQL write, read scaling, and recovery paths

Situation

Enterprises comparing Amazon RDS for PostgreSQL with Google Cloud SQL often begin with vCPU count, RAM, storage size, and whether high availability is enabled. Those baseline specs establish whether the instance starts, but day-two production stability depends on four operational subsystems: how applications route reads, how local NVMe SSDs accelerate queries, what planned maintenance interrupts, and how long transaction logs remain available for point-in-time recovery (PITR).

The first two articles in this series covered zonal high availability and cross-region disaster recovery. This final article compares the production operating model around those protections across Amazon RDS for PostgreSQL and Cloud SQL Enterprise and Enterprise Plus. Aurora and AlloyDB are excluded.

The Problem

A feature name rarely defines the application contract. A reader endpoint may distribute requests across replicas sitting at different WAL replay positions. A local SSD may accelerate temporary sort spills in one cloud and cache durable table pages in another. A planned maintenance target may describe a sub-second connection blip while silently truncating unlogged tables or dropping active transactions.

Four concrete operational constraints govern production behavior across RDS and Cloud SQL:

  1. Lag-blind read routing: Google documents that a healthy Cloud SQL Enterprise Plus read-pool node receives traffic regardless of its replication lag, and successive queries in a logical session can hit nodes at different replay positions—causing application state to appear to move backward.
  2. Reader fallback load amplification: If an application offloads 4,000 read QPS to a 2-node read pool while the primary serves 1,000 write QPS, failing all reads back to the primary during a replica outage jumps primary load by (4,000 + 1,000) / 1,000 = 5x, turning a reader incident into a writer outage unless non-critical reads are shed.
  3. PITR log retention ceiling: Cloud SQL Enterprise caps PITR transaction log retention at 1 to 7 days, whereas Cloud SQL Enterprise Plus and Amazon RDS both support 1 to 35 days of automated PITR log retention.
  4. Maintenance interruption and state loss: Cloud SQL Enterprise Plus targets under 1 second of connectivity interruption for eligible planned maintenance, but empties UNLOGGED tables during the operation; RDS Blue/Green Deployments cut over in 5 seconds or less (2 seconds or less with the AWS Advanced JDBC Driver), yet still terminate open connections with AdminShutdown errors during switchover.

Operational contracts depend on lag routing, SSD role, and PITR

A comparison spreadsheet that puts “yes” in both columns conceals these runtime contracts. How should an enterprise translate an existing RDS PostgreSQL operating model into a Cloud SQL design that satisfies the same workload requirements?

Options Considered

Translating an RDS operating model to Cloud SQL requires matching each workload path—read scaling, local NVMe storage, planned upgrades, and PITR retention—rather than copying instance classes one-for-one.

Operational PathAmazon RDS OptionCloud SQL OptionKey Behavioral TradeoffWhy Chosen or Rejected
Read ScalingIndividual read replicas or Multi-AZ Cluster readerIndividual replicas or Ent.+ read poolsCloud SQL read pools route regardless of lag; RDS Cluster readers are semisyncRoute strict freshness to primary; use pools or replicas only for lag-tolerant reads
Local NVMe SSDOptimized Reads (temp spills & REINDEX)Enterprise Plus Data Cache (L2 page cache)RDS speeds sorts/temp tables; Cloud SQL caches table/index pagesChoose by bottleneck: temp-heavy ETL vs. working sets larger than RAM
Planned UpgradesRDS Maintenance or Blue/Green (<=5s cutover)Enterprise Plus near-zero maint (<1s)Blue/Green stages major upgrades; Ent+ empties unlogged tables on maintUse Blue/Green for risky major upgrades; audit unlogged tables on Ent+
Backup & PITRAutomated PITR (1–35d) + AWS BackupEnt. PITR (1–7d) or Ent.+ PITR (1–35d)Cloud SQL Enterprise 7-day cap forces Ent+ if 30-day PITR is requiredSelect Ent+ when compliance requires >7 days of point-in-time recovery

Production operations require independent choices per path

The most common migration mistake is selecting Cloud SQL Enterprise when compliance requires 14 to 35 days of PITR, or assuming Cloud SQL Data Cache replaces RDS Optimized Reads for sort-heavy batch jobs. Separating those four choices up front prevents costly tier upgrades or application rewrites after cutover.

Map the Workload to Independent Paths

A resilient PostgreSQL operating model separates write authority, read offload, backup/PITR retention, and observability into independent paths with distinct service objectives. The diagram below shows the logical separation; physical endpoints depend on the chosen edition and topology.

PostgreSQL write, read scaling, and recovery paths

flowchart TD
    A[Application — writes and freshness-sensitive reads] --> B[PostgreSQL primary]
    C[Application — lag-tolerant reads] --> D[Read replicas or eligible read pool]
    B -->|asynchronous replication| D
    B --> E[Backups and recovery logs]
    B --> F[Metrics, logs, and alerts]
    D --> F
    E --> G[Restore and validation exercise]

Read capacity is not a freshness guarantee

RDS offers standalone read replicas with individual endpoints and Multi-AZ DB clusters with a shared reader endpoint across two readable standbys. Cloud SQL offers standalone read replicas in both editions and managed read pools (with optional autoscaling) in Enterprise Plus. Adding readers scales CPU and I/O capacity, but it introduces a strict correctness question: how stale can a successful query result be?

Google documents that a healthy Cloud SQL read-pool node receives traffic regardless of its replica_lag or replica_byte_lag, and that successive requests in the same user session can land on nodes at different WAL replay positions. Furthermore, when Enterprise Plus read-pool autoscaling spins up a new node during a traffic spike, that cold node can exhibit elevated initial lag while catching up. Consequently, a healthy TCP connection to a reader never proves data freshness.

Classify every read query by contract. Order confirmations, balance checks, and read-after-write UI reloads belong on the primary unless the application tracks WAL LSN positions explicitly. Dashboards, search facets, and reporting queries can target readers if replication lag is alerted and the product accepts bounded staleness. Equally important, never configure blind fallback from readers to the primary without load shedding; verify that the primary can survive fallback traffic or drop non-essential reads first.

Local SSD is not one universal feature

On eligible NVMe-backed RDS PostgreSQL instance classes, Optimized Reads places PostgreSQL temporary objects—such as sort spills, hash joins, temporary tables, and REINDEX scratch files—on local NVMe storage, relieving network-attached EBS bandwidth during heavy analytical or maintenance queries.

RDS accelerates temp spills; Cloud SQL caches working-set reads

Cloud SQL Enterprise Plus Data Cache uses local SSDs for a completely different path: it acts as an L2 read cache between PostgreSQL shared_buffers (and OS page cache) and Persistent Disk. Google documents that reads check main memory first, then the local SSD Data Cache, and finally Persistent Disk, while writes commit to Persistent Disk and update the Data Cache simultaneously. Data Cache is enabled by default on new Enterprise Plus instances and can be encrypted with Customer-Managed Encryption Keys (CMEK).

Because these features target different bottlenecks, benchmark production-like query plans rather than comparing feature names. Measure temp_bytes written, buffer hit ratios, and storage IOPS limits for your specific machine series and region.

Maintenance changes the application contract

Cloud SQL Enterprise Plus provides near-zero downtime for eligible planned maintenance and scaling operations, targeting less than 1 second of connectivity interruption. However, Google explicitly notes that active workload shape and client retry behavior can increase observed downtime, read replicas have separate constraints, and UNLOGGED tables are emptied after the near-zero maintenance operation completes.

On AWS RDS, minor upgrades and parameter changes follow standard Multi-AZ failover windows, while RDS Blue/Green Deployments create a synchronized staging environment for major upgrades or schema changes. Current RDS Blue/Green optimizations typically complete writer switchover in 5 seconds or less (or 2 seconds or less with the AWS Advanced JDBC Driver), briefly placing the Blue primary in read-only mode (AdminShutdown) while Green catches up. Neither mechanism eliminates the need for extension compatibility checks or client reconnect testing.

Backup retention is not point-in-time recovery

Retaining daily or monthly snapshots for years does not mean every second in that period is available for PITR. Point-in-time recovery requires a valid base backup plus continuous WAL segments within the configured retention window: 1 to 35 days on Amazon RDS and Cloud SQL Enterprise Plus, or 1 to 7 days on Cloud SQL Enterprise. Long-term compliance retention beyond 35 days on AWS requires AWS Backup or manual snapshot copies, which restore to static snapshot timestamps rather than arbitrary seconds.

Check replica lag, PITR log retention, and extension parity directly in PostgreSQL and via provider CLI before approving production cutover:

-- Inspect replication lag on the primary and verify whether unlogged tables exist
SELECT application_name, state, sync_state,
       pg_wal_lsn_diff(pg_current_wal_lsn(), replay_lsn) AS replay_lag_bytes
FROM pg_stat_replication;

SELECT relname FROM pg_class WHERE relpersistence = 'u';
# Configure 35-day PITR transaction log retention on Cloud SQL Enterprise Plus
gcloud sql instances patch my-entplus-pg \
  --enable-point-in-time-recovery \
  --retained-transaction-log-days=35

How It Rolls Out

Translating or upgrading a production PostgreSQL operating model requires a four-stage validation sequence before production traffic relies on it.

Operational readiness requires staged fallback and restore drills

  1. Classify and route reads: Audit application queries and tag each repository method as PRIMARY_REQUIRED (strict read-after-write) or READER_ELIGIBLE (lag-tolerant). Verify that READER_ELIGIBLE queries point to the read replica or Cloud SQL read pool and never silently mutate state.
  2. Test reader fallback and load shedding: Simulate a read-pool or replica failure in staging under representative QPS. Measure primary CPU and connection count during fallback; if primary utilization exceeds 75%, implement circuit-breaking or feature-flag load shedding for non-critical reads before production launch.
  3. Simulate planned maintenance and upgrades: Trigger an RDS Blue/Green switchover or a Cloud SQL maintenance simulation while running active connection pools. Confirm that pools recover from AdminShutdown or transient socket resets within your latency SLO, and verify that no durable workflow depends on UNLOGGED tables.
  4. Execute a timed PITR restore drill: Restore a production-representative backup to an isolated VPC environment at a specific timestamp. Verify extension availability (pg_stat_statements, pgvector, postgis), IAM/role permissions, network peering, and record the total elapsed time from restore command to first valid application query.

Repeat stages 3 and 4 after every major PostgreSQL engine upgrade or machine-class migration; hardware and engine-version changes routinely alter restore times and extension behavior.

In Practice

Google’s documented Cloud SQL read-pool routing behavior enables a direct, falsifiable operational test without waiting for a customer incident: write a monotonically increasing counter value to the primary, then immediately issue sequential SELECT queries through the read-pool endpoint while logging both inet_server_addr() and the returned counter value. Under induced write load or artificial replay delay, you can observe successive queries landing on different pool nodes and returning older counter values—proving why session-level consistency cannot rely on a read pool. This test design is derived directly from Cloud SQL’s documented routing behavior rather than a claimed customer outage.

For planned maintenance and Blue/Green upgrades, running the provider’s simulation against a bare psql client hides real-world failure modes. Include your actual application connection pool, sidecar proxies (such as Cloud SQL Auth Proxy or PgBouncer), and background worker queues in the test. A database engine that completes switchover in 2 to 5 seconds can still appear unavailable for minutes if a worker queue crashes on AdminShutdown and enters an exponential backoff loop.

For local SSD evaluation, avoid comparing advertised raw NVMe IOPS in isolation. Run EXPLAIN (ANALYZE, BUFFERS) on your top 10 slowest queries on both candidate machine classes: if Buffers: shared read dominates and fits inside the Data Cache footprint, Cloud SQL Data Cache directly reduces disk latency; if Sort Method: external merge Disk or temp_bytes dominates, RDS Optimized Reads targets that exact I/O path.

Where It Breaks

Production PostgreSQL operations degrade silently when teams assume feature parity across clouds without testing edge cases.

Lagging pools, fallback stampedes, and unlogged tables break ops

ConditionBreaks HowDetectMitigate
Read pool serves lagging nodeCloud SQL routes to any healthy node regardless of lagRising replica_lag or stale-read user reportsRoute strict freshness queries to the primary
State moves backwardSuccessive reads hit pool nodes at different LSNsMonotonic ID regressions in client telemetryPin read-after-write flows to primary or use LSN checks
Reader fallback stampedeReader outage dumps 100% of read QPS onto primaryPrimary CPU/connections spike during reader incidentCapacity-test fallback and shed non-critical reads
Wrong local SSD assumptionTeam expects Data Cache to speed sorts or Optimized Reads to cache tablesHigh temp_bytes or persistent disk read latencyMatch feature to EXPLAIN (ANALYZE, BUFFERS) profile
Maintenance breaks poolsAdminShutdown or <1s blip leaves hung sockets or crashed workersError spike outlasting provider maintenance windowTest pool eviction and worker reconnect on simulated maint
Unlogged tables emptiedCloud SQL Ent+ near-zero maintenance truncates UNLOGGED tablesEmpty lookup/session tables after maintenance eventQuery relpersistence = 'u' and ban durable state there
PITR window too shortCloud SQL Enterprise 7-day cap misses 14-day corruption discoveryRestore target timestamp falls outside retained WALUse Cloud SQL Ent+ or RDS for up to 35-day PITR
Untested restore or extensionsMissing extension or slow WAL replay blows past RTORestore drill fails or exceeds target recovery windowRun quarterly timed PITR drills in isolated VPC

Key Takeaways

  • Health does not equal freshness on read pools: Cloud SQL read pools route to any healthy node regardless of replication lag, so sequential reads can move backward unless freshness-sensitive queries target the primary.
  • Local SSD features solve opposite bottlenecks: RDS Optimized Reads accelerates temporary sort and REINDEX spills, while Cloud SQL Enterprise Plus Data Cache accelerates L2 table and index page reads.
  • Reader fallback can take down your primary: Always load-test or shed non-critical read traffic before failing reader endpoints back to the writer.
  • Unlogged tables do not survive Cloud SQL Ent+ maintenance: Audit pg_class for relpersistence = 'u' and treat unlogged tables strictly as disposable scratch space.
  • PITR retention differs by edition: Verify whether your compliance window fits Cloud SQL Enterprise’s 7-day ceiling or requires Enterprise Plus or RDS (up to 35 days), and time your restore drills.

What to Do Next

  • Problem: Inventory every production workflow’s read-freshness contract, temporary-disk vs. working-set I/O profile, maintenance tolerance, and required PITR retention window.
  • Solution: Map each requirement independently to RDS or Cloud SQL features—separating primary reads, lag-tolerant readers, local SSD role, and backup retention.
  • Proof: Run EXPLAIN (ANALYZE, BUFFERS) benchmarks, a read-pool lag test, a simulated maintenance or Blue/Green cutover, and a timed PITR restore in staging.
  • Action: Check pg_stat_replication and relpersistence = 'u' on your current PostgreSQL primary this week, and lock the verified restore runbook into your upgrade checklist.

Sources to Verify