Database Comparison
Side-by-side comparison of PostgreSQL, MySQL, MongoDB, and DuckDB across data model, scalability, vector search, and operational characteristics.
| Feature | PostgreSQL | MySQL | MongoDB | DuckDB |
|---|---|---|---|---|
| Data Model | Relational (tables, rows, SQL) | Relational (tables, rows, SQL) | Document (BSON/JSON) | Relational (columnar storage) |
| Query Language | SQL (full standard compliance) | SQL (partial standard compliance) | MQL (MongoDB Query Language) | SQL (PostgreSQL-compatible dialect) |
| Scalability | Vertical; horizontal via Citus extension | Vertical; horizontal via Vitess or Group Replication | Horizontal (native sharding) | Single-node (in-process) |
| ACID Compliance | Full ACID with MVCC | Full ACID with InnoDB | Multi-document transactions (since 4.0) | Full ACID |
| Vector Search | Yes (pgvector with HNSW indexes) | Limited (HeatWave, third-party) | Yes (Atlas Vector Search) | Via extensions (vss) |
| Best For | General-purpose OLTP, AI/RAG applications, mixed workloads | Web applications, CMS platforms, read-heavy workloads | Content management, catalogs, rapidly evolving schemas | Local analytics, data science, ETL, embedded OLAP |
| License | PostgreSQL License (permissive) | GPL v2 (dual-licensed by Oracle) | SSPL (Server Side Public License) | MIT |
| Replication | Streaming + logical replication | Async, semi-sync, Group Replication | Replica sets with automatic failover | None (single-process) |
| JSON Support | Native JSONB with indexing | Native JSON type with functions | Native (documents are JSON/BSON) | Native JSON with auto-schema detection |
| Operational Complexity | Moderate. mature tooling and community | Low. well-understood operations | Moderate. sharding adds complexity | Minimal. no server to manage |
Summary
PostgreSQL
The default choice for most applications. ACID-compliant, extensible, and now capable of vector search via pgvector.
MySQL
The most widely deployed open-source database, powering much of the web, with strong InnoDB transactional support.
MongoDB
The leading document database, optimized for flexible schemas and rapid iteration, with built-in vector search.
DuckDB
An in-process analytical database optimized for fast OLAP queries on local data, with zero operational overhead.