Glossary

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

PostgreSQLMySQL (InnoDB)
License and ownerPostgreSQL License (permissive), community projectGPLv2 Community Edition plus commercial editions, owned by Oracle
ConnectionsOne process per connectionOne thread per connection
MVCCOld row versions stay in the table until VACUUM removes themOld versions kept in undo logs, purged in the background
Default isolationRead committedRepeatable read
DDL in transactionsYes, can be rolled backNo, DDL commits implicitly
JSONjson and jsonb; jsonb indexable with GINJSON type; indexed through generated columns
UpsertINSERT ... ON CONFLICTINSERT ... ON DUPLICATE KEY UPDATE
ExtensibilityExtensions (PostGIS, pgvector), custom types, many index typesPluggable storage engines; InnoDB is the default
ReplicationStreaming (physical) and logical replicationBinary log replication, Group Replication
String comparisonCase-sensitive by defaultDefault 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:

PostgreSQL
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';
MySQL
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/

Related terms

Query the data where it lives.

Databases, warehouses and buckets in one SQL statement, from SQL clients, BI tools and AI agents.