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… | Pick | Because |
|---|---|---|
| Best price/performance | m8g.xlarge | 337,498 req/s per $/hr — the most throughput per dollar of any instance tested. |
| Maximum throughput | c8i.2xlarge | 85,752 req/s, the highest measured — when capacity beats cost. |
| Lowest running cost | t4g.small | $0.0387/hr (~$28/mo) all-in, still serving 2,158 req/s. |
| Best Graviton (Arm) | m8g.xlarge | 337,498 req/s per $/hr — top Arm value. |
| Best Intel (x86) | m7i.xlarge | 282,820 req/s per $/hr — top x86 value. |
Full ranking by price/performance
| Instance | Arch | $/hr | RPS | p95 ms | RPS/$ | RPS/vCPU |
|---|---|---|---|---|---|---|
| m8g.xlarge | arm64 | $0.2014/hr | 67,985 | 1.86 | 337,498 | 16,996 |
| m7g.xlarge | arm64 | $0.1851/hr | 54,279 | 2.03 | 293,214 | 13,570 |
| m7i.xlarge | x86-64 | $0.2235/hr | 63,215 | 1.88 | 282,820 | 15,804 |
| r8g.xlarge | arm64 | $0.2310/hr | 64,110 | 1.88 | 277,581 | 16,027 |
| r8g.large | arm64 | $0.1264/hr | 34,304 | 2.46 | 271,315 | 17,152 |
| m7g.2xlarge | arm64 | $0.3483/hr | 75,741 | 1.82 | 217,449 | 9,468 |
| c8i.2xlarge | x86-64 | $0.3968/hr | 85,752 | 1.73 | 216,132 | 10,719 |
| m8g.2xlarge | arm64 | $0.3810/hr | 81,055 | 1.75 | 212,767 | 10,132 |
| m5.xlarge | x86-64 | $0.2139/hr | 39,076 | 2.24 | 182,669 | 9,769 |
| m7i.2xlarge | x86-64 | $0.4251/hr | 71,930 | 1.81 | 169,201 | 8,991 |
| m5.2xlarge | x86-64 | $0.4059/hr | 50,632 | 2.01 | 124,734 | 6,329 |
| r8g.medium | arm64 | $0.0742/hr | 5,488 | 11.46 | 73,981 | 5,488 |
| t3.small | x86-64 | $0.0427/hr | 2,470 | 67.41 | 57,821 | 1,235 |
| m7g.medium | arm64 | $0.0627/hr | 3,540 | 13.77 | 56,443 | 3,540 |
| t4g.small | arm64 | $0.0387/hr | 2,158 | 68.06 | 55,747 | 1,079 |
| m8g.medium | arm64 | $0.0668/hr | 3,537 | 13.81 | 52,952 | 3,537 |
| m7g.large | arm64 | $0.1035/hr | 5,466 | 11.85 | 52,802 | 2,733 |
| m8g.large | arm64 | $0.1117/hr | 5,485 | 11.91 | 49,117 | 2,743 |
| m5.large | x86-64 | $0.1179/hr | 5,447 | 11.90 | 46,192 | 2,723 |
| m7i.large | x86-64 | $0.1227/hr | 5,474 | 11.80 | 44,606 | 2,737 |
| t4g.large | arm64 | $0.0891/hr | 3,924 | 58.16 | 44,026 | 1,962 |
| t4g.medium | arm64 | $0.0555/hr | 2,405 | 67.42 | 43,316 | 1,202 |
| t3.medium | x86-64 | $0.0635/hr | 2,490 | 67.40 | 39,203 | 1,245 |
| t3.large | x86-64 | $0.1051/hr | 4,048 | 57.49 | 38,508 | 2,024 |
| c8i.large | x86-64 | $0.1156/hr | 3,517 | 13.93 | 30,414 | 1,758 |
| c8i.xlarge | x86-64 | $0.2093/hr | 5,455 | 11.76 | 26,060 | 1,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:
- Graviton (Arm) usually wins on cost-efficiency. At comparable throughput it carries a lower hourly price, so it leads the requests-per-dollar ranking for this workload.
- Right-size to your working set. Throughput holds up while the dataset fits in RAM and drops once it spills to disk — so the winner can change with dataset size. Check your size in the sizing tool.
- Burstable (t-family) is for spiky, low-average load. The numbers here reflect sustained credit mode; a credit-starved t3/t4g will perform worse under steady load.
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.