Redis is an Open Source NoSQL database. It is very popular, capable and remarkably fast In-Memory database. It stores the data in key-value pair and no doubtfully says it is a NoSQL database.
Redis doesn’t have a query language like relational databases. It doesn’t support an Indexing. But, we can do our own indexing to store the additional data.
Redis also supports persistent storage optionally, that stores the data into the disk. Also, it works as a Master-Slave Replication. Master database syncs with Slave database. If the Master fails, the slave takes control.
where to use redis?
- It is used to store the Stateless tokens (JWT) and invalidates the user sessions for blacklisted/expired tokens.
- It is used to cache the search results.
- It is used to send the notifications with the support of Publisher and Subscriber mechanism.
what is sql?
SQL is a Structured Query Language and used for structured databases with Predefined schema. Data stored in the tables and a table consists of columns. Few SQL databases are given below.
- Microsoft SQL Server
What is nosql?
NoSQL don’t have structured language and it supports dynamic schema. Few NoSQL databases are given below
- Redis and Dynomo databases are supports Key Pair value storage.
- MongoDB and CouchDB databases are supports to store Documents by using collections.
- Cassandra and HBase databases are used to store the huge data sets with wide column.
- Neo4J and Infinite Graph databases are used to store locations, geometries and topological information.
SQL vs NoSQL
- SQL stores the data into tables and NoSQL stores the data into Key Pair, Document, columnar and Graph.
- SQL uses structure Query language and NoSQL uses unstructured query language.
- SQL uses vertical scaling (enabling the scalability by using same server hardware) and No SQL uses horizontal scaling (by adding additional servers)
- SQL supports ACID properties. NoSQL doesn’t support ACID properties.
- ACID Properties
- In order to ensure accuracy, completeness, and data integrity.
- SQL databases are doesn’t compromise the ACID properties. But NoSQL compromises.
When to use SQL
- Data have stable and defined structure.
- ACID compliance.
- Insanely store and retrieval.
When to use NoSQL
- Storing a big amount of data with no defined structure.
- Cloud storage and hosting – horizontal scaling and cost effective.
- Quick software development and Prototype.