The newest round of performance comparisons of PostgreSQL and MongoDB produced a near repeat of the results from the first tests that proved PostgreSQL can outperform MongoDB. The advances Postgres has made with JSON and JSONB have transformed Postgres’ ability to support a document database.
Creating document database capabilities in a relational database that can outperform the leading NoSQL-only solution is an impressive achievement. But perhaps more important is what this means to the end user – new levels of speed, efficiency and flexibility for developers with the protections of ACID compliance enterprises require for mission critical applications.
To learn more about Postgres NoSQL, visit NoSQL for the Enterprise or contact us.
Postgres vs. Mongo
EnterpriseDB (EDB) began running comparative evaluations to help users correctly assess Postgres’ NoSQL capabilities. The initial set of tests compared MongoDB v2.6 to Postgres v9.4 beta, on single machine instances. Both systems were installed on Amazon Web Services M3.2XLARGE instances with 32GB of memory.
EDB found that Postgres outperforms MongoDB in selecting, loading and inserting complex document data in key workloads involving 50 million records:
- Ingestion of high volumes of data was approximately 2.1 times faster in Postgres
- MongoDB consumed 33% more the disk space
- Data inserts took almost 3 times longer in MongoDB
- Data selection took more than 2.5 times longer in MongoDB than in Postgres
The data is almost identical to the results found in testing with 10 million records. However, it's important to note a Correction to earlier versions. PostgreSQL community member Alvaro Tortosa found that the MongoDB console does not allow for INSERT of documents > 4K. This led to truncation of the MongoDB size by approx. 25% of all records in the benchmark.
We have published the testing framework for public scrutiny and invite input on the results and our methods as well as suggestions on new testing frameworks. The testing framework is located here on the EDB Github repository.
With the newest version, PostgreSQL has ushered in a new era of developer flexibility exceeding the freedom they discovered with NoSQL-only solutions. The use of niche solutions, like MongoDB, increased because developers needed freedom from the structured data model required by relational databases. They needed to move quickly and work with new data types. They choose powerful but limited solutions that addressed immediate needs, that let them make changes without having to wait for a DBA.
However, many organizations have discovered that successful applications often require structure down the road, as data becomes more valuable across the organization. Postgres gives developers broad new powers to start out unstructured, and then when the need arises, combine unstructured and structured data using the same database engine and within an ACID-compliant environment.
The code shows Postgres has the capability, and now our performance comparisons demonstrate Postgres can handle the loads.
Marc Linster is Senior Vice President, Products and Services, at EnterpriseDB.