Redis Datatypes and Commands-Hash

Redis Datatypes and Commands – Hash

Redis stores the data as key value pair. Keys can be any binary value and it is represented as ASCII strings for easily understandable and readability purpose. Redis supports five different datatypes and anyone of the datatype can be represented as value.

datatypes

Redis supports five different datatypes and they are given below. Each datatype can be used in Redis with different set of commands.

  • String
  • List
  • Set
  • Sorted Set
  • Hash

Hash

Hashes in Redis, data are mapped into the fields. It maps between String fields and String values.

hset

The HSET is a command used to store the data maps between the fields and values. Use the below command to store the data by using HSET command.

Syntax
hset <keyname> <field> <value>

Example
hset players name John
HSET command

hget

The HGET is a command used to get the data that maps into the field by using an key name. Use the below command to fetch the values that maps into the field.

Syntax
hget <keyname> <field>

Example
hget players name
HGET command

hmset

The HMSET command is used to store multiple field and value data. Use the below command to store multiple hash data into the Redis.

Syntax
hmset <keyname> <field1> <value1> <field2> <value2>...N

Example
hmset players name John score 100 grade A
HMSET command

hmget

The HMGET command is used to fetch multiple values associated with the fields. Use the below command to fetch the values from the fields.

Syntax
hmget <keyname> field1 field2.. fieldN

Example
hmget players name score grade gender
HMGET Command

We don’t have gender field, so console will return NIL value for that field.

hgetall

The HGETALL command is used to get all the fields and values by using a key name. Use the below command to fetch all fields and values.

Syntax
hgetall <keyname>

Example
hgetall players
HGETALL command

hexists

The HEXISTS command is used to find out the field is exists or not by using the key name. Use the below command to find the field exists by using key.

Syntax
hexists <keyname> <field>

Example
hexists players name
HEXISTS command

hkeys

The HKEYS command is used to fetch all the fields in a key. Use the below command to get all the fields in a key.

Syntax
hkeys <keyname>

Example
hkeys players
HKEYS command

hvals

The HVALS command is used to get all the values in a key. Use the below command to fetch all the values.

Syntax
hvals <keyname>

Example
hvals players
HVALS command

hdel

The HDEL command is used to delete one or more fields in a hash by using a key name. Use the below command to remove the fields.

Syntax
hdel <keyname> <field1> <field2>...N

Example
hdel players name grade
HDEL command

After removed the fields, execute the below command to view the remaining fields in hash.

hkeys players
HKEY command

hlen

The HLEN is a command used to return the number of fields in hash. Use the below command to fetch the number of fields in hash.

Syntax
hlen <keyname>

Example
hlen players
HLEN command

We have learned and executed the Hash datatype in Redis.

Advertisements

Redis Datatypes and Commands-Sorted Set

Redis Datatypes and Commands – Sorted Set

Redis stores the data as key value pair. Keys can be any binary value and it is represented as ASCII strings for easily understandable and readability purpose. Redis supports five different datatypes and anyone of the datatype can be represented as value.

datatypes

Redis supports five different datatypes and they are given below. Each datatype can be used in Redis with different set of commands.

  • String
  • List
  • Set
  • Sorted Set
  • Hash

Sorted set

The Sorted Set datatype is used to maintain the order of the elements in ascending order.

zadd

The ZADD command is used to add the data into the key set. Use the below command to add the data into the key set.

Syntax
zadd <keyname> <score1> <member1> <score2> <member2> ... N

Example
zadd players 20 John 30 Amar 10 Mike
ZADD command

zrange

The ZRANGE command is used to view all the elements from the ordered key set. Use the below command to view all the elements from the key set.

Syntax
zrange <keyname> start stop

Example
zrange players 0 -1
ZRANGE command

The Start and Stop represents the index of the elements. The 0 to -1 represents to view all the elements from the set.

Execute the below command, to view all the elements from the set with “WITHSCORES” option.

Syntax
zrange <keyname> start stop withscores

Example
zrange players 0 -1 withscores
Zrange with scores

zcard

The ZCARD command is used to return the number of elements from the ordered key set. Use the below command to view the number of elements from the set.

