StackShareStackShare
Follow on
StackShare

Discover and share technology stacks from companies around the world.

Follow on

© 2025 StackShare. All rights reserved.

Product

  • Stacks
  • Tools
  • Feed

Company

  • About
  • Contact

Legal

  • Privacy Policy
  • Terms of Service
  1. Stackups
  2. Application & Data
  3. Databases
  4. Databases
  5. MongoDB vs MySQL vs PostgreSQL

MongoDB vs MySQL vs PostgreSQL

OverviewDecisionsComparisonAlternatives

Overview

MySQL
MySQL
Stacks129.6K
Followers108.6K
Votes3.8K
GitHub Stars11.8K
Forks4.1K
PostgreSQL
PostgreSQL
Stacks103.0K
Followers83.9K
Votes3.6K
GitHub Stars19.0K
Forks5.2K
MongoDB
MongoDB
Stacks96.6K
Followers82.0K
Votes4.1K
GitHub Stars27.7K
Forks5.7K

MongoDB vs MySQL vs PostgreSQL: What are the differences?

Introduction

MongoDB, MySQL, and PostgreSQL are all popular database management systems (DBMS) used in web development. While they share similarities in terms of being relational and supporting SQL, they also have key differences that make them suitable for specific use cases. In this markdown, we will discuss the key differences between MongoDB, MySQL, and PostgreSQL.

  1. Data Model: MongoDB and MySQL are both non-relational databases, whereas PostgreSQL is a relational database. MongoDB uses a flexible document model, storing data in the form of JSON-like documents. MySQL uses a table-based data model, where data is organized into tables with predefined columns and rows. PostgreSQL follows the relational data model, storing data in tables that are related through primary and foreign keys.

  2. Scalability: MongoDB is designed to scale horizontally, allowing for the distribution of data across multiple servers. It excels in handling large amounts of unstructured data and can easily accommodate high-traffic websites. MySQL and PostgreSQL are more suited for vertical scalability, scaling up with more powerful hardware. They are suitable for applications with complex relationships and strict data integrity requirements.

  3. Query Language: MongoDB has its own query language called the MongoDB Query Language (MQL). MQL is based on JavaScript and provides powerful querying capabilities, including support for complex aggregations and real-time data processing. MySQL and PostgreSQL both use SQL as their query language, which is standardized and widely supported. SQL provides a structured and well-defined approach to querying and manipulating data.

  4. ACID Compliance: ACID (Atomicity, Consistency, Isolation, Durability) is a set of properties that guarantee reliability and consistency in database transactions. MySQL and PostgreSQL are fully ACID-compliant, ensuring data consistency and reliability. MongoDB, on the other hand, sacrifices some ACID properties for the sake of scalability and performance. It supports atomic operations on a single document but does not guarantee consistency across multiple documents in a transaction.

  5. Replication and High Availability: MongoDB provides built-in support for automatic replication and high availability through its replica sets. Replica sets allow for the automatic synchronization of data across multiple servers, ensuring data redundancy and failover capabilities. MySQL and PostgreSQL also support replication and high availability but require additional configuration and setup.

  6. Schema Flexibility: MongoDB offers schema flexibility, allowing for dynamic and flexible data models. It does not enforce a predefined schema, making it easy to adapt and evolve the data structure as requirements change. MySQL and PostgreSQL, being relational databases, have a rigid schema that defines the structure of the data. Any changes to the schema require altering the tables and can be more time-consuming.

In summary, MongoDB stands out with its flexibility, horizontal scalability, and powerful querying capabilities, making it suitable for handling large amounts of unstructured data. MySQL and PostgreSQL are better suited for applications with complex relationships, strict data integrity requirements, and the need for full ACID compliance.

Share your Stack

Help developers discover the tools you use. Get visibility for your team's tech choices and contribute to the community's knowledge.

View Docs
CLI (Node.js)
or
Manual

Advice on MySQL, PostgreSQL, MongoDB

Mike
Mike

Mar 20, 2020

Needs advice

We Have thousands of .pdf docs generated from the same form but with lots of variability. We need to extract data from open text and more important - from tables inside the docs. The output of Couchbase/Mongo will be one row per document for backend processing. ADOBE renders the tables in an unusable form.

241k views241k
Comments
Anonymous
Anonymous

Apr 21, 2020

Needs advice

We are building an IOT service with heavy write throughput and fewer reads (we need downsampling records). We prefer to have good reliability when comes to data and prefer to have data retention based on policies.

So, we are looking for what is the best underlying DB for ingesting a lot of data and do queries easily

381k views381k
Comments
Maxim
Maxim

student at USI

Aug 25, 2020

Needs adviceonNode.jsNode.jsMongooseMongoosePostgreSQLPostgreSQL

