PostgreSQL for SaaS Apps: Sizing, Connections, and Production Operations

Serdar Tekin
Serdar Tekin
Co-Founder & CTO
Updated Sep 23, 202614 min read
Written for: Developers, founders, and small platform teams planning PostgreSQL sizing, connection management, recovery, and production ownership for SaaS applications
PostgreSQLSaaSManaged DatabasesConnection PoolingHigh AvailabilityBackup
Last reviewed:
Guide
PostgreSQL for SaaS Apps: Sizing, Connections, and Production Operations
rafftechnologies.com/learn
On this page

Key Takeaways

Size PostgreSQL around workload shape and active bottlenecks rather than user count alone. Treat database connections as a finite capacity budget across every app instance and worker. Replicas and HA protect availability while backups and PITR protect historical correctness. Choose managed PostgreSQL when supported service capabilities fit; self-host only when a documented requirement needs deeper control.

PostgreSQL for SaaS apps is a production operating model for sizing compute and storage, controlling connection pressure, protecting data, and deciding which database responsibilities belong to the application team or the platform.

For small teams, the important question is not whether PostgreSQL can support a SaaS product. It can. The useful question is which limits should be designed before growth turns them into incidents: connection count, query latency, storage growth, backup recovery, replica freshness, and maintenance ownership.

Raff Technologies offers both Managed PostgreSQL and self-hosted database paths. The operating models remain separate: choose managed PostgreSQL when the supported service fits the workload; choose a VM when a documented requirement needs operating-system or database-level control the managed service does not expose.

A PostgreSQL production plan should define connection, storage, recovery, and ownership limits before it defines a larger server.

PostgreSQL production architecture starts with workload shape

A SaaS database should be sized around workload behavior rather than customer count alone. Ten customers generating long analytical queries can create more pressure than thousands of mostly idle accounts.

Start with five workload dimensions:

  • Concurrent database work: how many requests, jobs, and background workers can actively query at the same time?
  • Working-set size: how much frequently accessed data and index state needs to stay hot?
  • Write intensity: are writes steady, bursty, or dominated by batch jobs and imports?
  • Query shape: are requests mostly indexed lookups, transactional joins, reporting queries, or mixed workloads?
  • Data growth: how quickly do tables, indexes, write-ahead logs, and retained history expand?

That creates a more useful sizing model than a formula based only on users or rows.

For early SaaS workloads, the operating goal should be predictable headroom. A database that runs at the edge of CPU, memory, connections, or storage during normal traffic has no room for maintenance, failover, imports, or an unexpected query regression.

Sizing should follow bottlenecks instead of plan labels

PostgreSQL capacity decisions usually become clearer when each resource is tied to a failure mode.

ResourcePressure signalWhat the team should decide
CPUsustained saturation, slow query executionwhether workload or compute is the constraint
Memorycache misses, sort/hash spill, OS pressurewhether working set and query memory fit
Storagerapid growth, low free space, I/O latencygrowth budget, retention, expansion threshold
Connectionspool wait, rejected connections, high backend countapplication pool limits and database ceiling
Replicationrising replay or apply lagacceptable replica freshness and failover safety
Backup historyrecovery points too sparse or too short-livedRPO, retention, and restore-test cadence

A practical rule is to resize only after identifying the active constraint. More CPU will not fix connection storms, missing indexes, lock contention, or a poor retention policy.

For self-hosted PostgreSQL, the team also owns operating-system memory, storage layout, database configuration, patching, and backup automation. Managed PostgreSQL moves more of those host-level responsibilities to the service, but application workload decisions remain with the team.

Connection management is a first-class SaaS capacity decision

PostgreSQL creates a server process for each direct client connection. That makes connection count an architectural resource, not just an application setting.

Connection pressure usually grows from multiplication:

Text
application instances × workers per instance × pool size per worker × background services = potential database connections

A pool size that looks harmless on one application instance can become excessive after autoscaling or after several worker services are added.

Small teams should define:

  • a database connection ceiling;
  • a per-service pool budget;
  • a reserved margin for migrations, administration, and incident work;
  • queue or timeout behavior when the pool is full;
  • the trigger for introducing or tightening connection pooling.

Connection pooling should reduce churn and bound concurrency. It should not be used to hide an application that opens unlimited work against the database.

Raff Managed PostgreSQL includes built-in connection pooling, while self-hosted PostgreSQL can use tools such as PgBouncer when the application needs an external pooler. The detailed pooling trade-offs belong in the cluster page on PostgreSQL connection pooling rather than in the connector guide.

High availability, replicas, backups, and PITR solve different risks

Production PostgreSQL usually needs more than one protection mechanism because each control covers a different failure.

ControlMain purposeDoes not replace
Read replicaoffload selected reads or reportingbackup history
Standby / HA replicareduce service interruption after primary failurehistorical recovery
Backuppreserve an independent recovery pointfast failover
Point-in-time recoveryrestore to a chosen point before a bad changeapplication validation
Infrastructure snapshotselected infrastructure rollback use casesdatabase-native recovery planning

A replica can contain the same accidental delete, bad migration, or unwanted write as the primary. That is why replication should not be treated as backup.

For a deeper comparison of the protection layers, use PostgreSQL Replication vs Backups vs Snapshots.

