DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Zones

Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks

Low-Code Development: Leverage low and no code to streamline your workflow so that you can focus on higher priorities.

DZone Security Research: Tell us your top security strategies in 2024, influence our research, and enter for a chance to win $!

Launch your software development career: Dive head first into the SDLC and learn how to build high-quality software and teams.

Open Source Migration Practices and Patterns: Explore key traits of migrating open-source software and its impact on software development.

Related

  • Fine-Tuning Performance, Resolving Common Issues in FinTech Application With MySQL
  • The Ultimate Guide on DB-Generated IDs in JPA Entities
  • Manage Hierarchical Data in MongoDB With Spring
  • Spring Data: Data Auditing Using JaVers and MongoDB

Trending

  • Mastering Serverless Debugging
  • Efficient Data Management With Offset and Cursor-Based Pagination in Modern Applications
  • Transforming Software Development With Low-Code and No-Code Integration
  • Javac and Java Katas, Part 1: Class Path
  1. DZone
  2. Data Engineering
  3. Databases
  4. How to Choose the Right Database Among Cassandra, MongoDB, and MySQL for Your Applications

How to Choose the Right Database Among Cassandra, MongoDB, and MySQL for Your Applications

See how to choose the right database for your applications.

By 
Gazanfur Ali Mohammed user avatar
Gazanfur Ali Mohammed
·
Apr. 25, 19 · Opinion
Like (12)
Save
Tweet
Share
17.3K Views

Join the DZone community and get the full member experience.

Join For Free

In this article, I compared ACID properties, CAP attributes, and other features among Cassandra, MongoDB, and MySQL databases to help you choose the right database for your applications. Choosing the right database primarily depends on application needs. There are many factors that need to be considered while choosing the database, In this article, I mainly focused on the transactional aspect.

Cassandra: A key-value-store that stores data in a schema-less way.

MongoDB: A document database that expands on the basic idea of key-value-store.

Mysql: A relational database management system.

First, let’s looks at ACID supportability.

What Is ACID?

ACID: A set of properties that guarantees a database transaction is reliable. ACID stands for Atomicity, Consistency, Isolation, and Durability. ACID Properties are an essential part of the database.

Generally, most relational databases support all ACID properties. However, NoSQL databases have various levels of support for ACID. Cassandra and MongoDB are NoSQL databases whereas MySQL is a SQL database.

Database DB Type Atomicity Consistency Isolation Durability
Cassandra NoSQL Write operations are atomic at the partition level Eventual /Tunable Row Level Writes are durable
MongoDB NoSQL Supports single document atomicity Support Adjustable Supports multiple durability options
MySQL SQL InnoDB Storage Engine support transaction atomicity InnoDB uses a file flush technique called doublewrite Offers different levels of isolation Can be tuned using configurable parameters

What Is the CAP Theorem?

A theorem that describes how the laws of physics dictate that a distributed system MUST make a tradeoff among desirable characteristics.CAP stands for Consistency, Availability, and Partition tolerance.

Generally, most databases support two CAP attributes.

Image title

Some databases make an effort to support all three, but they still prioritize them in a certain way. For example, Cassandra provides high availability and partition tolerance, and it also supports consistency using eventual consistency. If you are looking for high availability and consistency, then MySQL could be the right choice. MongoDB supports Partition Tolerance and Consistency. MongoDB also supports availability to some extent.

Finally, Let’s compare other attributes

Properties Cassandra MongoDB MySQL
Transaction Rollback No Yes Yes
Faster Writes Yes Yes No
Locking Mechanism No Yes Yes
Table Joins No No Yes
Master Less Architecture Yes No No

Conclusion

The important thing is to understand the needs of your application. Then, check which database is closely matching to your requirements. Sometimes, you may not be able to find a comprehensive database that can support all your requirements. In that case, you may have to trade off something to fulfill your top priorities.

Database Relational database MySQL MongoDB application

Opinions expressed by DZone contributors are their own.

Related

  • Fine-Tuning Performance, Resolving Common Issues in FinTech Application With MySQL
  • The Ultimate Guide on DB-Generated IDs in JPA Entities
  • Manage Hierarchical Data in MongoDB With Spring
  • Spring Data: Data Auditing Using JaVers and MongoDB

Partner Resources


Comments

ABOUT US

  • About DZone
  • Send feedback
  • Community research
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 100
  • Nashville, TN 37211
  • support@dzone.com

Let's be friends: