Skip to the page

PostgreSQL and MySQL inside · senior

PostgreSQL or MySQL: how to choose

Both are mature and good for most transactional work. A senior answer names real differences and costs, and also says that team skills and the managed service often decide.

The notes

What you must know

  • PostgreSQL strengths: JSONB with GIN indexes, partial and expression indexes, extensions (PostGIS, pgvector, TimescaleDB), transactional DDL, row-level security, strict types.
  • PostgreSQL costs: a process for every connection (so you need a pooler), VACUUM and bloat, transaction id wraparound, and extra index work on update-heavy tables when updates are not HOT.
  • MySQL strengths: a clustered primary key, very mature replication and large-scale tools (Vitess, gh-ost), and cheaper handling of many connections.
  • MySQL costs: DDL is not transactional, fewer index types, and a strict sql_mode is needed to avoid silent data changes.
  • Do not choose on one benchmark. Compare on your workload, your team, and what your cloud offers (RDS, Aurora, Cloud SQL, AlloyDB, Azure).
  • Check the supported versions and the support end date of the version you pick. A major version that reaches end of life forces an upgrade project.
  • Examples from Indian companies: Zerodha prefers PostgreSQL, and several fintechs have run MySQL.

The red pen

Common traps: mistake → fix

  • Mistake: PostgreSQL is always better, or the reverse

    Fix: each has costs; the right answer depends on the workload and the team.

  • Mistake: Pick by benchmark alone

    Fix: a benchmark rarely matches your queries, data size and operations.

Easy to hard

Questions interviewers ask, easy to hard

  1. PostgreSQL or MySQL for a new payments service, and why?
  2. Name two things PostgreSQL does better and two things MySQL does better.
  3. What operational work does each one need that the other needs less?

Your first interview is free

Sign up and start with a 15-minute interview with the full report, and an English conversation. No card needed.

Start your free interview