Graph Database – SQL Server 2017

Today, I got an opportunity to write Graphs Database. This is in continuation of my previous article on Database Modeling.

What is Graph Database?

We are not going to discuss about simple graph here as shown below.


Fig 0.1 Simple Graph

We will discuss about heavy, complex and infinite dimensional graphs as shown below.


Fig 0.2 Huge and Complex Graph

Each kind of schema design has its own importance. Every schema is made to serve its purpose. Some are designed for Transactional Data, some are for Analytical, some are for Big Data and some are for Relational. What if the data is Big and Critical?. “Big data” grows bigger every year, but today’s enterprise leaders not only need to manage larger volumes of data, but they critically need to generate insight from their existing data.

To leverage those big data and their complex relationships, we need a database technology that stores relationship information as a first-class entity. This technology is a graph database.

Graph Database modeling?

Irrespective of RDBMS which has child and parent as entity, Graph databases contains a collection of nodes and edges. Nodes represent a given entity (a noun), while edges (a verb) represent the relationship between the two nodes they connect.


Fig 0.3 RDBMS Model

Here in RDBMS model you will see Person as Child and Entity as Parents. And for relation, Cross reference entities is created i.e. Project Members between Project and Members.

RDBMS is usually used for structured data, with moderate complexity and having nested transactions.

Graph databases support a highly flexible and fine-grained data model. Graphs are extremely useful in understanding a wide diversity of datasets such as below.


Fig 0.4 Graph Data Flow Diagram

Formally, a graph is just a collection of vertices and edges or in simple words, a set of nodes and the relationships that connect them.Edge table names are verbs and Node names are Noun.

Let’s compare design of RDBMS and Graph Database first and then we will compare other aspects.


Fig 0.5 RDBMS Design and Data Storage


Fig 0.6 Graph Design and Data Storage

As said earlier every database is designed to serve some of other purpose. These features of graphs database to Store huge amount of relationship, expressive structure and also flexible in adding new kinds of relationships or adapting a data model to new business requirements allows us to model all kinds of scenarios.

RDBMS Vs Graph

Complex Transaction Simple Transaction
Moderate complex joins Heavy extreme joins
100s of relationships Billons of relationships
Fixed Schema Variable Schema
High Availability Continuous availability
Centralized Data and Logic Distributed Data and Logic
Structured Data Semi and Unstructured data
Tabular format Graphical format
Heavy Validation Less Validation required
Use for Transactional Data Use for Real world data

Where we can use graph DB?

E.g. Fraud Detection
Banks and insurance companies lose billions of dollars every year to fraud. Traditional methods of fraud detection fail to minimize these losses since they perform discrete analyses that are susceptible to false positives and negatives. Knowing this, increasingly sophisticated fraudsters develop a variety of ways to exploit the weaknesses of discrete analysis.

Who uses Graph DB?
Panama papers, Linkedin, Twitter, Facebook, Amazon Etc.

Graph features introduced in SQL Server 2017 (14.x)


Fig 0.7 SQL Server 2017

Thanks for Reading 🙂

Keep reading, share your thoughts, experiences. Feel free to contact us to discuss more. If you have any suggestion / feedback / doubt, you are most welcome.

Stay tuned on Knowledge-Junction, will come up with more such articles.




Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.