Syntax
zcard <keyname>

Example
zcard players
ZCARD command

zcount

The ZCOUNT command is used to return the count of elements from the ordered key set. Use the below command to view the count of elements from the key set.

Syntax
zcount <keyname> -inf +inf

Example
zcount players -inf +inf
ZCOUNT command

zrank

The ZRANK command is used to find out the index of the element in the ordered key set. Use the below command to get the index of the element.

Syntax
zrank <keyname> member

Example
zrank players Amar
ZRANK command

zscore

The ZSCORE command is used to return the score of the member from the ordered key set. Use the below command to return the score of the member.

Syntax
zscore <keyname> member

Example
zscore players Amar
ZSCORE command

zrem

The ZREM command is used to remove the elements from the ordered set. Use the below command to remove the elements from the set.

Syntax
zrem <keyname> member

Example
zrem players Amar
ZREM command

Execute the below command to get the all the elements from the ordered set after remove the member from the key set.

zrange players 0 -1
ZRANGE command

We have learned and executed the Redis Sorted Set datatype commands.

Redis Datatypes and Commands-Set

Redis Datatypes and Commands – Set

Redis stores the data as key value pair. Keys can be any binary value and it is represented as ASCII strings for easily understandable and readability purpose. Redis supports five different datatypes and anyone of the datatype can be represented as value.

datatypes

Redis supports five different datatypes and they are given below. Each datatype can be used in Redis with different set of commands.

  • String
  • List
  • Set
  • Sorted Set
  • Hash

set

Set is a one of the Redis Datatype and it is a collection of unique strings stored in an unordered list. Set doesn’t allow duplicate data in a key.

sadd

The SADD command is used to store the data into the set by using a key. Use the below command to add the data into the set.

Syntax
sadd <keyname> <member1> <member2> <member3>...N

Example
sadd notes note1 note2 note3
SADD command

smembers

The SMEMBERS command is used to get the data from the set by using a key. Use the below command to get the data from the set.

Syntax
smembers <keyname>

Example
smembers notes
SMEMBERS command

scard

The SCARD command is used to get the number of elements count from the set by using a key. Use the below command to get the number of elements count from the set.

Syntax
scard <keyname>

Example
scard notes
SCARD command

sdiff

The SDIFF command is used to find out the difference between two key sets.

Let us add the new key set and will execute the SDIFF command.

 sadd new_notes note3 note4 note5 
SADD command

Use the below command to find out the difference between two key sets.

Syntax
sdiff <keyname1> <keyname2>

Example
sdiff notes new_notes
SDIFF command

Try out to find the difference between two key set in another way.

sdiff notes new_notes notes
SDIFF command

sunion

The SUNION command is used to return all unique data between two key sets. Use the below command to return all unique data between two key sets.

Syntax
sunion <keyname1> <keyname2>

Example
sunion notes new_notes
SUNION command

sinter

The SINTER command is used to return the common data between two key sets. Use the below command to return the common data between the two keys.

Syntax
sinter <keyname1> <keyname2>

Example
sinter notes new_notes
SINTER command

spop

The SPOP command is used to remove the random data from the set. Use the below command to remove the random data from the key set.

Syntax
spop <keyname>

Example
spop notes
SPOP command

srem

The SREM command is used to remove the one or multiple data from the key set. Use the below command to remove the data from the key set.

Syntax
srem <keyname> <member1> <member2>..N

Example
srem new_notes note4 note5
SREM command

After remove the data from the key set, and execute the below command to see the remaining elements from the key set.

smembers notes
SMEMBERS command

We have learned and executed the Redis Set datatype and it’s commands.

Redis Datatypes and Commands-List

Redis Datatypes and Commands – List

Redis stores the data as key value pair. Keys can be any binary value and it is represented as ASCII strings for easily understandable and readability purpose. Redis supports five different datatypes and anyone of the datatype can be represented as value.

datatypes

Redis supports five different datatypes and they are given below. Each datatype can be used in Redis with different set of commands.

  • String
  • List
  • Set
  • Sorted Set
  • Hash

List

