EDUCBA

EDUCBA

MENUMENU
  • Free Tutorials
  • Free Courses
  • Certification Courses
  • 360+ Courses All in One Bundle
  • Login

Cassandra vs MySQL

By Priya PedamkarPriya Pedamkar

Home » Data Science » Data Science Tutorials » Head to Head Differences Tutorial » Cassandra vs MySQL

Cassandra-vs-MySQL

Difference Between Cassandra vs MySQL

Cassandra vs MySQL in this Data is everything, and with a boom in the amount of data today, choosing the right database management system is all the more important for all businesses. For a world that was dominated by Oracle and SQL Server, there are endless solutions to choose from now. One of the main reasons is the innovation possible due to open source solutions. In this article, I will be talking about two open-source databases. One being Cassandra which has gained a lot of momentum over the past few years. And the other MySQL which is the most common and popular database.

Head to Head Comparison Between Cassandra and MySQL(Infographics)

Below are the Top 6 differences between Cassandra and MySQL:

Start Your Free Data Science Course

Hadoop, Data Science, Statistics & others

Cassandra-vs-MySQL-info

Key Differences Between Cassandra and MySQL

In this article, we will look at the key differences between these two databases, which will help you figure out which database to use.

Type of database

Cassandra is a NoSQL database. It was developed by the Apache Software Foundation. It was released in 2008. NoSQL(Not only SQL) databases were developed in response to the shortcomings faced by relational database management systems and to meet the demands of modern software development. NoSQL databases support a wide range of data which includes key-value, document and graph formats. It can store both unstructured and semi-structured data. It follows a peer to peer architecture.

MySQL is an open-source Relational Database Management System developed by Oracle which was released in 1995. Compared to Cassandra it is quite an old database. SQL databases support related data stored among different tables. MySQL stores structured data(high degree of an organization). Essentially the relational model consists of tables (relations) that can be interlinked by keys common to multiple tables. It follows a Master/Slave architecture.

1. Scalability

MySQL provides support for vertical scaling. Horizontal scaling is possible with the help of some other approaches like Master/Slave replication and sharding.

Cassandra was developed with the support for both horizontal and vertical scaling. Horizontal scaling is possible due to the cluster node model. Data is partitioned among different nodes in a cluster.

Popular Course in this category
Sale
All in One Data Science Bundle (360+ Courses, 50+ projects)360+ Online Courses | 1500+ Hours | Verifiable Certificates | Lifetime Access
4.7 (3,220 ratings)
Course Price

View Course

Related Courses
Data Scientist Training (85 Courses, 67+ Projects)Tableau Training (7 Courses, 8+ Projects)Azure Training (6 Courses, 5 Projects, 4 Quizzes)Hadoop Training Program (20 Courses, 14+ Projects, 4 Quizzes)Data Visualization Training (15 Courses, 5+ Projects)
2. Data Model

The main difference that can be seen between MySQL and Cassandra is how the data is modeled.

Let us take an example to show how there is a significant difference between data modeling in these two databases. Consider a portal where a user can comment on a post made by another user, If we wanted to store this information it would be stored in different ways in these two databases.

In MySQL, we would have to make two tables with one to many relationships between them like below. As MySQL doesn’t allow unstructured data, for eg. a List or a Map, we do require one to many relationships among these tables.

To fetch data you would typically use JOINS on these tables.

data model 1

In Cassandra this information can be stored in one table, we can store the comments for each user in the form of a List which would be stored as one single row. Here user_id is the Partition key (using which data would be partitioned among the different nodes) and created_time is the cluster key using which the data would be sorted in a particular node.

data model 2

3. Read Performance

Now that we have looked at how we can model data in both databases. Let us analyze how our read performance changes from one database to the other.

In MySQL, the query to get the comments made by a user with id say ‘3’ will look something like this,

SELECT * from Users u, Comments c WHERE u.user_id=c.user_id and user_id=3;

Here first finding a user would be of O(log(U)). This is because when you use indexing in MySQL it stores the data in the form of a binary tree, so any time you search for comments made by a user, you are only going to traverse through half of the tree. As there is a one to many relationships between the two, this would now take C*O(log(C)) as we will have to find each comment_id for a particular user_id.

In Cassandra, surprisingly this decreases to just O(1).

Our query will look something like this,

SELECT * from Users WHERE user_id=3;

