Comparison

MariaDB vs PostgreSQL: New Apps and MySQL Migration

Compare MariaDB, PostgreSQL and MySQL on compatibility, JSON, performance and replication. Use a staging trial to decide whether a migration earns its cost.

Editorial update

Decision in brief

Choose MariaDB when staying close to a MySQL-family application materially reduces migration work and the target version passes your compatibility tests. Choose PostgreSQL for a new application when its query, constraint or jsonb capabilities solve a concrete design requirement. Keep MySQL in the comparison if the application already depends on MySQL-specific behavior.

Compare database fit: MariaDB — Test compatibility. PostgreSQL — Test design needs. Before switching — Trial real queries.
Use the exact versions and include existing MySQL behavior in the trial when it matters.

See discussion trends ↓

Choose by your application and migration constraints

The largest cost can be moving application behavior and operations. Inventory SQL, drivers, stored programs, change-data capture, managed service features and recovery procedures before comparing storage or query performance.

Starting pointFirst choice to testApproval gate
Existing MySQL application with extensive dialect-specific SQLKeep MySQL as baseline and test MariaDB for compatibilityRun exact-version tests for JSON functions, collations, SQL modes, DDL, permission grants and binlog consumers.
Greenfield service needing indexed containment queries over variable JSON fieldsPostgreSQL with jsonb and typed columns for core invariantsCompare targeted indexes using real filters. Include write amplification and index size in the decision.
Existing MariaDB service already within its reliability and performance targetsKeep MariaDB and reproduce the reason for switchingShow a specific feature gap or a lower measured operating cost over a full upgrade and recovery cycle.
Self-managed multi-node deploymentCompare MariaDB Galera against PostgreSQL physical replication and failover for the required topologyMeasure commit latency, reconnect time, read staleness and behavior when an availability zone or quorum is lost.

How MariaDB, PostgreSQL and MySQL differ

MariaDB and MySQL share tooling and protocol lineage. Compatibility still depends on the version and feature. MariaDB JSON is a validated LONGTEXT alias, MySQL uses a native binary JSON representation, and PostgreSQL jsonb uses a decomposed binary representation with its own operators and GIN indexing. Test missing fields, JSON null versus SQL NULL and duplicate keys when moving data.

MariaDB commonly uses InnoDB for transactions. Galera uses certification-based replication, so conflicting writes can require a retry and read visibility needs explicit validation. PostgreSQL physical streaming replication uses one writable primary with standbys and configurable synchronous acknowledgement. A migration between engines changes the failover and recovery playbook as well as the SQL.

What Hacker News cases add

In the LinkedQL Show HN, evanelias spotted a discrepancy between the cross-engine announcement and the documented MySQL and MariaDB live-query status. Treat client compatibility and feature parity as separate checks. Run an insert, update and delete through each version you plan to deploy and confirm subscribers receive the expected changes.

Scriptella author ejboy posted a CSV import benchmark comparing Scriptella/JDBC with csvsql on PostgreSQL and MariaDB. It illustrates how easily a database label can be mixed up with the ingestion tool. Compare your actual loader paths and separately measure the execution time spent on each server.

Run a migration and performance trial

Use isolated staging with sanitized data, pinned versions, comparable resources and the same durability requirements. Before testing, write down your required peak throughput, latency budget, cutover window, rollback limit and restore objective.

  1. Export a representative schema and fixture with realistic skew. Run migrations and compare counts, monetary totals, timestamp round trips and sample query results. Include the production driver, ORM and CDC connector.
  2. Replay the main reads and writes at steady and burst concurrency. Include large imports, hot-row contention and a schema change. Compare p95 latency, throughput, retries, locking, storage and replica lag across runs.
  3. Restore each engine to a separate staging environment and run the same smoke suite. Rehearse the write freeze, final catch-up and traffic switch. Define how writes accepted by the new engine would be reconciled before rollback, or require a read-only verification window before enabling writes.
  4. Approve the migration only when required queries, integrations and recovery drills pass. Capture engineering time and operational ownership alongside infrastructure cost.

Related articles