MongoDB vs MySQL vs PostgreSQL
MongoDB stores data in JSON-like documents that can vary in structure, offering a dynamic, flexible schema. MongoDB was also designed for high availability and scalability, with built-in replication and auto-sharding.
MySQL software delivers a very fast, multi-threaded, multi-user, and robust SQL (Structured Query Language) database server. MySQL Server is intended for mission-critical, heavy-load production systems as well as for embedding into mass-deployed software.
PostgreSQL is an advanced object-relational database management system that supports an extended subset of the SQL standard, including transactions, foreign keys, subqueries, triggers, user-defined types and functions.
Key |
MongoDB |
MySQL |
PostgreSQL |
Definition | MongoDB is open source, non-relational database management system | MySQL is an open-source relational database management system (RDBMS) | PostgreSQL is relational database management system |
Primary database model | Document store | Relational DBMS | Relational DBMS |
Secondary database models | Search engine | Document store | Document store |
Developer | Developed by MongoDB, Inc | Developed by Oracle | Developed by PostgreSQL Global Development Group |
Initial release | 2009 | 1995 | 1989 |
License | Open Source | Open Source | Open Source |
DBaaS offerings | MongoDB Atlas: Deploy a fully managed cloud database on-demand and ready for use in minutes. Available on AWS, Azure, and GCP. | Azure Database for MySQL: A fully managed, scalable MySQL relational database with high availability and security built in at no extra cost |
Azure Database for PostgreSQL: A fully managed, scalable PostgreSQL relational database with high availability and security built in at no extra cost ScaleGrid: Fully managed PostgreSQL hosting with high availability, dedicated servers, and superuser control on the #1 multi-cloud Amazon RDS alternative. |
Programmed | MongoDB is mainly programmed in C ,C++ and javaScript | C and C++ | C |
Server operating systems | Linux
OS X Solaris Windows |
FreeBSD
Linux OS X Solaris Windows |
FreeBSD
HP-UX Linux NetBSD OpenBSD OS X Solaris Unix Windows |
Data scheme | schema-free | Yes | Yes |
Typing | Yes | Yes | Yes |
Secondary indexes | Yes | Yes | Yes |
SQL | Read-only SQL queries via the MongoDB Connector for BI | Yes | Yes |
APIs and other access methods | proprietary protocol using JSON |
ADO.NET JDBC ODBC Proprietary native API |
ADO.NET
JDBC native C library ODBC streaming API for large objects |
Supported programming languages | Actionscript
C C# C++ Clojure ColdFusion D Dart Delphi Erlang Go Groovy Haskell Java JavaScript Lisp Lua MatLab Perl PHP PowerShell Prolog Python R Ruby Scala Smalltalk |
Ada C C# C++ D Delphi Eiffel Erlang Haskell Java JavaScript (Node.js) Objective-C OCaml Perl PHP Python Ruby Scheme Tcl |
.Net
C C++ Delphi Java JavaScript (Node.js) Perl PHP Python Tcl |
Server-side scripts | JavaScript | Yes | user defined functions |
Triggers | Yes | Yes | Yes |
Partitioning methods | Sharding | Horizontal partitioning, sharding with MySQL Cluster or MySQL Fabric | Partitioning by range, list and (since PostgreSQL 11) by hash |
Replication methods | Master-slave replication | Master-master replication
Master-slave replication |
Master-slave replication |
MapReduce | Yes | No | No |
Consistency concepts | Eventual Consistency
Immediate Consistency |
Immediate Consistency | Immediate Consistency |
Foreign keys | No | Yes | Yes |
Transaction concepts | Multi-document ACID Transactions with snapshot isolation | ACID | ACID |
Concurrency | Yes | Yes | Yes |
Durability | Yes | Yes | Yes |
In-memory capabilities | Yes | Yes | No |
User concepts | Access rights for users and roles | Users with fine-grained authorization concept | fine grained access rights according to SQL-standard |
I hope this post helps you to understand all the comparisons between “MongoDB, MySQL and PostgreSQL”.
Keep Learning 🙂