The 30 second answer
When reads overload the primary, I send read-only traffic to replicas, accepting a little replication lag for that data. When a single table becomes very large, partitioning by time or key lets queries skip whole partitions and makes deleting old data cheap. Partitioning is not a general speed-up; it helps mainly with very large tables and queries that filter on the partition key.
Hot standby lets a replica serve read-only queries. Replicas are asynchronous by default, so reads can be slightly stale. Partitioning splits a big table. Queries that filter on the partition key read only the matching partitions (partition pruning), and old data can be dropped by detaching a partition.
Alternate interview scenarios
"We add replicas and standbys. What does that cost in freshness and durability?"
Two settings decide it. Read replicas are asynchronous by default, so they are fine for screens that can show slightly old data. Reads right after the user's own write should go to the primary. For high availability, synchronous replication (synchronous_standby_names with synchronous_commit) makes the primary wait for a standby to confirm the commit. That avoids losing committed transactions on failover, but it adds a network round trip to every commit. With asynchronous standbys, commits are faster, but a failover can lose the last few transactions. This copy lives under the database and the database manages it, unlike an application-level synced copy, so the application never has to reconcile it.
Note:
the partitioning docs say the benefits show up mainly when a table is very large. It is not a general speed-up.
Sources (4)
- PostgreSQL 17: Hot Standbypostgresql.org
- Table Partitioningpostgresql.org
- PostgreSQL 17 docs: Synchronous replicationpostgresql.org
- PostgreSQL 17 docs: Replication settings (synchronous_commit, synchronous_standby_names)postgresql.org