PostgreSQL vs MariaDB/MySQL
Compare the two most common open-source relational database servers from an operations point of view.
| Dimension | PostgreSQL | MariaDB / MySQL | What it means in practice |
|---|---|---|---|
| Process model | One process per connection. | One thread per connection (thread pool optional). | PostgreSQL usually needs a connection pooler at high connection counts. |
| Concurrency | MVCC with row versions in the table; vacuum cleans up. | InnoDB MVCC with undo logs; purge cleans up. | Long transactions cause bloat in PostgreSQL and undo growth in InnoDB. |
| Replication | Physical streaming replication and logical replication. | Binlog-based replication (row format), GTIDs; Galera for MariaDB clusters. | Both support asynchronous and (semi-)synchronous modes. |
| Authentication config | pg_hba.conf plus roles. | Accounts as user@host with GRANTs. | Access problems are found in different places. |
| Backup tools | pg_dump, pg_basebackup, WAL archiving. | mysqldump/mariadb-dump, Mariabackup/XtraBackup, binlogs. | Both need log archiving for point-in-time recovery. |
| Verification | psql -c "SELECT version();"; pg_stat_activity | mariadb -e "SELECT VERSION();"; SHOW PROCESSLIST | Check the version before using version-specific features. |