List is a one of the datatype in Redis. List contains the list of String and sorted by insertion order. The List commands are given below.

  • Pushing the element
  • Pop up the element
  • Finding the element by using Index
  • Finding the length of the List
  • Deleting the element

lpush

The LPUSH is a command used to push the elements into the on left side. The LPUSH command is used to prepend the values on the list. Execute the below commands to push the elements into the list by using LPUSH command.

Syntax
lpush <keyname> <value1> <value2> ...N

Example
lpush redis data1 data2 data3
lpush command

lrange

The LRANGE command is used to fetch the elements from the list by using start and stop index. Execute the below command to fetch the elements from the list.

Syntax
lrange <keyname> start stop

Example
lrange redis 0 1
lrange redis 0 2
lrange command

rpush

The RPUSH command is used to push the elements into the list on right side. The RPUSH command is used to append the elements into the list. Execute the below commands to push the elements into the list by using RPUSH command.

Syntax
rpush <keyname> <value1> <value2> .. N

Example
rpush redis data4
rpush command

Execute the below command to fetch the elements from the list and to see how the RPUSH command inserts the data into the list.

lrange redis 0 3
lrange command

llen

The LLEN command is used to find the length of the list. Execute the below command to find out the length of the list.

Syntax
llen <keyname>

Example
llen redis
llen command

LSET

The LSET command is used to set the value of the element based on the index. Use the below command to set the value of the element by using index.

Syntax
lset <keyname> <index> <value>

Example
lset redis 2 datavalue2
lset command

Execute the below command to fetch the elements from the list and to see how the LSET command inserts the data into the list.

lrange redis 0 3
lrange command

LPOP

The LPOP command is used to remove the first element in the list. Use the below command to remove the first element from the list.

Syntax
lpop <keyname>

Example
lpop redis
lpop command

Execute the below command to fetch the elements from the list and to see how the LPOP command removes the data into the list.

lrange redis 0 3
lrange command

rpop

The RPOP command is used to remove the last element in the list. Use the below command to remove the last element in the list.

Syntax
rpop <keyname>

Example
rpop redis
rpop command

Execute the below command to fetch the elements from the list and to see how the RPOP command removes the data into the list.

lrange redis 0 3
lrange command

LTRIM

The LTRIM is a command used to trim elements by specified index. Execute the below commands to trim the data from the left.

lpush numbers 1 2 3 4
lrange numbers 0 3

Syntax
ltrim <keyname> start stop

Example
ltrim numbers 1 2
ltrim command

Execute the below command to fetch the elements from the list and to see how the LTRIM command removes the data into the list.

lrange redis 0 3
lrange command

del

The DEL command is used to delete all the elements from the list. Execute the below command to delete all the elements from the list.

Syntax
del <keyname>

Example
del numbers
del command

Execute the below command to fetch the elements from the list and to see how the DEL command deletes all the elements from the list.

lrange redis 0 3
lrnage command

Redis List datatype and commands are learned and executed.

Redis Datatypes and Commands-String

Redis Datatypes and Commands – String

Redis stores the data as key value pair. Keys can be any binary value and it is represented as ASCII strings for easily understandable and readability purpose. Redis supports five different datatypes and anyone of the datatype can be represented as value.

datatypes

Redis supports five different datatypes and they are given below. Each datatype can be used in Redis with different set of commands.

  • String
  • List
  • Set
  • Sorted Set
  • Hash

string

String is a datatype used in Redis to store the Key value pair. The value can be represented as String. String is a sequence of characters and binary safe in Redis.

set and get

The Set command is used to create a new key value pair data in Redis. Execute the below command on the Redis client to create a new value pair data.

Syntax
set <keyname> <value>

Example
set employee John

The Get command is used to fetch the value by using key name. Execute the below command on the Redis client to fetch the value by using key name.

Syntax
get <keyname>

Example
get employee

If you want to set the new value for existing key, then you can use the same Set command. The Set command doesn’t append the new value with existing one. It overrides the existing value with new one.

Example
set employee Mike
set and get commands

If you want to set the values for the key like employee First Name and Last Name, then use the below command on the Redis client. The value must be provided within double quotes.

Syntax
set <keyname> "<value>"