The production decision should begin with RPO and RTO:

  • RPO defines how much recent committed data the business can lose.
  • RTO defines how long the database-dependent service can remain unavailable.

Those targets determine whether backups alone are enough or whether the workload also needs standby capacity, faster restore workflows, or optional high availability.

Managed and self-hosted PostgreSQL create different ownership boundaries

The engine is the same category of database, but the operating responsibilities are not.

ResponsibilityManaged PostgreSQLSelf-hosted PostgreSQL
Host patchingplatform-ownedteam-owned
Database service maintenancemore platform-ownedteam-owned
Backup infrastructureplatform-managed where includedteam-designed and operated
Monitoring collectionplatform-provided baselineteam-deployed
Schema and migrationsteam-ownedteam-owned
Queries and indexesteam-ownedteam-owned
Credentials and application accessshared boundaryteam-owned
Capacity decisionsteam-ownedteam-owned
Restore-point selection and app validationteam-ownedteam-owned

Choose managed PostgreSQL when the service supports the required version, extensions, networking, availability model, and recovery workflow, and the team does not gain business value from operating the host.

Choose self-hosting when a real requirement needs OS access, a custom extension or topology, direct file access, unusual replication control, or a version lifecycle the managed service does not support.

The cost comparison should include engineering time, after-hours ownership, backup testing, patching, monitoring, and incident response—not only the monthly database or VM price.

The decision framework changes as the SaaS workload matures

A small SaaS team can use a simple operating framework instead of trying to copy a large-company database architecture.

Workload stageDefault postureAdd next when
Prototype / internal toolsingle managed database or simple self-hosted instancedurability and recovery become business requirements
Early production SaaSmanaged PostgreSQL, connection budget, backups/PITR, monitoringconnection pressure or recovery targets tighten
Growing SaaSexplicit pooling, storage headroom, slow-query review, tested restoreavailability target requires faster continuity
Availability-sensitive SaaSoptional HA / standby path plus historical recoverydowntime cost justifies the extra complexity
Specialized workloadself-hosted or custom topology where justifiedmanaged service no longer satisfies a documented requirement

The key is sequencing. Do not add replicas, failover automation, or complex pool layers because they are common in architecture diagrams. Add them when a measured risk or service objective requires them.

At Raff, the preferred decision order is workload → recovery target → connection model → ownership model → capacity, because that prevents a larger server from becoming the default answer to every database problem.

Raff Managed PostgreSQL reduces host-level operations

Raff Managed PostgreSQL currently supports PostgreSQL 14, 15, and 16 with managed backups and point-in-time recovery, monitoring, built-in pooling, private connectivity, storage expansion, and optional high availability.

That makes it suitable when a small team wants PostgreSQL without owning the database host, but it does not remove application responsibilities. Teams still need to own:

  • schema and data-model design;
  • query and index quality;
  • application pool sizing;
  • migrations and compatibility;
  • credentials and service access;
  • capacity choices;
  • recovery-point selection;
  • application validation after restore or failover.

For teams that need full server control, Raff VM remains the self-hosted path. The broader operating-model comparison is covered in Managed vs Self-Hosted Databases.

Conclusion

PostgreSQL for SaaS apps should be operated around explicit limits and ownership rather than around a generic server-size recommendation.

Define the workload shape, connection budget, storage growth, RPO, and RTO. Use pooling to bound application concurrency, replicas for availability or read distribution, and backups or PITR for historical recovery. Then choose managed or self-hosted PostgreSQL based on the control the workload actually needs.

For most small teams using supported PostgreSQL features, the managed path removes host-level work while keeping schema, query, migration, capacity, and recovery decisions with the application team.

Compare Raff managed database engines and decide which production responsibilities your team wants to own.

Was this article helpful?
Serdar Tekin
Serdar Tekin
Co-Founder & CTO

Co-Founder & CTO at Raff, focused on cloud infrastructure, systems architecture, security, reliability, and production operations.

Put it into practice

Spin up a Raff server, follow the steps above on real infrastructure, and you are live. Linux or Windows, backed by a 14-day money-back guarantee.

Frequently asked questions

Is PostgreSQL a good database for SaaS applications?
Yes. PostgreSQL fits many SaaS workloads that need transactions, relational data, constraints, joins, JSON support, and a mature extension ecosystem.
How should a small SaaS team size PostgreSQL?
Size from concurrent work, working-set size, write intensity, query shape, storage growth, and recovery targets. Do not size from user count alone.
How many PostgreSQL connections should a SaaS app use?
There is no universal number. Set a database ceiling, divide it across services and workers, reserve incident headroom, and use pooling to bound concurrency.
When should a SaaS app use PostgreSQL connection pooling?
Use pooling when direct connection churn or total connection demand can exceed a safe database budget. Pooling should bound work, not hide unlimited concurrency.
Does PostgreSQL high availability replace backups?
No. High availability reduces interruption after infrastructure or primary failure. Backups and PITR preserve historical recovery after deletion, corruption, or bad writes.
When should PostgreSQL be self-hosted instead of managed?
Self-host when a documented requirement needs OS access, custom topology, unsupported extensions, direct files, or version control the managed service cannot provide.
Which PostgreSQL versions does Raff Managed PostgreSQL support?
Raff Managed PostgreSQL currently supports PostgreSQL 14, 15, and 16, with managed backups, PITR, monitoring, pooling, private connectivity, and optional HA.