As we discussed, we would only have to store one row in Cassandra for a particular user_id. It would just require one lookup. In the worst case, it can go up to O(log(U)).

4. Write Performance

In MySQL, every INSERT/UPDATE/DELETE requires a search to be done.  If you want to update a record with a primary key that already exists in the table.

  • It will first search for the row
  • Then update it

Cassandra, on the other hand, uses an append-only model. Insert and update have no fundamental difference. If we insert a row that has the same primary key as an existing row, the row will be replaced. If you update a row and the primary key does not exist, Cassandra will create that row.

5. Transactions

As any other RDBMS databases, MySQL provides ACID transactions

  • Atomicity
  • Consistency
  • Isolation
  • Durability

Whereas, Cassandra has limitations when it comes to providing ACID transactions. To provide high read performance you would see that there is data duplication. One way to achieve consistency would be to tune Cassandra to not allow data duplication but then it kills Cassandra’s trump- Availability. So for systems that are highly based on ACID transactions like banking systems choosing any NoSQL database is a NO.

Let us summarize the key differences we looked at between Cassandra and MySQL. In case you did not read through the article and just want to get the gist of it.

Cassandra and MySQL Comparison Table

Let’s discuss the top comparison between Cassandra and MySQL:

Basis of Comparison Cassandra MySQL
Type of database NoSQL, peer to peer architecture. RDBS, Master/Slave.
Scalability Horizontally and Vertically Scalable. Vertically Scalable, Horizontal scaling possible through Master/Slave replication or sharding.
Data Model JOINS discouraged with the query-driven model.  Fetches data from one table per query. Multiple tables, Joins required to query data.

 

Read Performance O(1) Requires reading from multiple tables using JOIN, resulting in O(log(n)).
Write Performance The append model provides high writing performance. Writing requires a search first which slows down write performance.
Transaction ACID properties are not provided, can be tuned to support ACID properties. Provides ACID transactions.

 

Conclusion

In this article, we learned about some key differences between Cassandra and MySQL. Most businesses use Cassandra for write-heavy workloads in the field of Data Science whereas MySQL is preferred for all other types of workloads. Hopefully, this would give you the knowledge to choose the right database according to your needs.

Recommended Articles

This is a guide to Cassandra vs MySQL. Here we have discussed Cassandra vs MySQL head to head comparison, key difference along with infographics and comparison table respectively. You can also go through our other suggested articles to learn more–

  1. Cassandra vs Redis
  2. MongoDB vs Postgres
  3. Cassandra vs Elasticsearch
  4. Cassandra vs Couchbase | Top Differences

All in One Data Science Bundle (360+ Courses, 50+ projects)

360+ Online Courses

1500+ Hours

Verifiable Certificates

Lifetime Access

Learn More

