Guide

Best EC2 instance for PostgreSQL

A data-backed answer, from real benchmarks: the best AWS EC2 instance types for self-managed PostgreSQL by price/performance, raw throughput, and cost — measured on a 90% read / 10% write OLTP workload.

Context

Workload
90% read / 10% write
PostgreSQL
17
Dataset
10 GB
Storage
gp3-baseline
Region
us-east-1

Heads up: this covers a limited, hand-picked set of 26 instance types across 8 EC2 families — not every instance AWS offers. Benchmarks last run 2026-07-04 15:21 UTC.

TL;DR

If you want…PickBecause
Best price/performancem8g.xlarge337,498 req/s per $/hr — the most throughput per dollar of any instance tested.
Maximum throughputc8i.2xlarge85,752 req/s, the highest measured — when capacity beats cost.
Lowest running costt4g.small$0.0387/hr (~$28/mo) all-in, still serving 2,158 req/s.
Best Graviton (Arm)m8g.xlarge337,498 req/s per $/hr — top Arm value.
Best Intel (x86)m7i.xlarge282,820 req/s per $/hr — top x86 value.

Full ranking by price/performance

AWS EC2 instances ranked by PostgreSQL throughput per dollar
InstanceArch$/hrRPSp95 msRPS/$RPS/vCPU
m8g.xlargearm64$0.2014/hr67,9851.86337,49816,996
m7g.xlargearm64$0.1851/hr54,2792.03293,21413,570
m7i.xlargex86-64$0.2235/hr63,2151.88282,82015,804
r8g.xlargearm64$0.2310/hr64,1101.88277,58116,027
r8g.largearm64$0.1264/hr34,3042.46271,31517,152
m7g.2xlargearm64$0.3483/hr75,7411.82217,4499,468
c8i.2xlargex86-64$0.3968/hr85,7521.73216,13210,719
m8g.2xlargearm64$0.3810/hr81,0551.75212,76710,132
m5.xlargex86-64$0.2139/hr39,0762.24182,6699,769
m7i.2xlargex86-64$0.4251/hr71,9301.81169,2018,991
m5.2xlargex86-64$0.4059/hr50,6322.01124,7346,329
r8g.mediumarm64$0.0742/hr5,48811.4673,9815,488
t3.smallx86-64$0.0427/hr2,47067.4157,8211,235
m7g.mediumarm64$0.0627/hr3,54013.7756,4433,540
t4g.smallarm64$0.0387/hr2,15868.0655,7471,079
m8g.mediumarm64$0.0668/hr3,53713.8152,9523,537
m7g.largearm64$0.1035/hr5,46611.8552,8022,733
m8g.largearm64$0.1117/hr5,48511.9149,1172,743
m5.largex86-64$0.1179/hr5,44711.9046,1922,723
m7i.largex86-64$0.1227/hr5,47411.8044,6062,737
t4g.largearm64$0.0891/hr3,92458.1644,0261,962
t4g.mediumarm64$0.0555/hr2,40567.4243,3161,202
t3.mediumx86-64$0.0635/hr2,49067.4039,2031,245
t3.largex86-64$0.1051/hr4,04857.4938,5082,024
c8i.largex86-64$0.1156/hr3,51713.9330,4141,758
c8i.xlargex86-64$0.2093/hr5,45511.7626,0601,364

Ranked at a 10 GB dataset on gp3-baseline storage. Want a different size, disk, or workload? Open the interactive sizing tool to re-sort the full dataset, or read the methodology.

How to choose

There is no single “best” instance — it depends on what you are optimizing. Pick the smallest instance whose throughput clears your real peak (with headroom), then compare its cost-efficiency to the alternatives above. A few rules of thumb from the data:

FAQ

What is the best EC2 instance for PostgreSQL?

For price/performance, m8g.xlarge (arm64) leads at 337,498 req/s per $/hr. If you need the most raw throughput regardless of cost, c8i.2xlarge is fastest at 85,752 req/s. The right pick depends on whether you are optimizing for cost-efficiency or peak capacity.

Is AWS Graviton (Arm) faster than Intel (x86) for PostgreSQL?

In these benchmarks the best Graviton (Arm) instance, m8g.xlarge, delivers 337,498 req/s per $/hr versus 282,820 req/s per $/hr for the best Intel/x86 instance, m7i.xlarge. Graviton generally wins on cost-efficiency for this PostgreSQL workload because of its lower hourly price at comparable throughput.

How much does it cost to run PostgreSQL on EC2?

The cheapest benchmarked instance, t4g.small, costs $0.0387/hr (~$28/mo) including its gp3 EBS volume, while sustaining 2,158 req/s. Cost scales with instance size; compare the full table to find the smallest instance that meets your throughput target.

What workload were these PostgreSQL benchmarks run on?

A mixed OLTP pattern — 90% random primary-key reads and 10% single-row inserts — at 32 concurrent connections on PostgreSQL 17, in us-east-1, with a 10 GB dataset on a gp3-baseline gp3 volume. Full methodology is published, and the harness is open source.