Saturday, July 29, 2017

Graph Database vs. Relational Database?

graphdbGraph Databases are one of the type of NOSQL Databases with CRUD methods that expose a graph model. Graph databases are generally built for use with transactional (OLTP) systems. Graph Databases provide a novel and powerful data modeling technique that makes the data models flexible. They are not a complete replacement for relational models instead they can be used where immediate and significant practical benefit can be achieved.

Graph Databases are schema free and they lack schema oriented Governance mechanisms. When designing Graph Databases, the focus has to be on modeling the structure of the data and their interconnectivity on how different data connect to each other. Graph based data model can become very complex really quickly.

Examples of list of Graph Databases

  • SQL Server 2017
  • Neo4j
  • FlockDB
  • Pregel
  • InfoGrid
  • HyperGraphDB
  • SAP HANA

The key terminologies in a graph database are:

  • Nodes - These are basically Entities
  • Properties - Information about the node or information about the relationship
  • Edges - Relationships between Nodes

A simple example is an Employee Node. An Employee can have a relationship with their Manager, an employee can have relationship with colleagues and relationship with their own subordinates or relationship with employees in other departments. Nodes can have as many relationships as required to describe the data. Relationships can be Unidirectional or Bidirectional and there is no limit on the relationships per node.

When to use a Graph Database vs. Relational Database?graphdb2

a) When multiple relationships need to be described e.g. Social relationships, Networks, Error logging, Sensor data, Logistics data. These are examples where the relationships don't truly exist but needs to be described to understand the data.
b) Using for non-analytical data e.g. Authorisation, User preferences, Non frequent changing variables if stored in a database table.

If you have high performance requirements especially using SQL Server 2017 you need to use functions to parse JSON data and it will be a row by row execution but indexes can be used to improve performance a bit but still recommend to use relational in those scenarios. If you have Validation and Integrity requirements and if you need them in the backend, then relational is the best choice.

SQL Graph Architecture

Technorati Tags: ,

No comments:

Post a Comment