1 Shares
Share
Tweet
Share
Primary Sidebar
Head to Head Differences Tutorial
  • Differences Tutorial
    • ArangoDB vs MongoDB
    • Cloud Computing vs Big Data Analytics
    • PostgreSQL vs MariaDB
    • Domo vs Tableau
    • Data Scientist vs Data Engineer vs Statistician
    • Big Data Vs Machine Learning
    • Business Intelligence vs Data Warehouse
    • Apache Kafka vs Flume
    • Data Science vs Machine Learning
    • Business Analytics Vs Predictive Analytics
    • Data mining vs Web mining
    • Data Science Vs Data Mining
    • Data Science Vs Business Analytics
    • Analyst vs Associate
    • Apache Hive vs Apache Spark SQL
    • Apache Nifi vs Apache Spark
    • Apache Spark vs Apache Flink
    • Apache Storm vs Kafka
    • Artificial Intelligence vs Business Intelligence
    • Artificial Intelligence vs Human Intelligence
    • Al vs ML vs Deep Learning
    • Assembly Language vs Machine Language
    • AWS vs AZURE
    • AWS vs Azure vs Google Cloud
    • Big Data vs Data Mining
    • Big Data vs Data Science
    • Big Data vs Data Warehouse
    • Blu-Ray vs DVD
    • Business Intelligence vs Big Data
    • Business Intelligence vs Business Analytics
    • Business Intelligence vs Data analytics
    • Business Intelligence VS Data Mining
    • Business Intelligence vs Machine Learning
    • Business Process Re-Engineering vs CI
    • Cassandra vs Elasticsearch
    • Cassandra vs Redis
    • Cloud Computing Public vs Private
    • Cloud Computing vs Fog Computing
    • Cloud Computing vs Grid Computing
    • Cloud Computing vs Hadoop
    • Computer Network vs Data Communication
    • Computer Science vs Data Science
    • Computer Scientist vs Data Scientist
    • Customer Analytics vs Web Analytics
    • Data Analyst vs Data Scientist
    • Data Analytics vs Business Analytics
    • Data Analytics vs Data Analysis
    • Data Analytics Vs Predictive Analytics
    • Data Lake vs Data Warehouse
    • Data Mining Vs Data Visualization
    • Data mining vs Machine learning
    • Data Mining Vs Statistics
    • Data Mining vs Text Mining
    • Data Science vs Artificial Intelligence
    • Data science vs Business intelligence
    • Data Science Vs Data Engineering
    • Data Science vs Data Visualization
    • Data Science vs Software Engineering
    • Data Scientist vs Big Data
    • Data Scientist vs Business Analyst
    • Data Scientist vs Data Engineer
    • Data Scientist vs Data Mining
    • Data Scientist vs Machine Learning
    • Data Scientist vs Software Engineer
    • Data visualisation vs Data analytics
    • Data vs Information
    • Data Warehouse vs Data Mart
    • Data Warehouse vs Database
    • Data Warehouse vs Hadoop
    • Data Warehousing VS Data Mining
    • DBMS vs RDBMS
    • Deep Learning vs Machine learning
    • Digital Analytics vs Digital Marketing
    • Digital Ocean vs AWS
    • DOS vs Windows
    • ETL vs ELT
    • Small Data Vs Big Data
    • Apache Hadoop vs Apache Storm
    • Hadoop vs HBase
    • Between Data Science vs Web Development
    • Hadoop vs MapReduce
    • Hadoop Vs SQL
    • Google Analytics vs Mixpanel
    • Google Analytics Vs Piwik
    • Google Cloud vs AWS
    • Hadoop vs Apache Spark
    • Hadoop vs Cassandra
    • Hadoop vs Elasticsearch
    • Hadoop vs Hive
    • Hadoop vs MongoDB
    • HADOOP vs RDBMS
    • Hadoop vs Spark
    • Hadoop vs Splunk
    • Hadoop vs SQL Performance
    • Hadoop vs Teradata
    • HBase vs HDFS
    • Hive VS HUE
    • Hive vs Impala
    • JDBC vs ODBC
    • Kafka vs Kinesis
    • Kafka vs Spark
    • Cloud Computing vs Data Analytics
    • Data Mining Vs Data Analysis
    • Data Science vs Statistics
    • Big Data Vs Predictive Analytics
    • MapReduce vs Yarn
    • Hadoop vs Redshift
    • Looker vs Tableau
    • Machine Learning vs Artificial Intelligence
    • Machine Learning vs Neural Network
    • Machine Learning vs Predictive Analytics
    • Machine Learning vs Predictive Modelling
    • Machine Learning vs Statistics
    • MariaDB vs MySQL
    • Mathematica vs Matlab
    • Matlab vs Octave
    • MATLAB vs R
    • MongoDB vs Cassandra
    • MongoDB vs DynamoDB
    • MongoDB vs HBase
    • MongoDB vs Oracle
    • MongoDB vs Postgres
    • MongoDB vs PostgreSQL
    • MongoDB vs SQL
    • MongoDB vs SQL server
    • MS SQL vs MYSQL
    • MySQL vs MongoDB
    • MySQL vs MySQLi
    • MySQL vs NoSQL
    • MySQL vs SQL Server
    • MySQL vs SQLite
    • Neural Networks vs Deep Learning
    • PIG vs MapReduce
    • Pig vs Spark
    • PL SQL vs SQL
    • Power BI Dashboard vs Report
    • Power BI vs Excel
    • Power BI vs QlikView
    • Power BI vs SSRS
    • Power BI vs Tableau
    • Power BI vs Tableau vs Qlik
    • PowerShell vs Bash
    • PowerShell vs CMD
    • PowerShell vs Command Prompt
    • PowerShell vs Python
    • Predictive Analysis vs Forecasting
    • Predictive Analytics vs Data Mining
    • Predictive Analytics vs Data Science
    • Predictive Analytics vs Descriptive Analytics
    • Predictive Analytics vs Statistics
    • Predictive Modeling vs Predictive Analytics
    • Private Cloud vs Public Cloud
    • Regression vs ANOVA
    • Regression vs Classification
    • ROLAP vs MOLAP
    • ROLAP vs MOLAP vs HOLAP
    • Spark SQL vs Presto
    • Splunk vs Elastic Search
    • Splunk vs Nagios
    • Splunk vs Spark
    • Splunk vs Tableau
    • Spring Cloud vs Spring Boot
    • Spring vs Hibernate
    • Spring vs Spring Boot
    • Spring vs Struts
    • SQL Server vs PostgreSQL
    • Sqoop vs Flume
    • Statistics vs Machine learning
    • Supervised Learning vs Deep Learning
    • Supervised Learning vs Reinforcement Learning
    • Supervised Learning vs Unsupervised Learning
    • Tableau vs Domo
    • Tableau vs Microstrategy
    • Tableau vs Power BI vs QlikView
    • Tableau vs QlikView
    • Tableau vs Spotfire
    • Talend Vs Informatica PowerCenter
    • Talend vs Mulesoft
    • Talend vs Pentaho
    • Talend vs SSIS
    • TensorFlow vs Caffe
    • Tensorflow vs Pytorch
    • TensorFlow vs Spark
    • TeraData vs Oracle
    • Text Mining vs Natural Language Processing
    • Text Mining vs Text Analytics
    • Cloud Computing vs Virtualization
    • Unit Test vs Integration Test?
    • Universal analytics vs Google Analytics
    • Visual Analytics vs Tableau
    • R vs Python
    • R vs SPSS
    • Star Schema vs Snowflake Schema
    • DDL vs DML
    • R vs R Squared
    • ActiveMQ vs Kafka
    • TDM vs FDM
    • Linear Regression vs Logistic Regression
    • Slf4j vs Log4j
    • Redis vs Kafka
    • Travis vs Jenkins
    • Fact Table vs Dimension Table
    • OLTP vs OLAP
    • Openstack vs Virtualization
    • Cluster v/s Factor analysis
    • Informatica vs Datastage
    • CCBA vs CBAP
    • SPSS vs EXCEL
    • Excel vs Tableau
    • Cassandra vs MySQL
    • RabbitMQ vs Kafka
    • SAAS vs Cloud
    • RabbitMQ vs Redis
    • AMQP vs MQTT
    • Forward Chaining vs Backward Chaining
    • Google Data Studio vs Tableau
    • ActiveMQ vs RabbitMQ
    • Cloud vs Data Center
    • Cores vs Threads
    • Inner Join vs Outer Join
    • ZeroMQ vs Kafka
    • Mxnet vs TensorFlow
    • Redis vs Memcached
    • RDBMS vs NoSQL
    • AWS Direct Connect vs VPN
    • Cassandra vs Couchbase
    • Elegoo vs Arduino
    • Redis vs MongoDB
    • Chef vs Puppet
    • GSM vs GPRS
    • Keras vs TensorFlow vs PyTorch
    • Cloudflare vs CloudFront
    • Bitmap vs Vector
    • Left Join vs Right Join
    • IaaS vs PaaS
    • Blue Prism vs UiPath
    • GNSS vs GPS
    • Cloudflare vs Akamai
    • GCP vs AWS vs Azure
    • Arduino Mega vs Uno
    • Qualitative vs Quantitative Data
    • Arduino Micro vs Nano
    • PIC vs Arduino
    • PRTG vs Solarwinds
    • PostgreSQL vs SQLite
    • Metabase vs Tableau
    • Arduino Leonardo vs Uno
    • Arduino Due vs Mega
    • ETL Vs Database Testing
    • DBMS vs File System
    • CouchDB vs MongoDB
    • Arduino Nano vs Mini
    • IaaS vs PaaS vs SaaS
    • On-premise vs off-premise
    • Couchbase vs CouchDB
    • Tableau Dimension vs Measure
    • Cognos vs Tableau
    • Data vs Metadata
    • RethinkDB vs MongoDB
    • Cloudera vs Snowflake
    • HBase vs Cassandra
    • Business Analytics vs Business Intelligence
    • R Programming vs Python
    • MongoDB vs Hadoop
    • MySQL vs Oracle
    • OData vs GraphQL
    • Soft Computing vs Hard Computing
    • Binary Tree vs Binary Search Tree
    • Datadog vs CloudWatch
    • B tree vs Binary tree
    • Cloudera vs Hortonworks
    • DevSecOps vs DevOps
    • PostgreSQL Varchar vs Text
    • PostgreSQL Database vs schema
    • MapReduce vs spark
    • Hypervisor vs Docker
    • SciLab vs Octave
    • DocumentDB vs DynamoDB
    • PostgreSQL union vs union all
    • OrientDB vs Neo4j
    • Data visualization vs Business Intelligence
    • QlikView vs Qlik Sense
    • Neo4j vs MongoDB
    • Postgres Schema vs Database
    • Mxnet vs Pytorch
    • Naive Bayes vs Logistic Regression
    • Random Forest vs Decision Tree
    • Random Forest vs XGBoost
    • DynamoDB vs Cassandra
    • Looker vs Power BI
    • PostgreSQL vs RedShift
    • Presto vs Hive
    • Random forest vs Gradient boosting
    • Gradient boosting vs AdaBoost
    • Amazon rds vs Redshift
    • Bigquery vs Bigtable
    • Data Architect vs Data Engineer
    • DataSet vs DataTable
    • dataset vs dataframe
    • Dataset vs Database
    • New Relic vs Splunk
    • Data Architect and Management Designer
    • Data Engineer vs Data Analyst
    • Grafana vs Tableau
    • MySQL text vs Varchar
    • Relational Database vs Flat File
    • Datadog vs Prometheus
    • Neo4j vs Neptune
    • Data Mining vs Data warehousing
    • DocumentDB vs MongoDB
    • PostScript vs PCL
    • QRadar vs Splunk
    • Qlik Sense vs Tableau
    • DigitalOcean vs Google Cloud
    • PostgreSQL vs Elasticsearch
    • Redshift vs blueshift
    • Gitlab vs Azure DevOps