Example
set employee "John Mike"
The value provided within double quotes

naming a key

If you want to store the more than one employee details with unique ID, then use the key name like below.

Syntax
set <keyname>:<uniqueID> value

Example
set employee:1 John
set employee:2 Mike
set employee:3 Lawrence
Redis keys with unique Id

Execute the below command on the Redis client to fetch all available keys.

keys *
to view all keys

Setting up new key value pair data once again to see the new key on the list of available keys.

set student "James"
get student
setting up new key value pair

Now, execute the below command once again to view the list of available keys.

keys *
To view list of available keys

Use the below command, to fetch the list of available keys starts with sequence of characters.

Syntax
keys <pattern>

Example
keys emp*
keys starts with

time to live

Use the below command to set the expire time for the key. The expire time must be provided by using seconds or milliseconds.

Syntax
set <keyname> <value> ex <no:of:seconds>

Example
set employee:4 Kite ex 30

Use the below command to view the remaining time of the key after set the expire time. The command name is “Time To Live”. The negative value on the TTL represented key has expired. The NIL value will return, while fetching the value by using key after expired.

Syntax
ttl <keyname>

Example
ttl employee:4
TTL command

key not exists – nx

Use the below command to set key value pair data, if the key is not exists on the Redis database.

Syntax
set <keyname> <value> NX

Example
set employee:4 Fidel NX
Key Not exists

key exists – xx

Use the below command to set the key value pair data, if the key is already exists on the Redis database. If the Key is already not exists, then the Redis client will return “NIL”.

Syntax
set <keyname> <value> XX

Example
set employee:4 Nathan XX
set employee:5 Nathan XX
Key already exists

exists

Use the below command to check the key is already exists or not on the Redis database.

Syntax
exists <keyname>

Example
exists employee:4
exists employee:5

append

Execute the below command to append the value for existing key value pair data.

Syntax
append <keyname> <newvalue>

Example
set employee:5 Vikram
get employee:5
append employee:5 " Karthik"
get employee:5
Append command

string length

To find the length of the value by using key, execute the below command. The return value will be Integer.

Syntax
strlen <keyname>

Example
strlen employee:5
String length

incr and decr

Use the below command to Increment and Decrements the Integer value by using key. By default Increment increase the value by 1 and Decrements decreases the value by 1.

Syntax - Increment
incr <keyname>
incrby <keyname> <incrementvalue>

Syntax - Decrement
decr <keyname>
decrby <keyname> <decrementvalue>

Example
set testkey 1 
incr testkey  
incrby testkey 20 
decr testkey 
decrby testkey 10 
get testkey 
Increment and Decrements

mset and mget

Use the below commands, to set and get the multiple key value pair by using single command.

Syntax
mset <keyname1> <value1> <keyname2> <value2>
mget <keyname1> 
mget <keyname1> <keyname2>

Example
mset firstkey firstvalue secondkey secondvalue
mget firstkey
mget firstkey secondkey
mset and mget commands

We have learned the basic Redis String commands.

Free Cloud Hosted Redis Service

Free Cloud Hosted Redis Service

Redis Labs is a free Cloud Hosting service that provides a Redis storage hosted in different cloud platforms such as Amazon Web Service (AWS), Google Cloud Platform (GCP) and Microsoft Azure.

In this Blog, we are going to learn How to create a new account in Redis Labs, an new Subscription and an new database by using free cloud hosted service.

create a new account

To get started free, go to the Redis Labs home page, provide your Email ID and click the “GET STARTED FREE” button to create a new account in Redis Labs.

Get started

After clicked the “Get Started Free” button, you will receive an account activation email to your mail.

Account Activation email

Click the “Activate Now” button to activate an account in Redis Labs. After clicked the “Activate Now” button, request will redirect you the “Finish setting up your account” page. Provide all the details such as First Name, Last Name, Business, Country and Password click “Continue” button on this page.

Finish setting up your account

After clicked the “Continue” button, Create a new Subscription on the Redis Labs.

Create Subscription

Click the “Create your subscription” button, choose a Free 30MB plan on the Select your Plan screen.

Free 30 MB Plan

