Decision in brief
Start with PostgreSQL when correctness depends on relationships between entities or product teams often query data in new ways. Shortlist MongoDB when most requests read or write a bounded document as a unit and the team can design around those access patterns. Use PostgreSQL jsonb if only part of the data is flexible. Keep an existing engine if it meets your targets and the proposed replacement cannot show a material gain.

Choose by the shape of your reads and writes
Start with the operation that changes the greatest amount of state, then list what it must update atomically. Draw the boundaries on paper: data owned entirely by one customer profile is a different problem from inventory shared by thousands of orders.
| Workload | Start with | What to prove |
|---|---|---|
| Orders, inventory and payments with shared invariants | PostgreSQL with relational tables and constraints | Test duplicate checkout and concurrent stock reservations. A failed transaction should leave no inconsistent state. |
| Product listings read and updated per SKU, with bounded variation | MongoDB with an aggregate per SKU | Measure document size at the tail and define the update path for shared attributes. If lists can grow without bounds, test references or a different model. |
| Relational business data with optional provider fields | PostgreSQL typed columns plus jsonb for the variable payload | Promote frequently joined or constrained values to typed columns. Add targeted indexes for the JSON predicates you actually run. |
| Established document service considering a rewrite | Keep MongoDB until a specific blocker is reproduced | Compare throughput, on-call burden and recovery on matching topologies before pricing the rewrite. |
Document schemas, indexing and transaction boundaries
MongoDB can embed related fields or reference separate documents. Embed data that is usually accessed together and has a clear size bound; reference shared or unbounded data. Add schema validation where downstream code requires field types. Single-document updates are atomic; multi-document transactions are available on supported replica set and sharded deployments, but frequently crossing an aggregate boundary deserves a separate contention and latency test.
PostgreSQL jsonb supports indexing and can sit beside foreign keys and unique constraints. Indexing every variable attribute increases write and storage work; build indexes around actual predicates. For a lookup-heavy comparison, inspect both engines' execution plans for scanned rows or documents, and measure latency during continuous updates.
What the Hacker News cases add
Drawize creator lombarovic reported reaching 100 million drawings and described running PostgreSQL and MongoDB on one dedicated database server. The report shows that a mixed architecture can fit a small deployment footprint. The app also uses local asset prefetching and persistent WebSockets, so its responsiveness cannot be attributed to either database.
HN commenter cyberpunk reported that a MongoDB replica set handled the bank application's multi-zone write workload better than their PostgreSQL reproduction. They described roughly 175,000 writes per second and said the system was not yet sharded. The comment leaves data shape, exact durability and replication settings, hardware, and percentile latency unspecified. Recreate the transaction mix and acknowledged-write guarantees before borrowing the result.
Run the same correctness and performance trial
Treat a missing constraint, an unsafe failover or an unbounded document as a blocker before scoring speed. Use the same business rules on both implementations, while letting each use its natural schema and indexes.
- Seed both staging environments with the same sanitized records, including the largest real aggregates, the most skewed tenants and shared entities. Record engine versions, instance limits, replica topology and settings governing when each engine acknowledges a write.
- Exercise four paths with a fixed replay: read one aggregate, update a shared field, reject a duplicate, and run one cross-entity report. Add two concurrent workers competing to update the same logical record or reserve the last unit. Compare business outcomes before timing.
- Replay at normal and peak concurrency with the same client location and resource budget. Save p95 and p99 per operation, storage and memory use, retry counts, and query plans. In a staging failover, count missing acknowledged writes and time until writes resume.
- For a migration, test a backfill plus attributable changes after a recorded watermark. Reconcile totals and invariant violations. Keep the source and define when to stop or reverse cutover if the target cannot meet correctness, latency or restore targets.