Database costs are the surprise that hits most startups between $10K and $100K MRR. Compute costs are predictable. Database costs scale non-linearly — storage, read replicas, and connection pooling all add up in unexpected ways.
Managed Database Pricing (2025)
PostgreSQL — AWS RDS Pricing
| Instance size | vCPUs | RAM | Storage | Monthly cost |
|---|---|---|---|---|
| db.t3.micro | 2 | 1 GB | 20 GB | $15-25 |
| db.t3.small | 2 | 2 GB | 20 GB | $30-45 |
| db.t3.medium | 2 | 4 GB | 100 GB | $65-90 |
| db.m5.large | 2 | 8 GB | 200 GB | $130-180 |
| db.m5.xlarge | 4 | 16 GB | 500 GB | $260-350 |
| db.m5.2xlarge | 8 | 32 GB | 1 TB | $520-700 |
| db.r5.2xlarge | 8 | 64 GB | 2 TB | $800-1,100 |
Add to these: Multi-AZ adds ~2x cost. Read replicas add the same cost per replica. Data transfer out (reads to application) billed additionally at $0.09/GB.
PlanetScale (MySQL-compatible, serverless)
| Plan | Storage | Row reads included | Cost |
|---|---|---|---|
| Hobby | 5 GB | 1B/month | Free |
| Scaler | 10 GB | 10B/month | $29/month |
| Scaler Pro | 10 GB+ | 100B/month | $99/month |
| Enterprise | Custom | Custom | Custom |
Supabase (PostgreSQL managed)
| Plan | Storage | Row reads | Cost |
|---|---|---|---|
| Free | 500 MB | 5M/month | $0 |
| Pro | 8 GB | Unmetered | $25/month |
| Team | 100 GB | Unmetered | $599/month |
Supabase Pro at $25/month is exceptional value for startups — includes auth, realtime, storage, and APIs in addition to PostgreSQL.
The Scaling Cost Curve
A typical web application's database costs at different user scales:
| Monthly active users | Recommended instance | Est. monthly DB cost |
|---|---|---|
| 0-10,000 | db.t3.small (single) or Supabase Pro | $30-45 |
| 10,000-50,000 | db.t3.medium + read replica | $150-200 |
| 50,000-200,000 | db.m5.large + 2 read replicas | $400-550 |
| 200,000-1,000,000 | db.m5.xlarge + 3 replicas | $800-1,200 |
| 1,000,000-5,000,000 | db.m5.2xlarge + 5 replicas | $2,500-4,000 |
| 5,000,000+ | db.r5.2xlarge cluster | $8,000-15,000+ |
These are guidelines, not guarantees — actual costs depend heavily on query patterns, indexing, and whether you've optimized before scaling hardware.
The Optimization Sequence (Before Scaling Up)
Hardware scaling is expensive and permanent. Optimization is one-time work with permanent savings. Always exhaust optimization first:
1. Query optimization (0-cost, biggest impact)
Unindexed queries on large tables are the #1 database performance killer. Tools:
EXPLAIN ANALYZEin PostgreSQL — shows query execution plan- pg_stat_statements — identifies slowest queries
- AWS RDS Performance Insights — visual query performance
One missing index on a high-frequency query can cause 100x query time. Adding it costs nothing.
2. Connection pooling (0-cost, major impact)
Each database connection uses ~5-10 MB RAM. A Rails/Node app without pooling might open 100+ connections per instance.
PgBouncer or pgcat (connection pooler) can reduce required database connections by 10-20x — allowing a smaller instance to handle the same load.
3. Read replicas (moderate cost, major scalability)
For read-heavy workloads (most web apps), directing read queries to read replicas allows the primary to focus on writes. A single read replica effectively doubles your read capacity.
Cost: same as primary instance (≈ 2x total cost), but avoids moving to the next instance tier.
4. Caching layer (moderate cost, major impact)
Redis or Memcached for frequently-accessed data:
- Cache database query results for 60-300 seconds
- Eliminates repeated identical queries
- ElastiCache Redis: $15-200/month depending on size
For most applications, a proper caching layer reduces database load by 50-80%.
5. Vertical scaling (last resort)
Only scale instance size after: queries are optimized, connection pooling is in place, read replicas are directing read traffic, and caching is active.
Estimated Savings from Optimization
A company spending $800/month on RDS at 200K users with unoptimized queries:
| Optimization | DB load reduction | Monthly savings |
|---|---|---|
| Query optimization | 40-60% | $200-400 |
| Connection pooling | 20-30% | $100-200 |
| Caching layer | 30-50% | $150-300 |
| Read replicas (instead of bigger primary) | Avoids 2x jump | $200-400 |
Total: $650-1,300/month savings — often allowing a smaller (cheaper) primary instance.
Use the Cloud Cost Calculator to estimate database costs at different scale levels.