After selected the Free 30 MB plan, create a new subscription by selecting the Cloud, providing a Subscription name and choosing the Free plan 30 MB on the create subscription page.

New Subscription page

Click the “Continue” button on the New Subscription page, and create a new database by providing a Database name, and selecting the Protocol Redis on the Create database screen. Click the “Activate” button to create a new database. Since we are selected a Free plan, so data replication has been disabled and there is no Data Persistence.

Create Database

After clicked the “Activate” button, Database will be created and on the configuration page, you can find out the “Endpoint URL” to connect the database from anywhere in the world by using Redis client.

View Database – Configuration

Copy the Endpoint URL and Redis Password to connect the Redis Database by using Redis client. Use the below command syntax to connect the remote Redis database by using Redis client.

redis-cli -h <hostname> -p <portnumber>

In my case, I have connected the Redis database by using below command.

redis-cli -h redis-18772.c74.us-east-1-4.ec2.cloud.redislabs.com -p 18772
Connect Redis

After connected the remote Redis, provide the password to connect the database. Use the below command to provide the password (Copy it from the Redis Database Configuration page).

auth <password>
set authentication

Execute below Redis commands to create and get the key pair data by using Redis client.

set employee John

get employee
Redis commands

We have successfully created Free Cloud Hosted Redis and connected the Remote Redis by using the Redis client.

How to Install Redis on Linux Debian 9?

How to Install Redis on Linux Debian 9?

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.

Installing Redis on Linux Debian 9, is very simple and follow the steps given below one by one to install the Redis on Linux Debian 9.

update all existing packages

Before Installing Redis, update all existing packages on the Linux Debian 9 by executing the below command.

sudo apt update
sudo apt-get update

install redis server

Install Redis Server by executing the below command on the Linux Debian 9.

sudo apt-get install redis-server

Redis will start installing on the Linux Debian 9 automatically and also starts the Redis service.

configure systemd process

There is an important configuration needs to be update after installing the Redis server. Open the Redis configuration file by using below command.

sudo vi /etc/redis/redis.conf

Find the word “supervised” and change the default value from “no” to “systemd” to manage and monitor the Redis service.

supervised process of Redis service

allow connections from anywhere

By Default, Redis is binding to localhost. Execute the below steps to allow the connections from anywhere to access the Redis. Open the Redis configuration file by using below command.

sudo vi /etc/redis/redis.conf

