Select Star Logo
May 25, 2021

Here’s Why You Should Choose HarperDB Over MongoDB

Generic Placeholder for Profile Picture
May 25, 2021
Harsha Vardhan
Community Collaborator

Table of Contents

NoSQL, SQL, NewSQL — HarperDB has it all

View original post here.

Are you looking for the right database for your product? Are you confused if you should pick SQL or NoSQL? What if there is a product that has the best of both worlds? What’s that product you ask? — It’s HarperDB.

Why was I fascinated by HarperDB?

For someone who had learned SQL all my life and mostly worked with only SQL solutions, it was initially tough to get my head around MongoDB. Call me old school, but despite its advantages, I’ve always wondered why read operations were expensive if there are ways to avoid duplication if there were easier ways to get data from complex queries. Not just with MongoDB, these are the drawbacks for most of the NoSQL solutions. When I first read about HarperDB, it was a moment of revelation where I understood that we could have NoSQL solutions without all the overheads and drawbacks that we’d have in any other common NoSQL Database. The tabular structure that HarperDB provides helps me understand it better as it connects back to the roots of the cliched SQL database table structure.

What’s HarperDB?

HarperDB, is a complete data management platform that provides solutions for every problem that any developer would have in mind. Using HarperDB one can perform the conventional SQL operations such as — joins, order by, group by, etc and it can also support document store, schemaless data modeling, API based query execution, etc.

HarperDB is super easy to use with minimal configurations that developers with skills of any level can work on. Using normal REST APIs data of type JSON, CSVs, or via SQL can be inserted. Here, we can leverage the flexibility of a NoSQL schema with the consistency, security, and durability of an RDBMS in a single storage engine. It also supports multiple plugins like ODBC, JDBC, Node-RED, and many more.

I was so mind blown by the product and I couldn’t help but compare it with the other best Database solution I could think of — MongoDB. MongoDB laid the foundation of setting standards for NoSQL Database. Though MongoDB paved the way for many other database platforms, HarperDB has evolved to be much faster and better in many ways. Let’s now compare and contrast.

What’s MongoDB and HarperDB?

MongoDB is a NoSQL database that is document-oriented and uses JSON-like documents with optional schemas.

HarperDB is a distributed database with a REST API and dynamic schema that supports NoSQL and SQL including joins.

Performance

Image source: HarperDB

Benchmark tests have proved that HarperDB is 37.9 times faster than MongoDB on an average for only half the price. To be more specific, it’s 98 times faster on reads and 20 times faster on writes. MongoDB has faster writes than that of reads, whereas in HarperDB we have high performance overall because its data storage algorithm is written on top of LMDB (Lightning Memory-Mapped Database). Lightning Memory-Mapped Database is a software library that provides a high-performance embedded transactional database in the form of a key-value store, which in turn helps with faster reads and writes in HarperDB.

MongoDB is mainly programmed in C, C++, and JavaScript. HarperDB is written in Node.js (LMDB is written in C, and Python is used in the install process). MongoDB uses BSON (Binary JavaScript Object Notation) under the hood to make querying fast. This is then translated to JSON to be read when you open your collection. HarperDB does not enforce data types, storing data in its native format, and data can be queried via SQL and/or NoSQL.

Data Storage and Architecture

HarperDB stores data in tables as rows or objects with all top-level attributes are indexed by default. But, MongoDB stores data as individual documents. HarperDB has a unique and efficient data storage algorithm that runs on top of LMDB which enables HarperDB to store JSON documents and also relational data in a single product. While storing data, HarperDB maps it to the data model and no matter how the data is stored it can be queried via SQL or NoSQL.

ACID Properties (Atomic, Consistent, Isolated, and Durable)

HarperDB has enterprise-grade ACID SQL transactions and hence the validity of the data in HarperDB is very reliable. Most of the NoSQL databases adopt eventual consistency instead of ACID properties, the same is the case with MongoDB. In HarperDB one can execute complex and ACID-compliant SQL queries on JSON without any data duplication.

Cost

Image source: HarperDB

HarperDB only costs half of MongoDB Atlas. Since, HarperDB requires very little computing, the cost of scaling is less. It does not have duplicate data and it natively supports SQL and NoSQL, owing to low storage costs, unlike MongoDB.

Native API

HarperDB is built natively as a set of microservices, making development and integration easy and seamless. It also supports multiple plugins like ODBC, JDBC, Node-RED, and many more.

HarperDB utilizes a single-endpoint for all operations. HarperDB’s RESTful nature makes it stateless, stable, and scalable.

Accessibility

HarperDB is a full-featured data management platform that runs from edge to cloud, and anywhere in between. And the same applies to MongoDB as well, it can run anywhere as well, that is, in the cloud, locally, data center, etc.

Conclusion

Any product that we use would definitely have its own pros and cons. If you’re okay with using a database that only has faster writes and slower reads, with bad memory management then MongoDB is still the right choice for you. But, if you do decide to work with a database that helps you manage the data efficiently, with faster reads and writes, and extremely cost-efficient — then HarperDB is definitely the perfect Database solution. I personally feel HarperDB’s SQL/NoSQL capabilities make it revolutionary. If you found HarperDB intriguing, here’s a free sign-up link for you to try out.

While you're here, learn about HarperDB, a breakthrough development platform with a database, applications, and streaming engine in one unified solution.

Check out HarperDB