To increase Postgres transactions per second and scale without sharding, diagnose the active bottleneck first with
pg_stat_activity,pg_stat_io, andpg_stat_checkpointer. Fix bottlenecks in order: add PgBouncer transaction pooling, drop unused indexes to boost HOT updates, tunemax_wal_sizeandwal_compression, and offload analytical scans to a columnar store like ClickHouse. When network-attached EBS or Aurora caps write throughput, local NVMe (self-hosted EC2 or ClickHouse Managed Postgres, up to 96 vCPU and 60 TB) extends single-primary scale.
PostgreSQL 16-19 internals, PgBouncer 1.26 behavior, AWS EC2/EBS/RDS/Aurora specs, and published benchmarks checked on 2026-11-30. Units follow each vendor's published convention (GiB and TiB for RAM and EBS/RDS/Aurora storage; decimal GB and TB for AWS EC2 local NVMe drives).
Most teams reach for sharding far too early, or they copy outdated postgresql.conf snippets that do nothing for their actual bottleneck. Raising shared_buffers will not move transactions per second (TPS) when 80% of backends are queued on Lock:transactionid or IO:WalSync. Adding read replicas will not rescue a write-bound primary. And migrating a fast self-hosted EC2 instance onto network-attached RDS storage can cut throughput in half overnight.
This playbook covers how to diagnose what actually caps Postgres TPS on PostgreSQL 16 through 19, how to work through the tuning ladder in order from zero-cost SQL fixes to architectural separation, where a single primary actually tops out on local NVMe before sharding, and how teams self-hosting Postgres on EC2 local NVMe can move to managed infrastructure without losing disk speed.
TL;DR
- Measure wait events before touching
postgresql.conf. Usepg_stat_activity,pg_stat_statements,pg_stat_io(PG 16+), andpg_stat_checkpointer(PG 17+) to separate CPU, row locks, WAL flushes, and disk reads. - Pool connections with PgBouncer in transaction mode. Idle Postgres backends consume 1.5 MB to 14.5 MB each, and active backends beyond a few multiples of vCPU cores thrash CPU and
LWLock:ProcArray. PgBouncer 1.24+ enables protocol-level prepared statements by default (max_prepared_statements = 200). - Cut write amplification before relaxing durability. Dropping unused indexes and lowering table
fillfactor(70 to 85 on hot-updated tables) raises Heap-Only Tuple (HOT) update ratios, cutting index writes and WAL volume while keepingRPO = 0. - Stretch checkpoints and compress WAL. Raise
max_wal_sizeandcheckpoint_timeoutto reduce post-checkpoint full-page writes, and setwal_compression = 'lz4'or'zstd'. If you usesynchronous_commit = off, scope it withSET LOCALand account for the3 * wal_writer_delay(600 ms default) crash-loss window. - Evict analytical queries from the OLTP primary. Dashboard scans evict the OS page cache, spill temp files onto the WAL disk, and hold open MVCC
xminsnapshots that blockVACUUMand break HOT updates. Offloading analytics to a columnar engine like ClickHouse raises OLTP write headroom on Postgres. - Know the real single-primary ceiling on local NVMe. On PostgresBench at ~500 GB (16 vCPU, vendor-run, untuned defaults), local-NVMe ClickHouse Managed Postgres reached 26,328 TPS single-node and 20,720 TPS with two synchronous standbys (
RPO = 0), compared to 5,092 TPS single-node and 4,659 TPS Multi-AZ Cluster on EBS-backed RDS. On AWS GA, single-primary local NVMe scales up to 96 vCPU, 768 GiB RAM, and 60 TB before sharding becomes necessary.
Step 0: Diagnose which bottleneck actually caps your Postgres TPS
Every Postgres throughput ceiling shows up in wait events before it shows up in a generic tuning checklist. If you change memory parameters while backends are waiting on WAL fsync or hot-row locks, TPS stays flat and tail latency stays high.
Map wait events to the right fix
Sample pg_stat_activity during peak load to classify where active backends spend wall time. Watch for a subtle version change introduced in PostgreSQL 17: the IO wait events WALSync and WALWrite (PG 16) were renamed to CamelCase WalSync and WalWrite in PG 17 through 19, while LWLock:WALInsert and LWLock:WALWrite kept uppercase WAL.
wait_event_type:wait_event | PG 16 vs. PG 17-19 note | Primary bottleneck | First fix to apply |
|---|---|---|---|
null (on CPU, state = 'active') | Same across PG 16-19 | Query execution, parsing, sorting, or poor plans | Level 1 (prepared statements) and Level 2 (query/index tuning) |
Lock:transactionid or Lock:tuple | Same across PG 16-19 | Hot-row lock contention or long transactions holding locks | Level 2 (shorten transactions, idle_in_transaction_session_timeout) |
LWLock:ProcArray | Same across PG 16-19 | Excessive active connections competing for snapshots | Level 1 (PgBouncer transaction pooling) |
LWLock:WALInsert or LWLock:WALWrite | Uppercase WAL in PG 16-19 | WAL buffer spills, full-page write storms, or backends queued behind fsync | Level 3 (max_wal_size, wal_compression, wal_buffers) and Level 6 (local NVMe) |
IO:WalSync or IO:WalWrite | WALSync / WALWrite in PG 16 | Storage commit latency (fsync) on WAL volume | Level 2 (batch writes), Level 3 (synchronous_commit), Level 6 (local NVMe) |
IO:DataFileRead or IO:DataFileExtend | Same across PG 16-19 | Working set exceeds RAM; random disk reads or table extensions hitting slow storage | Level 2 (indexes, HOT), Level 5 (evict OLAP scans), Level 6 (RAM / local NVMe) |
LWLock:BufferMapping | Same across PG 16-19 | Rapid buffer eviction and cache thrashing | Level 2 (shared_buffers, missing indexes) and Level 5 (isolate OLAP) |
Client:ClientRead (idle in transaction) | Same across PG 16-19 | Chatty N+1 app logic or leaked open transactions | Level 2 (batch round trips, timeout idle transactions) |
Runnable diagnostic queries (PG 16-19)
Run this wait-event snapshot repeatedly over a 60-second peak window (for example with \watch 2 in psql). Using lower(wait_event) works consistently across PostgreSQL 16, 17, 18, and 19.
-- Query 1: Active backend wait-event breakdown (PG 16-19)
SELECT
state,
coalesce(wait_event_type, CASE WHEN state = 'active' THEN 'CPU' ELSE 'None' END) AS wait_type,
coalesce(lower(wait_event), CASE WHEN state = 'active' THEN 'on_cpu' ELSE 'none' END) AS wait_event,
count(*) AS backends
FROM pg_stat_activity
WHERE pid <> pg_backend_pid()
AND backend_type = 'client backend'
GROUP BY 1, 2, 3
ORDER BY backends DESC;Next, pull the top statements by total execution time and I/O time from pg_stat_statements. PostgreSQL 17 renamed blk_read_time and blk_write_time to shared_blk_read_time and shared_blk_write_time (and PG 18 added wal_buffers_full). Both I/O timing columns return 0 unless track_io_timing = on.
-- Query 2: Top TPS-consuming statements (PG 17-19)
-- On PG 16, replace shared_blk_read_time / shared_blk_write_time
-- with blk_read_time / blk_write_time.
SELECT
calls,
round(total_exec_time::numeric, 1) AS total_ms,
round(mean_exec_time::numeric, 2) AS mean_ms,
shared_blks_hit,
shared_blks_read,
round((shared_blk_read_time + shared_blk_write_time)::numeric, 1) AS io_ms,
temp_blks_written,
pg_size_pretty(wal_bytes) AS wal_generated,
left(query, 100) AS query_sample
FROM pg_stat_statements
ORDER BY total_exec_time DESC
LIMIT 15;Now inspect storage I/O and checkpoints. Many older Postgres guides still query checkpoints_timed and checkpoints_req from pg_stat_bgwriter, which throws a column error on PostgreSQL 17, 18, and 19 because checkpoint statistics moved into pg_stat_checkpointer. Similarly, PostgreSQL 18 removed op_bytes from pg_stat_io in favor of read_bytes, write_bytes, and extend_bytes, and moved WAL write and sync timing into pg_stat_io under object = 'wal'.
-- Query 3A: Storage and WAL I/O profile (PG 18-19)
-- Requires track_io_timing = on for non-zero heap/index timing (track_wal_io_timing defaults to on).
-- On PG 16-17, use reads * op_bytes / 1048576.0 (and writes * op_bytes / 1048576.0)
-- and inspect pg_stat_wal for WAL write/sync timing.
SELECT
backend_type,
object,
context,
reads,
round(read_bytes / 1048576.0, 1) AS read_mib,
round(read_time::numeric, 1) AS read_ms,
writes,
round(write_bytes / 1048576.0, 1) AS write_mib,
round(write_time::numeric, 1) AS write_ms,
fsyncs,
round(fsync_time::numeric, 1) AS fsync_ms
FROM pg_stat_io
WHERE reads > 0 OR writes > 0 OR fsyncs > 0
ORDER BY (coalesce(read_time, 0) + coalesce(write_time, 0) + coalesce(fsync_time, 0)) DESC
LIMIT 20;
-- Query 3B: Checkpoint pressure (PG 17-19)
-- On PG 16, query checkpoints_timed, checkpoints_req, checkpoint_write_time,
-- checkpoint_sync_time, and buffers_checkpoint from pg_stat_bgwriter.
SELECT
num_timed,
num_requested,
round(100.0 * num_requested / nullif(num_timed + num_requested, 0), 1) AS pct_requested,
round(write_time::numeric / 1000.0, 1) AS write_sec,
round(sync_time::numeric / 1000.0, 1) AS sync_sec,
buffers_written
FROM pg_stat_checkpointer;
-- Query 3C: Table cache hit ratio (PG 16-19)
-- Note: heap_blks_hit/read live in pg_statio_user_tables, not pg_stat_user_tables.
SELECT
round(
100.0 * sum(heap_blks_hit) / nullif(sum(heap_blks_hit + heap_blks_read), 0),
2
) AS table_cache_hit_pct,
round(
100.0 * sum(idx_blks_hit) / nullif(sum(idx_blks_hit + idx_blks_read), 0),
2
) AS index_cache_hit_pct
FROM pg_statio_user_tables;If pct_requested exceeds 10% to 20%, WAL volume is forcing early checkpoints before checkpoint_timeout expires and generating heavy full-page write traffic. If table_cache_hit_pct or index_cache_hit_pct drops well below 99% while IO:DataFileRead dominates Query 1, your active working set no longer fits in RAM and storage latency now sets your TPS ceiling.
Level 1: Fix connection overhead with PgBouncer transaction pooling
PostgreSQL uses a process-per-connection architecture. Even though PostgreSQL 14 improved ProcArray snapshot scalability at high connection counts, opening hundreds or thousands of direct database connections still degrades TPS in two ways:
- Idle connections consume RAM that should be page cache. AWS Database Blog measurements showed idle Postgres backends consuming between 1.5 MB and 14.5 MB each depending on prepared plans and catalog caches. Five hundred idle connections can pin gigabytes of RAM, shrinking the OS page cache and forcing more
IO:DataFileReadwaits. - Active connection storms collapse throughput. When 300 active backends compete for 16 CPU cores, OS context switches, CPU cache eviction, and
LWLock:ProcArray/LWLock:WALInsertcontention push TPS down as client concurrency climbs.
Two outdated rules still circulate in tuning guides and should be retired:
- Drop the 2012 spinning-disk formula
(CPU cores * 2) + effective_spindle_count. NVMe SSDs and cloud block volumes do not have spinning platters, and modern high-concurrency OLTP workloads with fast storage typically size active server pools around 2x to 4x vCPU cores (validated with load tests against actual wait events). - Drop the legacy 8 GB to 16 GB
shared_bufferscap. That cap dates back to PostgreSQL 9.x and older Linux kernel behavior. On modern 64 GiB to 768 GiB NVMe servers with Linux huge pages enabled (huge_pages = tryoron),shared_bufferscommonly starts at 25% of RAM and scales well past 16 GB when the active working set warrants it.
Transaction pooling and prepared statements (PgBouncer 1.21-1.26)
Put PgBouncer in pool_mode = transaction between application servers and Postgres. PgBouncer holds client sockets at roughly 2 kB per connection and multiplexes thousands of application connections onto a small, fixed pool of Postgres backends (default_pool_size). In OpenAI's January 2026 Postgres scaling write-up, adding PgBouncer reduced average connection setup time from 50 ms to 5 ms.
Several widely cited scaling articles still claim PgBouncer transaction mode breaks prepared statements. That has been outdated since PgBouncer 1.21.0 (October 2023), which added protocol-level prepared statement tracking across pooled server connections. As of PgBouncer 1.24.0 (January 2025, current release 1.26.x), max_prepared_statements defaults to 200 out of the box (older 1.21-1.23 deployments defaulted to 0 and must set it explicitly). After schema DDL that changes column or result types on prepared queries, issue RECONNECT on PgBouncer to avoid cached plan must not change result type errors.
Keep session-bound workloads (schema migrations, LISTEN consumers, and long admin sessions) on a direct port or dedicated session pool. In pool_mode = transaction:
- Compatible: Protocol-level prepared statements (
max_prepared_statements > 0),SET LOCALinside a transaction,ON COMMIT DROPtemporary tables,NOTIFY,WITHOUT HOLDcursors, and transaction-level advisory locks (pg_advisory_xact_lock). - Incompatible: Session-level
SET/RESET,LISTEN,WITH HOLDcursors, SQL-levelPREPARE/DEALLOCATE(exceptDEALLOCATE ALLandDISCARD ALL),PRESERVE ROWS/DELETE ROWStemp tables,LOAD, and session-level advisory locks (pg_advisory_lock).
Scaling past a single PgBouncer core
PgBouncer is single-threaded and uses one CPU core per process. On high-concurrency workloads, especially with TLS termination and prepared-statement packet rewriting, a single PgBouncer process becomes the TPS bottleneck well before Postgres runs out of CPU.
In ClickHouse's July 2026 peered PgBouncer fleet benchmark (running pgbench in select-only, transaction-pooled mode across three EC2 boxes with a 16-vCPU c7i.4xlarge pooler), a single PgBouncer process peaked at 86,570 select-only TPS at 64 clients (saturating one core while host CPU stayed at 8.3%) and degraded to 76,893 TPS at 256 clients. Running a 16-process PgBouncer fleet sharing one port via so_reuseport = 1 with PgBouncer peering (peer_id + [peers], which forwards query cancellations to the owning process) scaled select-only, transaction-pooled throughput to 336,469 TPS at 256 clients (~4.4x the single process at 256 clients). Note that this benchmark isolates connection-pooler throughput on select-only queries, not durable write-heavy TPC-B TPS.
Level 2: Eliminate write amplification, lock contention, and bloat
Once connections are pooled, the largest free TPS gains come from reducing the amount of physical I/O each transaction forces Postgres to perform.
Boost HOT (Heap-Only Tuple) updates and drop unused indexes
Because PostgreSQL uses MVCC, every UPDATE writes a new tuple version. Normally, that new row version forces Postgres to insert a new pointer into every index defined on the table, multiplying random page writes, WAL bytes, and index bloat.
A Heap-Only Tuple (HOT) update skips all index updates completely and allows opportunistic in-page dead-tuple pruning during normal reads without waiting for VACUUM. Per the PostgreSQL storage documentation, an UPDATE qualifies for HOT only when two conditions hold:
- The
UPDATEmodifies no column referenced by any index on the table (PostgreSQL 16+ exempts summarizing indexes such asBRIN). - There is free space on the same 8 kB heap page as the old row version.
By default, Postgres tables use fillfactor = 100, packing pages full during INSERTs and leaving zero room for HOT updates. On update-heavy tables, dropping redundant indexes that touch frequently mutated columns and lowering fillfactor to 70 through 85 raises write TPS with zero durability trade-off:
-- Query 4A: Find update-heavy tables with low HOT update ratios (PG 16-19)
SELECT
schemaname,
relname,
n_tup_upd,
n_tup_hot_upd,
round(100.0 * n_tup_hot_upd / nullif(n_tup_upd, 0), 1) AS hot_pct,
n_dead_tup,
pg_size_pretty(pg_relation_size(relid)) AS heap_size
FROM pg_stat_user_tables
WHERE n_tup_upd > 10000
ORDER BY (n_tup_upd - n_tup_hot_upd) DESC
LIMIT 15;
-- Query 4B: Find candidate unused non-unique indexes burning write IOPS (PG 16-19)
-- Verify idx_scan = 0 on ALL read replicas as well before dropping.
SELECT
s.schemaname,
s.relname AS table_name,
s.indexrelname AS index_name,
s.idx_scan,
pg_size_pretty(pg_relation_size(s.indexrelid)) AS index_size
FROM pg_stat_user_indexes s
JOIN pg_index i ON s.indexrelid = i.indexrelid
WHERE s.idx_scan = 0
AND NOT i.indisunique
AND NOT i.indisprimary
AND NOT i.indisexclusion
AND pg_relation_size(s.indexrelid) > 10485760 -- > 10 MiB
ORDER BY pg_relation_size(s.indexrelid) DESC
LIMIT 20;Changing ALTER TABLE orders SET (fillfactor = 80); affects only newly written pages. To apply it to existing heap pages without an ACCESS EXCLUSIVE outage, use pg_repack on PG 16-18 or PostgreSQL 19's built-in REPACK (CONCURRENTLY) command (introduced in PG 19.0, released November 19, 2026). Always verify idx_scan = 0 across every read replica before dropping an index, because replica queries do not increment primary pg_stat_user_indexes counters.
Fix transaction patterns, memory traps, and autovacuum lag
- Batch writes to amortize WAL
fsync. Replacing 100 single-rowINSERTtransactions with one multi-rowINSERT ... VALUES,UNNESTbatch, orCOPYcuts WAL flush round trips and network overhead by up to two orders of magnitude. - Kill leaked idle transactions. Set
idle_in_transaction_session_timeout = '30s'(or tighter for OLTP APIs). An openidle in transactionsession holds row locks (Lock:transactionid) and blocksVACUUMfrom reclaiming dead tuples across the database. - Scope
work_memcarefully. Some scaling articles suggest setting globalwork_mem = 256MBto1GB. Never set that globally on a high-concurrency OLTP primary: Postgres allocateswork_memper sort or hash node, per parallel worker, per active query. Keep globalwork_memmodest (for example 16 MB to 64 MB) and raise it per role or per transaction (SET LOCAL work_mem = '256MB') only for known reporting sessions. - Tune autovacuum per hot table. Lower
autovacuum_vacuum_scale_factorto0.01to0.05on large, high-churn tables so dead tuples get cleaned before bloat doubles heap size. PostgreSQL 17 replaced vacuum's fixed 6-byte dead-tuple array (and its 1 GB memory cap) withTidStore, and PostgreSQL 19 added parallel autovacuum across table indexes (autovacuum_max_parallel_workers), removing two historical vacuum bottlenecks on large write-heavy tables.
Level 3: Tune WAL, checkpoints, and commit durability
Every durable write transaction in Postgres appends records to the write-ahead log (WAL) and waits for fsync before acknowledging COMMIT. Under heavy write load, default checkpoint and WAL settings trigger severe write amplification.
Stop full-page write storms with checkpoint and WAL tuning
With full_page_writes = on (the default), the first modification to any 8 kB page after a checkpoint logs the entire 8 kB page image into WAL to protect against torn pages during a power failure or OS crash. Never disable full_page_writes or fsync in production; PostgreSQL's documentation explicitly warns that disabling either can cause silent or unrecoverable database corruption after a crash.
When max_wal_size stays at its 1 GB default on a busy server, Postgres triggers checkpoints every minute or two. Every checkpoint resets the full-page-write cycle, flooding disk bandwidth with 8 kB page images and forcing LWLock:WALInsert and IO:WalWrite waits.
| Parameter | Default | Production OLTP starting range | Version & behavior notes (PG 16-19) |
|---|---|---|---|
max_wal_size | 1 GB | 16 GB to 64 GB (up to 128 GB+ on high-write NVMe) | Stretches checkpoint intervals and cuts full-page write volume. Trade-off: longer crash recovery time and more WAL disk space. |
min_wal_size | 80 MB | 4 GB to 16 GB | Recycles existing WAL segments during normal bursts instead of allocating new files. |
checkpoint_timeout | 5min | 15min to 30min | Pair with larger max_wal_size so checkpoints are timed (num_timed), not WAL-forced (num_requested). |
checkpoint_completion_target | 0.9 | 0.9 (keep default) | Spreads dirty-buffer writes across 90% of the checkpoint interval (default since PG 14). |
wal_compression | off | 'lz4' or 'zstd' | Compresses full-page images safely. lz4 and zstd were added in PG 15; PG 19 changed on to auto-select zstd > lz4 > pglz (on PG 15-18, on uses slower pglz). |
wal_buffers | -1 (auto) | 32 MB to 64 MB if wal_buffers_full > 0 | Auto-tunes to 1/32 of shared_buffers, capped at 16 MB. On PG 18+, check pg_stat_statements.wal_buffers_full. |
commit_delay / commit_siblings | 0 / 5 | Leave 0 unless pg_test_fsync shows slow flush at low concurrency | Adds a microsecond pause before XLogFlush to batch commits. High concurrency already gets natural group commit. |
io_method (AIO) | worker (PG 18+) | worker or io_uring (Linux, tested) | PG 18 added static io_workers (default 3); PG 19 removed io_workers and replaced it with auto-scaling io_min_workers (2) / io_max_workers (8). |
Keep expectations realistic for PostgreSQL 18 and 19 Asynchronous I/O (io_method = worker or io_uring): AIO pipelines read-stream operations such as sequential scans, bitmap heap scans, and vacuum (plus GIN/hash vacuum in PG 19). It does not make synchronous WAL writes or checkpoints asynchronous, parallelize dependent random B-tree index lookups, or reduce total IOPS consumed.
The exact crash-loss window for synchronous_commit = off
Many tuning guides recommend setting synchronous_commit = off globally to double write TPS, often claiming you lose "only a few milliseconds" or "a few seconds" on a crash. The exact behavior in PostgreSQL's asynchronous commit documentation is stricter and cleaner:
synchronous_commithas five modes:remote_apply(wait for standby replay),on(wait for local flush plus synchronous standby flush if configured),remote_write(standby OS write),local(local WAL flush only, ignoring sync standbys), andoff(returnCOMMITimmediately before local WAL flush).- Exact crash-loss window: Because the background WAL writer flushes unwritten WAL every
wal_writer_delay(default200ms) and favors whole pages under load, PostgreSQL documents the maximum data-loss window as3 * wal_writer_delay(600 msat the default200ms, or longer if storage stalls). - Zero corruption risk: Unlike
fsync = off,synchronous_commit = offnever corrupts the database. On restart, Postgres recovers to a clean transaction boundary and simply loses transactions from that trailing window. - Scope it per transaction: You do not have to compromise financial or order data globally. Keep
synchronous_commit = onat the cluster level and runSET LOCAL synchronous_commit = off;strictly inside high-volume, reconstructible write transactions (telemetry events, click logs, ephemeral session updates). If you needRPO = 0across all writes, moving WAL onto local NVMe reducesfsynclatency by roughly an order of magnitude compared to network-attached EBS without turning off synchronous commits.
Level 4: Partitioning, read replicas, and caching (and where each stops helping)
When single-query tuning, pooling, HOT updates, and WAL tuning are done, five architectural levers scale a growing application without sharding. Each solves a specific bottleneck and fails abruptly when applied to the wrong one.
| Strategy | What it accelerates | Hard limit / when it breaks | Operational gotcha to watch |
|---|---|---|---|
| Declarative partitioning | Keeps active partition indexes inside RAM; replaces bulk DELETE + VACUUM with instant DROP / DETACH. | Zero relief on single-primary WAL write ceiling. All partitions still serialize through one primary WAL stream. | Hundreds of unpruned partitions inflate planning time and per-session catalog memory; even init-pruned partitions acquire locks at execution start. Every PRIMARY KEY and UNIQUE constraint must include the partition key. |
| Streaming read replicas | Scales read QPS horizontally across multiple nodes; isolates reporting queries from primary CPU. | Zero write scaling. Every physical replica replays 100% of primary WAL and pays full write I/O. | Replication lag breaks read-your-own-writes. max_standby_streaming_delay (30s default) cancels long standby reads, while enabling hot_standby_feedback = on prevents cancels by holding back primary VACUUM and bloating the primary. |
| Application caching (Redis / Valkey) | Eliminates repeated hot-key reads before they reach Postgres. | Zero acceleration for OLTP writes or commits. Unhelpful for unique lookups or ad-hoc filters. | Cache invalidation bugs, dual-write drift, and cache-stampede thundering herds on key expiry (mitigated via cache leasing/locking, as documented by OpenAI). Adds another stateful cluster to operate. |
| Analytical (OLAP) offload | Removes wide scans, sorts, and long snapshots from Postgres; frees RAM, disk IOPS, and VACUUM headroom for OLTP writes. | Eventual consistency (typically sub-second to seconds-level lag); separate analytical storage and billing. | Logical-replication CDC uses a replication slot on Postgres (monitor max_slot_wal_keep_size so a stopped consumer never fills primary disk). |
| Vertical scaling on local NVMe | Multiplies single-primary durable write TPS and random-read IOPS when dataset exceeds RAM; preserves full ACID SQL without sharding. | Bounded by top VM shape (up to 96 vCPU / 768 GiB RAM / 60 TB NVMe on ClickHouse Managed Postgres AWS GA). | Local NVMe is ephemeral on host loss; durability requires cross-AZ synchronous replication + WAL archiving, and storage resizes require a brief failover cutover. |
Use declarative partitioning for time-series or append-heavy tables where 95% of queries hit recent partitions and old data expires cleanly; keep partition counts modest on OLTP primaries so planner overhead and lock acquisition stay low. Use read replicas when SELECT traffic dominates and the application can route write-followed-by-read flows to the primary. Use Redis or Valkey for hot, cacheable read keys with clear invalidation rules. None of these three removes the single-primary write ceiling or stops mixed analytical queries from destabilizing the primary.
Level 5: Offload analytical queries to multiply OLTP TPS
Offloading analytical queries is rarely treated as a write-TPS optimization, yet running aggregations, customer-facing dashboards, or AI agent scans directly against a busy Postgres primary crushes transactional write throughput through three internal mechanisms:
- OS page cache eviction. PostgreSQL stores rows in 8 kB pages containing all columns. Even though Postgres uses a small 256 kB ring buffer for sequential scans to protect
shared_buffersfrom complete wipeout, scanning tens of gigabytes of historical rows still churns the Linux OS page cache where Postgres expects 60% to 75% of RAM caching to live. Hot OLTP index leaf pages and recent heap pages get evicted, turning sub-millisecond reads intoIO:DataFileReadstalls. - Temp-file IOPS contention against WAL. Analytical hash joins, sorts, and
GROUP BYqueries that exceedwork_memspill gigabytes intobase/pgsql_tmp. Those temp reads and writes compete directly withpg_walfsynccommits and checkpointer flushes for the same storage IOPS queue. - MVCC
xminhorizon pinning that breaksVACUUMand HOT updates. While an analyticalSELECTruns for seconds or minutes, its open snapshot pins PostgreSQL's globalxminhorizon.VACUUMcannot reclaim any dead tuples created after that snapshot began, even on completely unrelated OLTP tables. Dead tuples fill heap pages, HOT updates fail, every OLTPUPDATEmust touch every index on the table, and write TPS collapses long after the dashboard query finishes. Moving dashboards onto a streaming read replica withhot_standby_feedback = onsends that exactxminhorizon right back to the primary, causing the same bloat.
You can check right now whether long snapshots or temp spills are degrading your primary:
-- Query 5: Detect long-running snapshots holding back VACUUM xmin and temp spills (PG 16-19)
SELECT
pid,
usename,
application_name,
state,
now() - xact_start AS xact_age,
backend_xmin,
left(query, 90) AS query_sample
FROM pg_stat_activity
WHERE backend_xmin IS NOT NULL
AND now() - xact_start > interval '30 seconds'
ORDER BY xact_age DESC;
-- Check cumulative temp file spills per database
SELECT
datname,
temp_files,
pg_size_pretty(temp_bytes) AS temp_written
FROM pg_stat_database
WHERE datname = current_database();In a public case study from Shipsidekick, pointing an AI agent's analytical reads at the Postgres primary pushed CPU to 40% to 50% immediately. As founder and CEO Sawyer Bateman noted: "I was like, okay, wake-up call. Your AI reads can impact your primary performance." For deeper architectural patterns on isolating dashboards and preventing replication-slot disk exhaustion, see offloading customer-facing analytics from Postgres and separating OLTP and OLAP workloads.
Separating OLTP and OLAP within ClickHouse Cloud
When Postgres needs both high transactional TPS and fast analytical queries over fresh operational data, you can run ClickHouse Managed Postgres for transactions and ClickHouse for columnar analytics within ClickHouse Cloud, keeping the two engines physically separate so analytical scans never evict Postgres buffers or pin Postgres xmin:
- ClickPipes Postgres CDC (GA): Managed initial load plus continuous logical replication (powered by open-source PeerDB) from Postgres into ClickHouse, scaling from 1 to 24 cores. ClickPipes compute is free when ClickHouse Managed Postgres is the source (cross-region transfer is billed as egress). Trade-offs: the analytical copy is eventually consistent with seconds-level freshness, it uses a logical replication slot on Postgres (consuming source CPU/I/O and requiring slot-lag monitoring), and ClickHouse analytical compute and storage are billed separately.
- WalShadow (Private Preview on ClickHouse Managed Postgres, open source at
ClickHouse/walshadow): Consumes physical WAL directly like a physical standby and decodes it outside Postgres in Rust into ClickHouse blocks, eliminating logical replication slots and supporting complex DDL. In ClickHouse's vendor benchmark on an 8-vCPUc8i.2xlargesingle-table workload, WalShadow achieved ~200 ms commit-to-visible latency (compared to ~10 s for PeerDB) and sustained 289,000 rows/s. Trade-offs: Private Preview only (free during preview, post-preview pricing not finalized, currently limited to 1 pipeline per Postgres service), still asynchronous and eventually consistent, and billed separately for ClickHouse capacity. pg_clickhouse(pre-installed on ClickHouse Managed Postgres): Open-source PostgreSQL foreign-data-wrapper extension that lets Postgres clients query ClickHouse tables with SQL pushdown. Per ClickHouse's overview documentation and repo benchmarks, 14 of 22 TPC-H queries push down as single foreign scans, running over 60x faster than standard Postgres on pushed-down queries. Trade-offs: 6 of 22 TPC-H queries in the repository README do not push down cleanly (and some unpushed queries ran slower through the FDW than native Postgres), so always inspectEXPLAINplans and route high-concurrency BI dashboards directly to ClickHouse.
As Graham Cantor-Cooke, Principal Engineer at Clay Inc., described the combined setup in the GA announcement: "ClickHouse Managed Postgres and WALShadow opens up a new way of thinking about databases at Clay. The raw speed of NVMe combined with low latency replication to ClickHouse allows us to build high throughput operational systems with massive scale real time visibility, unlocking experiences for customers that simply weren't possible in the past." If you are already keeping a competing Postgres provider and only need the CDC migration path into ClickHouse, see moving analytical queries from PostgreSQL to ClickHouse.
Level 6: Quantifying the single-primary vertical ceiling before sharding (network storage vs. local NVMe)
Vertical scaling is often dismissed with vague bounds like "millions of transactions per day" (roughly 11 to 100 TPS), pushing teams straight from PgBouncer toward sharding. At the other extreme, viral benchmark headlines like "4 million TPS" create unrealistic expectations: the widely cited Scaling Postgres Episode 324 result was 3.75 million read-only primary-key SELECTs against a 10-million-row in-RAM table over local Unix sockets on 364 vCPUs with pg_stat_statements disabled. That tells you nothing about durable write TPS when a 500 GB database spills out of RAM.
Why network-attached storage caps TPS early (Little's Law)
When your active dataset exceeds RAM, two operations serialize on storage latency: WAL fsync commits (IO:WalSync / LWLock:WALWrite) and dependent random 8 kB index-to-heap reads (IO:DataFileRead). By Little's Law (IOPS = Queue Depth / I/O Latency), per-backend throughput at queue depth 1 is inversely proportional to single-I/O latency:
- AWS EBS
gp3(~1 ms typical latency): ~1,000 serial ops/s per waiting backend (five cache-missing page reads add ~5 ms to one query). - AWS EBS
io2 Block Express(<500 us average for 16 KiB I/O): ~2,000 serial ops/s per waiting backend. - Direct-attached AWS Nitro local NVMe (<50 us normal read latency per AWS Compute Blog): ~20,000 serial ops/s per waiting backend, a 10x to 20x per-operation latency advantage before even counting aggregate IOPS caps.
ClickHouse's September 2026 Postgres on NVMe study isolated this storage effect on identical 16-vCPU AWS m6id.4xlarge hosts (64 GiB RAM, PostgreSQL 18.3, shared_buffers = 16 GB, 482 GiB heap, 64 clients doing random single-row UPDATEs). Local NVMe sustained 16,030 median TPS (4.0 ms per UPDATE, 14% of backends in IO:DataFileRead, ~9.4 cores busy) compared to 1,734 median TPS on EBS gp3 (36.9 ms per UPDATE, 45% of backends parked in IO:DataFileRead, ~1 core busy), a 9.2x gap, with VACUUM of 10 GB bloat running 2.6x faster (366 s vs. 964 s). Important caveat: the EBS arm ran at baseline gp3 (3,000 IOPS), whereas RDS gp3 at 400 GiB+ starts at 12,000 baseline IOPS and provisioned io2 scales higher at additional cost. For the full breakdown of RDS volume striping at 400 GiB, gp3 vs. io2 pricing, and EC2 instance-level EBS caps, see Postgres IOPS limits on RDS and EBS.
Published PostgresBench ceilings: ~100 GB, ~500 GB, and production HA
To see where managed Postgres providers top out on a realistic out-of-RAM transactional workload, the table below summarizes ClickHouse's published PostgresBench (April 2, 2026, best of 3 runs) and PostgresBench HA (July 21, 2026, Run 3) results on github.com/ClickHouse/PostgresBench. Both benchmarks are vendor-run by ClickHouse using pgbench TPC-B-like write-heavy tests (-c 256 -j 16 -T 600 -M prepared) in AWS us-east-2 with default untuned provider settings, without comparing pricing. Single-node runs disable HA; HA topologies differ across providers (Aurora's reader and RDS Multi-AZ DB Cluster's two standbys serve read queries, whereas ClickHouse Managed Postgres standbys do not serve reads).
| Provider & 16-vCPU Tested Config | ~100 GB Single-Node TPS (p99) | ~500 GB Single-Node TPS (p99) | 100 GB -> 500 GB Drop | ~500 GB HA Config | ~500 GB HA TPS (p99) |
|---|---|---|---|---|---|
ClickHouse Managed Postgres (m8gd.4xlarge, 16 vCPU / 64 GiB RAM, 950 GB local NVMe) | 28,668 (11.68 ms) | 26,328 (13.20 ms) | -8.2% | 1 standby async 2 standbys sync ( RPO = 0) | 24,667 (24.17 ms) 20,720 (33.49 ms) |
Crunchy Bridge (Standard-64, 16 vCPU / 64 GiB RAM, gp3 20k base / 40k max IOPS) | 14,790 (34.61 ms) | 11,113 (41.68 ms) | -24.9% | 1 standby async | 11,135 (41.89 ms) |
Amazon Aurora PostgreSQL (db.r6g.4xlarge, 16 vCPU / 128 GiB RAM, Aurora storage) | 12,628 (39.04 ms) | 10,402 (46.49 ms) | -17.6% | 1 writer + 1 reader (3-AZ storage) | 9,520 (39.92 ms) |
| Neon (16 vCPU / 64 GiB RAM, distributed pageserver storage) | 8,563 (49.21 ms) | 7,802 (56.30 ms) | -8.9% | Single compute + multi-AZ storage | 7,802 (56.30 ms) |
Amazon RDS for PostgreSQL (db.m8gd.4xlarge (see note), 16 vCPU / 64 GiB RAM, 1,000 GiB gp3 16k IOPS) | 8,133 (97.69 ms) | 5,092 (117.91 ms) | -37.4% | Multi-AZ Instance (1 sync, RPO = 0)Multi-AZ Cluster (2 sync, RPO = 0) | 4,461 (221.69 ms) 4,659 (816.63 ms) |
Note on RDS db.m8gd.4xlarge: On RDS for PostgreSQL, local NVMe holds temporary objects only (rds_temp_tablespace). All table heap, index, and WAL I/O hit the 1,000 GiB gp3 EBS volume.
Two patterns stand out in this data:
- Small cached workloads do not require local NVMe. On the 4 vCPU / ~100 GB single-node run in the same PostgresBench publication, Crunchy Bridge led ClickHouse Managed Postgres at 6,338 TPS vs. 6,172 TPS (85.84 ms vs. 80.89 ms p99). When your working set fits mostly in RAM or compute is small, standard block-storage providers perform competitively.
- Disk-bound throughput and synchronous HA separate local NVMe from network storage. As data grew from ~100 GB to ~500 GB (~7.8x RAM), RDS
gp3lost 37.4% of its throughput and Crunchy Bridge lost 24.9%, while ClickHouse Managed Postgres dropped 8.2%. Even after paying the cross-AZ synchronous quorum cost (RPO = 0across 2 standbys), ClickHouse Managed Postgres sustained 20,720 TPS at 33.49 ms p99: 4.64x the throughput of RDS Multi-AZ Instance (4,461 TPS, 221.69 ms p99), 4.45x RDS Multi-AZ Cluster (4,659 TPS, 816.63 ms p99), and 2.18x Aurora HA (9,520 TPS, 39.92 ms p99).
How high a single primary scales before sharding
That 26,328 TPS single-node / 20,720 TPS 0-RPO HA result came from a mid-tier 16-vCPU / 64 GiB instance (m8gd.4xlarge). On AWS GA (effective November 9, 2026), ClickHouse Managed Postgres spans 50+ local-NVMe VM configurations from r6gd.medium (1 vCPU, 8 GiB RAM, 59 GB NVMe: $63.07/mo Basic or $71.48/mo Scale in us-east-1, 730 hours) and m8gd.4xlarge ($1,144.87/mo single node, $3,434.62/mo 3-node 0-RPO HA, Scale tier) up to i8ge.24xlarge (ARM Graviton4, $14,135.84/mo single node, Scale tier) and i7ie.24xlarge (x86-64, $15,482.07/mo single node, Scale tier) at 96 vCPU, 768 GiB RAM, and 60 TB local NVMe with $0 per-I/O request fees and $0 provisioned IOPS charges.
Real migrations reflect that vertical headroom on disk-bound apps:
- Infinitas Learning migrated a 750 GB database in under 16 hours; Engineering Manager Jerome van den Heuvel reported: "Our P50 latency is now measured in double-digit microseconds instead of milliseconds, and P99 latency in double-digit milliseconds instead of seconds."
- Clera moved a 500 GB / 500+ table database (now approaching 1 TB), dropping primary CPU from 100% to 10%-20%.
- Shipsidekick moved ~500 GB off Neon, cutting peak CPU from 100% to 5%-10% and lifting cache hit rate from 30%-35% to 99%.
For further background on how compute-colocated storage changes real-time Postgres latency, see how local NVMe eliminates network-storage I/O latency. For throughput-normalized $/1,000 TPS pricing across Aurora Standard, Aurora I/O-Optimized, RDS, and flat-rate managed Postgres providers, see Aurora I/O costs and flat-pricing managed Postgres compared.
Self-hosting Postgres on EC2? How to get managed parity with local NVMe
When teams ask "We self-host Postgres on EC2, what is the best managed option that is just as fast?", most online guides and AI answers default to saying Amazon RDS runs the same Postgres engine on the same EC2 hardware, so performance is identical. That holds only if your EC2 instance stores PGDATA and pg_wal on EBS.
If you self-host Postgres on EC2 local NVMe instance-store families (i4i, i7i, i8g, r8gd, m8gd) for raw speed, moving to EBS-backed RDS or Aurora creates an immediate I/O latency regression.
The 16-vCPU AWS storage gap (checked 2026-11-30)
AWS enforces EBS limits at both the volume level and the DB instance level. On RDS for PostgreSQL, gp3 is capped at 3,000 IOPS below 400 GiB and stripes across four volumes at 400 GiB+ (12,000 IOPS baseline, up to 64,000 IOPS; note that RDS for PostgreSQL did not inherit raw EC2 gp3's September 2025 80,000 IOPS single-volume update). Even if you provision 64,000 gp3 IOPS or 256,000 io2 IOPS on a volume, a 16-vCPU RDS instance caps sustained EBS IOPS at 20,000, bursting to 40,000 for only 30 minutes once every 24 hours.
| 16-vCPU AWS Option | RAM (GiB) | Durable PGDATA & pg_wal Storage | Local NVMe Role | Storage IOPS Ceiling (Published AWS Specs) | Typical Single-I/O Latency |
|---|---|---|---|---|---|
Self-hosted EC2 i8g.4xlarge / i7i.4xlarge | 128 | 1 x 3,750 GB 3rd-gen Nitro NVMe | Primary data + WAL | 600,000 read / 330,000 write (4 KiB random) | <50 us normal read |
Self-hosted EC2 i4i.4xlarge | 128 | 1 x 3,750 GB Nitro NVMe | Primary data + WAL | 400,000 read / 220,000 write (4 KiB random) | Sub-100 us |
Self-hosted EC2 m8gd.4xlarge / r8gd.4xlarge | 64 / 128 | 1 x 950 GB Nitro NVMe | Primary data + WAL | 268,333 read / 134,167 write (4 KiB random) | <50 us normal read |
Amazon RDS db.r8g.4xlarge / db.m8gd.4xlarge | 128 / 64 | Network EBS (gp3 or io2) | db.m8gd/r8gd: temp objects only (rds_temp_tablespace) | 20,000 sustained / 40,000 30-min burst (instance EBS cap, 16 KiB) | ~1 ms (gp3) / <500 us (io2) |
Amazon Aurora db.r8gd.4xlarge | 128 | 3-AZ 6-way distributed storage (4-of-6 write quorum) | Temp objects + I/O-Optimized tiered read cache only (never WAL/writes) | Distributed storage (write commits wait on IO:XactSync quorum) | ~1-3+ ms cross-AZ commit quorum |
ClickHouse Managed Postgres (m8gd/r8gd/i8g.4xlarge) | 64 / 128 | Direct-attached AWS Nitro local NVMe (same EC2 families) | Primary data + WAL (automated WAL-G + cross-AZ sync quorum HA) | Full local NVMe of underlying EC2 shape ($0 per-I/O, $0 provisioned IOPS) | <50 us local read + cross-AZ sync RTT if RPO = 0 HA enabled |
Watch out for a common misconception about RDS Optimized Reads and Aurora Optimized Reads: both use local NVMe on r6gd/r8gd/m8gd/r6id instances to accelerate temporary files (and on Aurora I/O-Optimized, a tiered read cache). Neither stores table writes or pg_wal on local NVMe. Durable writes and fsync still cross the network.
Why teams leave self-hosted EC2 NVMe (and how managed options compare)
AWS EC2 instance-store data survives an OS reboot, but is cryptographically erased on instance stop, hibernate, terminate, OS shutdown, scheduled retirement, or underlying SSD failure. Self-hosting production Postgres on EC2 local NVMe means your team owns six demanding systems: automated host replacement and base-backup rebuilds, cross-AZ synchronous quorum HA (Patroni + consensus + fencing), continuous WAL archiving to S3 and regular PITR restore drills, failover-orchestrated storage resizes and Postgres upgrades, a peered multi-process PgBouncer fleet, and OS/CVE patching. For broader operational and labor comparisons, see self-hosted vs. managed PostgreSQL.
When choosing a managed landing zone from EC2, match the provider to your actual storage profile:
- If your EC2 workload runs on EBS (
gp3/io2) or fits in RAM: Amazon RDS for PostgreSQL has deep operational maturity, native AWS IAM/networking/procurement integration, and in-place storage expansion up to 64 TiB. Amazon Aurora PostgreSQL gives you 3-AZ distributed storage durability up to 256 TiB, fast failover, up to 15 read replicas, and Serverless v2 elasticity. Crunchy Bridge runs close-to-upstream Postgres with broad extension and configuration control, multi-cloud support, and Crunchy Data Warehouse (DuckDB). Neon fits dev, preview, and intermittent workloads where instant copy-on-write branching and scale-to-zero save money. See AWS RDS alternatives and Amazon Aurora alternatives for high-volume ingestion for deeper comparisons. - If your EC2 workload depends on local NVMe (
i4i,i7i,i8g,r8gd,m8gd): On AWS, ClickHouse Managed Postgres runs standard PostgreSQL (versions 17, 18, and 19, full superuser access, 90+ extensions, bundled peered PgBouncer on port 6432) directly on those same AWS Nitro local-NVMe families (m8gd,r8gd,i8g,i8ge,i7i,i7ie) while automating cross-AZ synchronous quorum HA (up to 2 standbys,RPO = 0), daily WAL-G backups plus 60 s / 16 MB WAL archiving, and storage autoscaling (notify at 85%, provision replacement at 90%, cut over by 95%). On Azure, Aiven for PostgreSQL introduced Storage-Optimized local-NVMe plans in October 2026 (for examplebusiness-128-so-3475gbHA at$6,200/mo, rated at 180,000+ IOPS) alongside its unified multi-cloud control plane.
Trade-offs of ClickHouse Managed Postgres
Evaluate ClickHouse Managed Postgres with its real operational boundaries on the table:
- Cloud availability: Generally Available on AWS (since November 9, 2026). Google Cloud is in Private Preview (unbilled during preview, post-preview pricing not yet finalized, GA coming soon with no date). Azure is not available (planned, no date).
- VM-coupled storage and resize cutover: Because storage is tied to the EC2 local-NVMe VM shape, scaling storage or compute provisions a new replacement node, replays WAL, and runs a failover cutover (~30 seconds for manual vertical scaling, typically under a minute for storage autoscaling). Open client connections drop during cutover and must reconnect cleanly.
- Standbys do not serve reads: By design, HA standbys never serve read traffic so read queries cannot stall WAL replay or trigger
hot_standby_feedbackbloat on the primary. Use dedicated read replicas (Scale tier and above; WAL-shipped from object storage by default, or streaming replication via support) for read scaling. - 60 TB single-instance storage ceiling: Maximum local NVMe per instance is 60 TB (
i8ge.24xlarge/i7ie.24xlarge), below RDS's 64 TiB and Aurora's 256 TiB limits.
When sharding is genuinely unavoidable
Only after you have pooled connections, eliminated unused indexes and low-HOT update churn, tuned WAL/checkpoints, isolated analytical queries onto a columnar store, and evaluated local-NVMe vertical headroom up to 96 vCPU / 768 GiB RAM / 60 TB should you pay the operational tax of sharding (losing cross-shard joins, foreign keys, and global unique constraints, and adding distributed transactions or application routing).
Sharding is genuinely justified when one of four hard thresholds hits:
- Sustained durable write volume saturates a top-tier NVMe primary even after pooling, HOT optimization, batching, and OLAP offload (for example, saturating
LWLock:WALInsertand single-primary commit throughput on 64-96 vCPU local NVMe). - Active working dataset outgrows single-node storage or recovery-time (RTO) windows (approaching 60 TB NVMe or taking too long to restore a full base backup within your SLA).
- Strict multi-region data residency requires active local writes in EU, US, and APAC simultaneously.
- Tenant blast-radius isolation requires physically separate databases per enterprise customer (cell-based or database-per-tenant sharding, which avoids distributed SQL coordinators).
For patterns on tenant-keyed isolation and sharding when you do cross that threshold, see partitioning and sharding multi-tenant Postgres as a last resort, and for a full vendor evaluation checklist beyond throughput, see how to choose a managed Postgres provider. To benchmark your own workload on local-NVMe managed PostgreSQL, you can test ClickHouse Managed Postgres on AWS with a 30-day free trial ($300 in credits).
Sources
All specifications, PostgreSQL internals, and benchmark figures were checked on 2026-11-30:
- PostgreSQL 19 Monitoring Stats (
pg_stat_activity,pg_stat_io,pg_stat_checkpointer) - PostgreSQL 19 WAL Configuration & Asynchronous Commit and Async Commit
- PostgreSQL 19 HOT Storage (
storage-hot.html) and Table Partitioning - PostgreSQL Release Notes: PG 16.0, PG 17.0, PG 18.0, PG 19.0
- PgBouncer Features, Config, and Changelog (1.21-1.26)
- AWS EC2 Storage-Optimized Instance Specs (
i4i,i7i,i7ie,i8g,i8ge) and Instance Store Lifetime - AWS RDS Storage (
CHAP_Storage.html) and RDS DB Instance Class Specifications - Amazon Aurora Storage Reliability and Aurora Optimized Reads
- AWS Compute Blog: Detailed NVMe Statistics (2025-11-19) and AWS Database Blog: Idle PostgreSQL Connections
- OpenAI Engineering: Scaling PostgreSQL to power 800 million ChatGPT users (2026-01-22)
- ClickHouse: PostgresBench Single-Node (2026-04-02), PostgresBench HA (2026-07-21), and GitHub: ClickHouse/PostgresBench
- ClickHouse: Postgres on NVMe (2026-09-21) and Scaling PgBouncer in ClickHouse Managed Postgres (2026-07-01)
- ClickHouse: Introducing WalShadow (2026-09-10) and ClickHouse Managed Postgres GA on AWS (2026-11-09)
- ClickHouse Managed Postgres Docs: Overview, Scaling, High Availability, Read Replicas, and Pricing
FAQ
How do I increase Postgres transactions per second?
Start by sampling pg_stat_activity wait events, pg_stat_statements, pg_stat_io, and pg_stat_checkpointer (PG 17+) to find the active bottleneck. Then work in order: add PgBouncer transaction pooling, drop unused indexes and lower fillfactor to boost HOT updates, batch writes, raise max_wal_size with wal_compression = 'lz4', offload analytical scans, and move disk-bound primaries from network EBS onto local NVMe.
How do I scale Postgres for a fast-growing app without sharding?
Combine five non-sharding layers before splitting writes: PgBouncer transaction pooling (multi-process with so_reuseport past ~87K select-only TPS), query and HOT-update tuning, declarative partitioning plus read replicas and Redis for read load, analytical offloading to a columnar engine like ClickHouse so reporting scans stop evicting cache and blocking VACUUM, and vertical scaling on local NVMe up to 96 vCPU, 768 GiB RAM, and 60 TB.
How do I make my Postgres database faster?
Measure where time goes first using EXPLAIN (ANALYZE, BUFFERS) and pg_stat_statements (with track_io_timing = on). Fix missing indexes, N+1 round trips, and idle in transaction locks; pool connections through PgBouncer; tune autovacuum and max_wal_size to stop bloat and checkpoint storms; keep hot working sets in RAM; and move I/O-bound tables off throttled network block storage onto local NVMe.
We self-host Postgres on EC2; what is the best managed option that is just as fast?
If your EC2 database uses EBS (gp3 or io2), Amazon RDS, Aurora, or Crunchy Bridge matches similar storage physics. If you self-host on EC2 local NVMe (i4i, i7i, i8g, r8gd, m8gd), EBS-backed RDS caps 16-vCPU instances at 20,000 sustained EBS IOPS and uses NVMe only for temp files. ClickHouse Managed Postgres runs directly on AWS local NVMe with managed quorum HA and WAL-G backups.
Which managed Postgres has the highest transactions per second?
In ClickHouse's published vendor-run PostgresBench tests at ~500 GB on 16 vCPU (AWS us-east-2, untuned defaults), ClickHouse Managed Postgres achieved 26,328 TPS single-node (13.20 ms p99) and 20,720 TPS with 2-standby synchronous HA (33.49 ms p99), ahead of Crunchy Bridge (11,113 / 11,135), Aurora (10,402 / 9,520), Neon (7,802), and RDS gp3 (5,092 / 4,659). On 4 vCPU / ~100 GB, Crunchy Bridge led (6,338 vs. 6,172 TPS).
Is it safe to set synchronous_commit = off to boost Postgres TPS?
Setting synchronous_commit = off never corrupts a PostgreSQL database (unlike fsync = off), because crash recovery restores a consistent transaction boundary. However, acknowledged commits in the trailing 3 * wal_writer_delay window (600 ms at the default 200ms) can be lost on a server crash. Keep synchronous_commit = on globally and apply SET LOCAL synchronous_commit = off only inside non-financial, reconstructible transactions.
Why does offloading analytics to ClickHouse increase Postgres write TPS?
Analytical queries hurt Postgres write TPS in three ways: full scans evict hot OLTP pages from the OS page cache, large sorts spill temp files onto the same disk queue as WAL fsync, and long-running SELECT snapshots pin global backend_xmin, blocking VACUUM and breaking HOT updates across OLTP tables. Replicating operational tables into ClickHouse via ClickPipes or WalShadow removes all three sources of contention.