New Benchmarks Show Postgres Dominating MongoDB in Varied Workloads

Release Date

Performance of two of the fastest-growing database management systems compared head-to-head with Postgres emerging as the winner

The Postgres database management system (DBMS) measured between 4 and 15 times faster than MongoDB in transaction performance testing conducted by OnGres, a company specializing in providing database software and services and sponsored by EnterpriseDB.

Interestingly, Postgres demonstrated a performance advantage in a JSON (JavaScript Object Notation)-based online analytical processing (OLAP) test designed specifically to focus on document-based data, MongoDB’s presumed strength. Additional testing was conducted on online transaction processing (OLTP) workloads. For the OLTP test, the industry standard sysbench benchmark was used to show Postgres performing three times faster than MongoDB on average. Throughout the testing measuring performance on various workloads, Postgres consistently delivered higher performance than MongoDB.

All the code used in testing is open source and available on GitLab so others can independently reproduce and audit the results. In addition, the testing methodology and results are available for download today.

“The benchmark was designed to be reproducible and run on a public cloud, so anyone who wants to compare Postgres and MongoDB can easily do so,” said Alvaro Hernandez, founder of OnGres. “We’re sharing all the information on the tests we ran, why they were selected and the results we found so that anyone can reproduce the results or change parameters and configurations for their own needs.”

The GitLab project includes two repositories which allow a comparison of the performance of Postgres 11.1 and MongoDB 4.0 running on Amazon Web Services (AWS). The goal of the benchmark was to compare the performance of Postgres and MongoDB in several different use cases while simulating real-life production scenarios as much as possible. The tests analyze the capabilities and performance of Postgres and MongoDB using the same data design across a range of active dataset sizes. Both public and generated datasets were used.

The difference in results in the transactions benchmark were particularly stark. This benchmark was specifically designed to evaluate Postgres and the new MongoDB 4.0 capabilities in running multi-document ACID (Atomicity Consistency Isolation Durability) transactions, measuring both performance and latency. As shown in the graph below, Postgres performed between 4 and 15 times faster than MongoDB across a range of scenarios.

MongoDB vs PostgreSQL

Across all benchmark types, it was found that as the datasets becomes bigger than the available memory capacity, the Postgres performance advantage grows over MongoDB.


“If this was a horse race, Postgres would win by a mile,” said Hernandez. “The tests show that If you want a database that delivers fast performance and lower latency, you want Postgres.”

“It was expected that a mature relational database management system (RDBMS) like Postgres would have an advantage over MongoDB in transaction processing,” said Ken Rugg, chief product and strategy officer of EnterpriseDB. “But, what was surprising was the clear advantage Postgres had in the testing that specifically focused on operating on JSON-based documents.”

“Postgres is a true general-purpose database capable of supporting a wide variety of workloads from high performance transaction processing systems to analytics for data warehouses and reporting applications,” said Ed Boyajian, CEO of EnterpriseDB. “More and more, however, it is competing with niche NoSQL document database. technologies like MongoDB. The benchmarks that show Postgres beating Mongo are compelling. Enterprises should be rushing to evaluate Postgres for these workloads.”

Alvaro Hernandez will present on the performance testing benchmarks at the Postgres Vision event from June 24 to 26 in Boston where the keynote presentation will be delivered by Tim Berners-Lee, the inventor of the World Wide Web.

#  #  #

EnterpriseDB is a registered trademark of EnterpriseDB Corporation. Other trademarks may be trademarks of their respective owners. Mongo is a trademark of MongoDB, Inc. 
Glenn Rossman


  EnterpriseDB commissioned the study that is discussed in this press release.