Hi all. I am an informatics student, and I need to realise a simple website for my friend. I am planning to realise the website using Node.js and Mongoose, since I have already done a project using these technologies. I also know SQL, and I have used PostgreSQL and MySQL previously.

The website will show a possible travel destination and local transportation. The database is used to store information about traveling, so only admin will manage the content (especially photos). While clients will see the content uploaded by the admin. I am planning to use Mongoose because it is very simple and efficient for this project. Please give me your opinion about this choice.

321k views321k
Comments

Detailed Comparison

MySQL
MySQL
PostgreSQL
PostgreSQL
MongoDB
MongoDB

The 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.

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.

--
Flexible data model, expressive query language, secondary indexes, replication, auto-sharding, in-place updates, aggregation, GridFS
Statistics
GitHub Stars
11.8K
GitHub Stars
19.0K
GitHub Stars
27.7K
GitHub Forks
4.1K
GitHub Forks
5.2K
GitHub Forks
5.7K
Stacks
129.6K
Stacks
103.0K
Stacks
96.6K
Followers
108.6K
Followers
83.9K
Followers
82.0K
Votes
3.8K
Votes
3.6K
Votes
4.1K
Pros & Cons
Pros
  • 800
    Sql
  • 679
    Free
  • 562
    Easy
  • 528
    Widely used
  • 490
    Open source
Cons
  • 16
    Owned by a company with their own agenda
  • 3
    Can't roll back schema changes
Pros
  • 765
    Relational database
  • 511
    High availability
  • 439
    Enterprise class database
  • 383
    Sql
  • 304
    Sql + nosql
Cons
  • 10
    Table/index bloatings
Pros
  • 829
    Document-oriented storage
  • 594
    No sql
  • 554
    Ease of use
  • 465
    Fast
  • 410
    High performance
Cons
  • 6
    Very slowly for connected models that require joins
  • 3
    Not acid compliant
  • 2
    Proprietary query language

What are some alternatives to MySQL, PostgreSQL, MongoDB?

Microsoft SQL Server

Microsoft SQL Server

Microsoft® SQL Server is a database management and analysis system for e-commerce, line-of-business, and data warehousing solutions.

SQLite

SQLite

SQLite is an embedded SQL database engine. Unlike most other SQL databases, SQLite does not have a separate server process. SQLite reads and writes directly to ordinary disk files. A complete SQL database with multiple tables, indices, triggers, and views, is contained in a single disk file.

Cassandra

Cassandra

Partitioning means that Cassandra can distribute your data across multiple machines in an application-transparent matter. Cassandra will automatically repartition as machines are added and removed from the cluster. Row store means that like relational databases, Cassandra organizes data by rows and columns. The Cassandra Query Language (CQL) is a close relative of SQL.

Memcached

Memcached

Memcached is an in-memory key-value store for small chunks of arbitrary data (strings, objects) from results of database calls, API calls, or page rendering.

MariaDB

MariaDB

Started by core members of the original MySQL team, MariaDB actively works with outside developers to deliver the most featureful, stable, and sanely licensed open SQL server in the industry. MariaDB is designed as a drop-in replacement of MySQL(R) with more features, new storage engines, fewer bugs, and better performance.

RethinkDB

RethinkDB

RethinkDB is built to store JSON documents, and scale to multiple machines with very little effort. It has a pleasant query language that supports really useful queries like table joins and group by, and is easy to setup and learn.

ArangoDB

ArangoDB

A distributed free and open-source database with a flexible data model for documents, graphs, and key-values. Build high performance applications using a convenient SQL-like query language or JavaScript extensions.

InfluxDB

InfluxDB

InfluxDB is a scalable datastore for metrics, events, and real-time analytics. It has a built-in HTTP API so you don't have to write any server side code to get up and running. InfluxDB is designed to be scalable, simple to install and manage, and fast to get data in and out.

CouchDB

CouchDB

Apache CouchDB is a database that uses JSON for documents, JavaScript for MapReduce indexes, and regular HTTP for its API. CouchDB is a database that completely embraces the web. Store your data with JSON documents. Access your documents and query your indexes with your web browser, via HTTP. Index, combine, and transform your documents with JavaScript.

Oracle

Oracle

Oracle Database is an RDBMS. An RDBMS that implements object-oriented features such as user-defined types, inheritance, and polymorphism is called an object-relational database management system (ORDBMS). Oracle Database has extended the relational model to an object-relational model, making it possible to store complex business models in a relational database.

Related Comparisons

Bootstrap
Materialize

Bootstrap vs Materialize

Laravel
Django

Django vs Laravel vs Node.js

Bootstrap
Foundation

Bootstrap vs Foundation vs Material UI

Node.js
Spring Boot

Node.js vs Spring-Boot

Liquibase
Flyway

Flyway vs Liquibase