A startup asks whether to use PostgreSQL or MongoDB for its new SaaS product. What do you advise?

Short answer

Default to PostgreSQL unless there is a specific reason not to: it handles relational data, transactions and flexible JSONB documents, and keeps future query options open. Choose MongoDB when data is naturally document-shaped, accessed by key, and the team needs its sharding or developer model at scale.

Detailed answer

Ask about the data (relationships, transactions, reporting), access patterns, expected scale and team skills. Early-stage products change requirements frequently; PostgreSQL's flexibility (joins, constraints, JSONB, full-text, extensions like pgvector) covers most needs with one operationally simple, managed service. MongoDB fits self-contained documents, rapid schema evolution per document type and native horizontal sharding.

Real-world example

Many SaaS companies start on PostgreSQL and add specialized stores (search, cache, analytics) as needs emerge.

Follow-up questions

  • When would you shard PostgreSQL? (Write volume beyond one primary; use tenant_id as shard key; Citus or application sharding.)

What the interviewer expects

Requirement-driven reasoning and awareness of trade-offs, not brand preference.

Common mistakes to avoid

Choosing NoSQL "for scale" before any scale exists, or ignoring transactional needs.