PostgreSQL vs MySQL: differences that matter
PostgreSQL and MySQL are the two most widely used open-source relational databases, both built for transactional (OLTP) workloads. Postgres has the broader SQL feature set and extension system; MySQL is simpler to run and has a long history behind high-traffic web applications.
Side by side
| PostgreSQL | MySQL (InnoDB) | |
|---|---|---|
| License and owner | PostgreSQL License (permissive), community project | GPLv2 Community Edition plus commercial editions, owned by Oracle |
| Connections | One process per connection | One thread per connection |
| MVCC | Old row versions stay in the table until VACUUM removes them | Old versions kept in undo logs, purged in the background |
| Default isolation | Read committed | Repeatable read |
| DDL in transactions | Yes, can be rolled back | No, DDL commits implicitly |
| JSON | json and jsonb; jsonb indexable with GIN | JSON type; indexed through generated columns |
| Upsert | INSERT ... ON CONFLICT | INSERT ... ON DUPLICATE KEY UPDATE |
| Extensibility | Extensions (PostGIS, pgvector), custom types, many index types | Pluggable storage engines; InnoDB is the default |
| Replication | Streaming (physical) and logical replication | Binary log replication, Group Replication |
| String comparison | Case-sensitive by default | Default collations are case-insensitive |
Where the differences show up
Concurrency. Both use MVCC, so readers do not block writers. They store old versions differently. Postgres writes a new row version on every update and relies on autovacuum to reclaim the old ones; a busy table that vacuum cannot keep up with grows (bloat). InnoDB updates in place and keeps the previous version in undo logs, which long-running transactions can make grow instead.
SQL. Both support CTEs and window functions in current versions. Postgres adds things like the FILTER clause, partial and expression indexes, arrays, range types and transactional DDL, which makes migrations safer to roll back. MySQL's simpler feature set is easier to tune and is well understood by hosting providers.
Behavior. The same query can return different rows. With MySQL's default collation, WHERE name = 'alice' matches 'Alice'; in Postgres it does not. The dialects differ in small ways too:
CREATE TABLE users (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, email TEXT UNIQUE, profile JSONB);
INSERT INTO users (email, profile) VALUES ('[email protected]', '{"plan": "pro"}')
ON CONFLICT (email) DO UPDATE SET profile = excluded.profile;
SELECT email FROM users WHERE profile ->> 'plan' = 'pro';CREATE TABLE users (id BIGINT AUTO_INCREMENT PRIMARY KEY, email VARCHAR(255) UNIQUE, profile JSON);
INSERT INTO users (email, profile) VALUES ('[email protected]', '{"plan": "pro"}')
ON DUPLICATE KEY UPDATE profile = VALUES(profile);
SELECT email FROM users WHERE profile ->> '$.plan' = 'pro';Choosing between them
Both run large production systems, and both are offered as managed services by every major cloud. Postgres is the usual pick when the application needs richer types, geospatial data through PostGIS, vector search through pgvector or complex queries. MySQL is common in existing web stacks and where the team already knows its replication and operations. Neither is built for heavy analytics; see OLAP vs OLTP.
In Thunderduck
PostgreSQL and MySQL are both catalog types in Thunderduck, queried in place as catalog.schema.table and joinable with each other, with Iceberg tables and with files in one query. Filters on constants are pushed down into either database, along with GROUP BY, ORDER BY and LIMIT when the remote table is alone in its SELECT. Both are writable by default unless the catalog is marked read-only, and a read-only role is enough for querying. Behind a connection pooler, use its session mode.
Docs: https://docs.thunderduck.ai/catalogs/postgresql-mysql/