SQL VS NOSQL:
SQL:
The SQL category includes relational databases manipulating data with structured query language.
NOSQL:
NOSQL databases resolve existing scaling and accessibility issues characteristic of traditional relational databases.
Differences: SQL & NOSQL databases are in no way better than one another, all individual databases differ a lot even inside each category.
SQL Databases:
-
Data Model based on the table rows
-
Data Structure pre-defined schema
-
Scalability is vertical
-
Query Language is structured Query Language.
-
Advantages are Complex queries in intensive environments.
-
Design Properties - ACID put consistency over availability.
NOSQL Database:
-
Data Model based on one of types - Columns, Documents, Key/value pairs, Graphs
-
Data structure is schema-less or dynamic schema
-
Scalability is Horizontal
-
Query language is application programming languages like javascript, java, python etc or query languages created for a specific database.
-
Advantages - Adhering to CAP Theorem Properties
-
Design Properties - BASE put availability over consistency
View on cassandra vs mongodb: both are enormously scalable high performance databases belonging to the nosql family yet these two are radically different.
cassandra:
cassandra database is designed to manipulate huge data arrays across multiple nodes in contrast to the relational database organizing data records in rows, cassandra data model is based on columns to provide faster data retrieval.
mongodb:
mongodb database stores data in the form of json-like documents instead of table records used in relational databases. it allows faster data integration. it is interesting to draw a parallel between mongodb document oriented data model and that of traditional table-oriented sql database.
Both cassandra and monogodb enjoy populartiy among thousands of well-known and highly reputed organizations like reddit, facebook, netflix for cassandra and for google cisco for mongodb.
Similarities:
-
belongs to the nosql family
-
they are not acid compliant
-
they are open source
-
they both are class-platform solutions
-
support a variety of windows and linux
-
support mac os platforms
Key differences:
cassandra:
-
cassandra the data model is structured similar to table with rows and columns
-
clustering cassandra there's no configuration server.
-
high availability strategy - multiple masternodes in a cluster provide 100% availability even if the leading node goes down.
-
write speed - multiple masternodes accept writes in parallel each so you can increase the write capacity.
-
Query Language - the query language with syntax is very similar to sql
mongodb:
-
mongodb the data model is unstructured
-
clustering mongodb - mongodb Mongo master, mango shard and mongo servers participate in data replication under the managment mongo daemon server
-
high availability strategy - it has a master slave model, it takes 10 to 50 seconds from a slave node to take the master's role.
-
write speed - the write capacity is limited since data rights go to a single maternode
-
query language - a query interface based on json formatting.
Significance of cassandra & mongodb:
-
Data model - if you require rich data model then Mongodb is better choice.
-
Index querying - if most of the querying in your application occurs by the primary key then Cassandra is better choice. if secondary and flexible querying by them is a primary requirement for you then choose mongodb.
-
Availability - if you need 100% uptime guaranteed then cassandra is best choice due to its multiple mastermode model.
-
write speed - if you need to write huge amounts of data then choose cassandra
-
language support - cassandra is a better fit if your team already has sql skills.
-
data aggregation - mongodb has a built in data aggregation framework.
-
workload - cassandra prevails in handling right-heavy workloads in the case of read heavy loads.