Related Courses

Online Data Science Course

Online Tableau Training

Azure Training Course

Hadoop Certification Course

Data Visualization Courses

All in One Data Science Course

Footer
About Us
  • Blog
  • Who is EDUCBA?
  • Sign Up
  • Live Classes
  • Corporate Training
  • Certificate from Top Institutions
  • Contact Us
  • Verifiable Certificate
  • Reviews
  • Terms and Conditions
  • Privacy Policy
  •  
Apps
  • iPhone & iPad
  • Android
Resources
  • Free Courses
  • Database Management
  • Machine Learning
  • All Tutorials
Certification Courses
  • All Courses
  • Data Science Course - All in One Bundle
  • Machine Learning Course
  • Hadoop Certification Training
  • Cloud Computing Training Course
  • R Programming Course
  • AWS Training Course
  • SAS Training Course

© 2022 - EDUCBA. ALL RIGHTS RESERVED. THE CERTIFICATION NAMES ARE THE TRADEMARKS OF THEIR RESPECTIVE OWNERS.

EDUCBA
Free Data Science Course

Hadoop, Data Science, Statistics & others

*Please provide your correct email id. Login details for this Free course will be emailed to you

By signing up, you agree to our Terms of Use and Privacy Policy.

EDUCBA
Free Data Science Course

Hadoop, Data Science, Statistics & others

*Please provide your correct email id. Login details for this Free course will be emailed to you

By signing up, you agree to our Terms of Use and Privacy Policy.

EDUCBA Login

Forgot Password?

By signing up, you agree to our Terms of Use and Privacy Policy.

Let’s Get Started

By signing up, you agree to our Terms of Use and Privacy Policy.

EDUCBA

*Please provide your correct email id. Login details for this Free course will be emailed to you

By signing up, you agree to our Terms of Use and Privacy Policy.

This website or its third-party tools use cookies, which are necessary to its functioning and required to achieve the purposes illustrated in the cookie policy. By closing this banner, scrolling this page, clicking a link or continuing to browse otherwise, you agree to our Privacy Policy

Loading . . .
Quiz
Question:

Answer:

Quiz Result
Total QuestionsCorrect AnswersWrong AnswersPercentage

Explore 1000+ varieties of Mock tests View more

Independence Day Offer - All in One Data Science Bundle (360+ Courses, 50+ projects) Learn More