Find the word bind 127.0.0.1 and make sure it is un-commented out (remove the # if it exists)

binding to localhost

configure redis password

Follow the below steps to configure the Redis password. Open the Redis configuration file by using below command.

sudo vi /etc/redis/redis.conf

Find the word “requirepass” and set the secure password to access the Redis and make sure it is un-commented out (remove the # if it exists)

Require pass for Redis

Then, Restart the Redis service now by executing the below command.

sudo systemctl restart redis 

redis client

Execute the below command on the terminal to connect the Redis server by using Redis client.

redis-cli

The Redis client terminal will open on the same console and we can start execute the Redis commands.

set authentication on the redis client

Since we have secured the password, we should set the Authentication on the Redis client before start executing the Redis commands. Use the below command to set the password on the Redis client to access the Redis server.

auth foobared
Authentication on the Redis client

ping pong command

To check the connection between Redis server and client execute the following command on the Redis client terminal.

PING

If you get the acknowledgement, “PONG” on the console, then the connection between the server and client is stable.

ping and pong with Redis client

Execute the below Redis commands on the Redis client to store the data as Key-Pair value on the Redis server.

set employee John

get employee
set and get Redis key pair data

monitor and manage the redis service

By executing below commands, we can monitor and manage the Redis service on the Linux Debian 9.

To view the current status of the Redis service.

sudo systemctl status redis

To stop the Redis service.

sudo systemctl stop redis

To start the Redis service after it got stopped.

sudo systemctl start redis 

If any Redis configuration got update, we should restart the Redis service. Execute the below command to restart the Redis service.

sudo systemctl restart redis 

By default Redis service will start when the system starts. To disable that execute the below command.

sudo systemctl disable redis

Execute the below commands to enable the Redis service once again after it got disabled.

sudo systemctl enable redis-server.service

How to Install Redis on Windows 10?

How to Install Redis on Windows 10?

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.

installation on windows 10

We can Install Redis on windows 10 by using two ways. They are given below.

  • Zip file
  • MSI Installer

by using zip file

Download the latest and stable release of Redis on Windows 10 Zip file (Redis-x64-3.0.504.zip) from the official GitHub site of Microsoft archive. The Download URL has been given below.

https://github.com/MicrosoftArchive/redis/releases

After download the zip file, extract it on the anyone of the location in your machine. In my system, I have downloaded and extracted on the path “C:\softwares”.

Redis File Path after extract

Now go inside on the folder “Redis-x64-3.0.504” and find the redis-server.exe file.

Redis Server EXE file

Double click the “redis-server.exe” file, then Redis server will start to run on your machine with default port 6379.

Redis server console

It is time to start the Redis Client. You can find “redis-cli.exe” file on the same folder “Redis-x64-3.0.504”.

Redis client EXE file

Double click the “redis-cli.exe” file, then Redis client will start to run on your machine to execute the Redis commands.

Redis client console

Execute the following command on the Redis client console to check the connection between Redis server and client.

PING

The console will display PONG after execute the PING command on the Redis client console.

PING and PONG

Execute the following commands to store and retrieve a new Key Pair data on the Redis server by using Redis client.

set employee John

get employee
set and get command to store the data in Redis server

by using msi installer

Download the latest and stable release of Redis on Windows 10 (Redis-x64-3.0.504.msi) MSI Installer file from the below link.

https://github.com/MicrosoftArchive/redis/releases

I have downloaded the installer file and saved into the “C:\softwares” path on my machine. You can download it into the anyone of the location on your drive.

Redis installer file

After download the installer file, double click on it and start install the Redis on Windows 10 machine.

Welcome screen of Redis Windows setup.

Welcome screen of Redis Windows setup.

Click “Next” button on the welcome screen, Accept the License agreement and click “Next” button on the installation wizard.

License Agreement wizard

Click on the check box “Add the Redis Installation folder to the PATH environment variable” on the Destination folder wizard. And then click “Next” button on this screen.

Destination folder wizard

Click “Next” on the Port number and firewall exception wizard with the default port number. If you want to change port number of Redis server, then you can change it on this wizard.

Port number and Firewall exception

Click “Next” on the Memory Limit wizard. The default Memory limit is 100 MB. If you want to set the Max Memory limit, then you can change it on this wizard.

Memory Limit

Click “Install” button on the Install Redis on Windows wizard.

Redis Installation wizard

Installation is In-Progress.

Installation In-Progress window

Click “Finish” on the Redis Installation completed wizard.

Redis Installation completed wizard

After the installation completed, Redis server will be started automatically on the Windows 10 machine. You can see the Redis server status on the “Services” screen. If the Redis service is not started automatically, you can start it manually here.

Services

Now go to the Redis installation folder and double click the “redis-cli.exe” file. I have installed the Redis on the “C:\Program Files\Redis” path.

Redis installation folder

Then Redis client will start to run on your machine to execute the Redis commands.

Redis client console

Execute the following command on the Redis client console to check the connection between Redis server and client.

PING

The console will display PONG after execute the PING command on the Redis client console.

PING and PONG

Execute the following commands to store and retrieve a new Key Pair data on the Redis server by using Redis client.

set employee John

get employee
set and get command to store the data in Redis server

Redis has been installed successfully on the Windows 10 machine by using ZIP and MSI installer.

What is Redis?

What is Redis?

introduction

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.

  • MySQL
  • Oracle
  • Microsoft SQL Server
  • MariaDB

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

  1. Schema
    • SQL stores the data into tables and NoSQL stores the data into Key Pair, Document, columnar and Graph.
  2. Query
    • SQL uses structure Query language and NoSQL uses unstructured query language.
  3. Scalability
    • SQL uses vertical scaling (enabling the scalability by using same server hardware) and No SQL uses horizontal scaling (by adding additional servers)
  4. Reliability
    • SQL supports ACID properties. NoSQL doesn’t support ACID properties.
  5. 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.