PostgreSQL Database Performance Benchmarking for APAC Retail Data

Key Takeaways
- pgbench measures hardware, not your workload — custom `-f` scripts measure reality.
- Report p99 latency and `--latency-limit` failures, not mean TPS.
- PostgreSQL 16-18 added pg_stat_io, leaner vacuum, and async I/O.
- Warehouses win on unavoidable full scans; Postgres wins on bounded indexed queries.
- Benchmark a tuned Postgres before pricing Snowflake or BigQuery.
Quick Answer: PostgreSQL database performance benchmarking starts with pgbench for a hardware baseline, then custom -f scripts weighted to your real query mix. Report p99 latency and SLA breaches, not mean TPS. Most APAC retail analytics workloads stay on a tuned single Postgres node longer than teams assume.
A listed Greater China jewellery retailer came to us with a quarter-end problem, not a database problem. Their merchandising team needed stock-and-margin views across roughly 200 counters in three markets, and the report took long enough that nobody ran it twice. The engineering instinct was to move the whole thing to a cloud warehouse. The finance instinct was to ask what that costs per month, forever.
Related reading: Shopify Plus Enterprise Fit & Cost Comparison for APAC Brands
That tension is why PostgreSQL database performance benchmarking matters commercially and not just academically. Before you migrate an analytical workload off Postgres, you should know — with numbers from your own hardware and your own row counts — where Postgres actually falls over. In most APAC retail pipelines we have worked on, that cliff arrives later than teams assume.
Related reading: Salesforce OAuth Token Security Breach Mitigation for APAC Teams
Related reading: Agentic Commerce Protocol ChatGPT Checkout: APAC Build Guide
Related reading: Shopify Plus vs Adobe Commerce: 2026 Comparison for APAC
Related reading: Shopify Plus APAC Merchant Case Studies: The Monitoring Gap
The key finding: most APAC retail analytics workloads are smaller than the hardware can handle
Here is the headline. A single modern Postgres instance handles the transactional and light-analytical load of a multi-country retail chain with tens of millions of order lines, provided the schema, indexes and I/O path are tuned. The decision point is not row count — it is concurrency of heavy scans and the cost of keeping them fast.
Supporting evidence, in order of usefulness:
- Postgres is now the default. The Stack Overflow Developer Survey 2024 put PostgreSQL at the top of the most-used database list, used by roughly 49% of professional developers — up from about 46% the prior year (Stack Overflow). DB-Engines named it DBMS of the Year for 2023, its fourth such award (DB-Engines).
- Single-node write throughput is high. DBOS benchmarked workflow execution on a single Postgres server and reported sustained throughput in the thousands of durable writes per second before hitting limits (DBOS).
- Version-to-version gains are real but query-shaped. BenchANT's PostgreSQL 16 evaluation found improvements concentrated in specific query types rather than across the board (BenchANT).
- Reproducibility is the hard part. ClickHouse's PostgresBench work exists precisely because pgbench results published without full configuration disclosure are not comparable between vendors (ClickHouse).
The practical read: if someone shows you "Postgres benchmark results" without the instance type, scale factor, client count and shared_buffers setting, those numbers are decoration.
pgbench measures TPC-B, which is not your retail workload
pgbench ships with Postgres and runs a TPC-B-like workload by default — four statements per transaction against four tables (PostgreSQL docs). It is excellent for validating hardware and configuration. It tells you almost nothing about whether your margin-by-SKU query is fast.
Start with the baseline anyway, because you need a sanity check on the box:
1# scale 1000 ≈ 100M rows in pgbench_accounts (scale × 100,000)2pgbench -i -s 1000 -h db.internal -U bench retail_bench34# 10-minute read-write run, 64 clients, 8 worker threads5pgbench -c 64 -j 8 -T 600 -P 30 --progress-timestamp retail_bench67# read-only variant for cache/CPU ceiling8pgbench -c 64 -j 8 -T 600 -S retail_bench
AWS's own PostgreSQL benchmark observations use exactly this pattern on r5-class instances and are worth reading for the methodology, particularly the note that client count must exceed vCPU count before you see saturation (AWS).
The scale factor matters more than people expect. At scale 1000 the dataset is roughly 15 GB; if your instance has 64 GB of RAM, you are benchmarking memory, not storage. Set scale so the dataset is two to three times RAM if you want an honest I/O number.
Ready to Transform Your Ecommerce Operations?
Branch8 specializes in ecommerce platform implementation and AI-powered automation solutions. Contact us today to discuss your ecommerce automation strategy.
Custom pgbench scripts are where the real signal lives
The feature that turns pgbench from a hardware probe into a workload simulator is -f. You write SQL that looks like your application, with variables, and weight each script.
1-- file: order_line_rollup.sql2\set store random(1, 200)3\set days random(7, 90)4SELECT s.store_code,5 sum(ol.qty * ol.unit_price) AS gross,6 sum(ol.qty * ol.unit_cost) AS cogs7FROM order_line ol8JOIN orders o ON o.id = ol.order_id9JOIN store s ON s.id = o.store_id10WHERE o.store_id = :store11 AND o.placed_at >= now() - (:days || ' days')::interval12GROUP BY 1;
1# 85% point lookups, 15% rollups — mirrors observed production mix2pgbench -c 40 -j 8 -T 900 \3 -f lookup.sql@85 \4 -f order_line_rollup.sql@15 \5 --latency-limit=2000 retail_prod_clone
--latency-limit is the parameter most teams skip. It counts transactions that exceeded your SLA rather than burying them in a mean. For a merchandising dashboard, p99 latency is the number the business feels; mean TPS is the number that looks good in a slide.
Pair every run with pg_stat_statements so you can attribute cost:
1SELECT query, calls, mean_exec_time, rows,2 shared_blks_hit, shared_blks_read3FROM pg_stat_statements4ORDER BY mean_exec_time * calls DESC5LIMIT 20;
Since PostgreSQL 16, pg_stat_io gives a cluster-wide view of read, write and extend operations by backend type — which is how you tell a vacuum storm from genuine query I/O (PostgreSQL 16 release notes).
Recent releases moved the ceiling, and the gains are concentrated in I/O
Three releases matter for anyone benchmarking in 2025 and planning for 2026:
- PostgreSQL 16 added
pg_stat_ioand allowed parallel execution of FULL and RIGHT outer joins — useful for the join-heavy rollups retail analytics produces (PostgreSQL). - PostgreSQL 17 rebuilt vacuum's dead-tuple storage, with the project reporting substantially lower memory consumption for the same workload, plus improvements to WAL write throughput under concurrency (PostgreSQL 17 announcement).
- PostgreSQL 18 introduced asynchronous I/O, including an
io_uringbackend on Linux, which targets exactly the sequential-scan pattern that analytical queries generate (PostgreSQL 18 documentation).
If you benchmarked Postgres for analytics on version 13 or 14 and concluded it could not cope, that conclusion has an expiry date. Re-run it. The migration you shelved may be unnecessary; the migration you approved may have been premature.
Ready to Transform Your Ecommerce Operations?
Branch8 specializes in ecommerce platform implementation and AI-powered automation solutions. Contact us today to discuss your ecommerce automation strategy.
The Postgres-versus-warehouse decision is about scan economics, not capability
Snowflake and BigQuery are columnar, vectorised and separate storage from compute. On a full-table aggregate over a billion rows, they win, and it is not close. Google publishes BigQuery's architecture around Dremel and Colossus, built for exactly this (Google Cloud); Snowflake's multi-cluster virtual warehouse model is documented similarly (Snowflake).
The honest trade-off for an APAC retail group:
Postgres wins on latency for bounded, indexed queries
A dashboard filtered to one store and 90 days touches a small fraction of the table. With a BRIN or partial index and table partitioning by month, Postgres answers in single-digit to low-double-digit milliseconds. A warehouse pays per-query startup cost on a cold virtual warehouse — Snowflake documents auto-suspend and resume behaviour that adds seconds to the first query (Snowflake). For an interactive tool used by 200 counter managers, that difference is the entire user experience.
Warehouses win when scans are unavoidable
Year-over-year basket analysis across all stores, all SKUs, no filter. Postgres will read the heap. Even with parallel workers, you are bound by storage bandwidth. This is where columnar compression and distributed scan earn their licence fee.
Data residency changes the arithmetic in APAC
This is the factor global teams under-weight. Running a Postgres instance in ap-east-1 (Hong Kong) or ap-southeast-1 (Singapore) is straightforward. Running a warehouse where the data must stay in a specific jurisdiction — PIPL in mainland China, Singapore's PDPA, Australia's Privacy Act — means checking region availability per feature, not per product. We have seen pipeline designs where the warehouse was adopted globally and a Postgres instance still ran in-market because a required feature was not GA in the region.
The extension path avoids the binary choice
Postgres is extensible in ways that blur the boundary. TimescaleDB for time-partitioned retail metrics, pg_duckdb or DuckDB alongside for columnar scans over Parquet in object storage, or ClickHouse fed by logical replication. ClickHouse's own PostgresBench documentation is a reasonable starting point for understanding where the handoff should sit (ClickHouse).
A benchmarking method that produces defensible numbers
Four runs, in this order. Anything less and you are guessing.
- Hardware baseline.
pgbench -i -s Nthen-Sread-only at increasing client counts. Find where TPS stops rising. That is your CPU and memory ceiling. - Write baseline. Default TPC-B workload at the same client counts. Divergence from the read-only curve exposes WAL and checkpoint configuration problems.
- Workload replay. Custom
-fscripts weighted to matchpg_stat_statementsfrom production. Report p50, p95, p99 and the--latency-limitfailure count — not mean TPS. - Degradation test. Run step 3 while a bulk nightly load and
VACUUM ANALYZEexecute concurrently. This is the run that predicts your 2 a.m. incident, and it is the one almost everyone skips.
Disclose configuration with every result: instance type, storage class and provisioned IOPS, shared_buffers, work_mem, max_parallel_workers_per_gather, random_page_cost, scale factor, client count, thread count and duration. On SSD-backed storage, leaving random_page_cost at the default of 4.0 pushes the planner toward sequential scans it does not need; 1.1 is the common starting point (PostgreSQL docs).
Ready to Transform Your Ecommerce Operations?
Branch8 specializes in ecommerce platform implementation and AI-powered automation solutions. Contact us today to discuss your ecommerce automation strategy.
What the data does not support
Two claims circulate that benchmarks do not back.
That Postgres is obsolete. It is the most-used database among professional developers per Stack Overflow's 2024 survey and has gained adoption share, not lost it (Stack Overflow). The academic comparison literature — including the 2024 MDPI benchmark of PostgreSQL against MySQL — continues to treat it as the reference point, not the legacy option (MDPI).
That one engine is universally faster. Published Postgres-versus-MySQL and Postgres-versus-SQL Server comparisons split by workload shape: MySQL/InnoDB often leads on simple primary-key reads at high concurrency, Postgres leads on complex joins, CTEs, window functions and concurrent write patterns thanks to its MVCC implementation. Vendor-published benchmarks, including EnterpriseDB's Postgres-versus-MongoDB series, should be read with the sponsor in mind (EnterpriseDB).
What to do Monday morning
1. Install pg_stat_statements and capture a week of production query mix. Without it, your benchmark workload is invented. One line in shared_preload_libraries and a restart. Pull the top 20 queries by mean_exec_time * calls — that list is your benchmark script.
2. Run the pgbench baseline against a production-sized clone, not a laptop. Scale factor at two to three times RAM, read-only and read-write, client counts from 1× to 4× vCPU. Thirty minutes of work gives you the ceiling you have been arguing about in planning meetings.
3. Price the warehouse against the tuned Postgres, not the untuned one. Before you commit to Snowflake or BigQuery credits, re-run step 2 on PostgreSQL 17 or 18 with partitioning and random_page_cost corrected. In our experience with regional retail and dealer-network systems, a meaningful share of "we need a warehouse" conclusions trace back to a missing index and a default configuration file — and a benchmark that was never run on current hardware.
PostgreSQL database performance benchmarking is not a one-off exercise you file after a migration decision. Re-run it each major version and each time your row counts double. The ceiling keeps moving, and so does the cheapest place to put your data.
If you are weighing a Postgres-versus-warehouse decision across multiple APAC markets and want the benchmark run before the procurement conversation, talk to Branch8 about a data architecture review.
Ready to Transform Your Ecommerce Operations?
Branch8 specializes in ecommerce platform implementation and AI-powered automation solutions. Contact us today to discuss your ecommerce automation strategy.
Sources
- PostgreSQL — pgbench Documentation
- PostgreSQL — Release Notes Index
- PostgreSQL — Query Planning Configuration
- Stack Overflow — 2024 Developer Survey
- DB-Engines — PostgreSQL is the DBMS of the Year 2023
- ClickHouse — Engineering Blog (PostgresBench)
- Google Cloud — BigQuery Introduction
- Snowflake — Product Documentation
FAQ
Start by installing pg_stat_statements to find which queries actually consume time, then fix those specifically rather than tuning blindly. The highest-yield changes are usually correct indexes, table partitioning on time columns, setting random_page_cost to around 1.1 on SSD storage, and sizing shared_buffers and work_mem to the instance. Upgrading to PostgreSQL 17 or 18 also brings vacuum memory and asynchronous I/O improvements that benefit scan-heavy analytics.
About the Author
Matt Li
Co-Founder & CEO, Branch8 & Second Talent
Matt Li is Co-Founder and CEO of Branch8, a Y Combinator-backed (S15) Adobe Solution Partner and e-commerce consultancy headquartered in Hong Kong, and Co-Founder of Second Talent, a global tech hiring platform ranked #1 in Global Hiring on G2. With 12 years of experience in e-commerce strategy, platform implementation, and digital operations, he has led delivery of Adobe Commerce Cloud projects for enterprise clients including Chow Sang Sang, HomePlus (HKBN), Maxim's, Hong Kong International Airport, Hotai/Toyota, and Evisu. Prior to founding Branch8, Matt served as Vice President of Mid-Market Enterprises at HSBC. He serves as Vice Chairman of the Hong Kong E-Commerce Business Association (HKEBA). A self-taught software engineer, Matt graduated from the University of Toronto with a Bachelor of Commerce in Finance and Economics.