Getting Started Dgraph: An Introduction

Reading Time: 3 minutes

In our today’s blog, we will discuss the Dgraph. Dgraph is a Graph Database which gives us relief to use the traditional database. In the traditional database, we face the problem whenever we have to create them to handle the interconnected data. In our today’s scenario, there are lots of data present and those are interconnected in some way. So if we use the traditional database then we will face a lot’s of issues to fetch the data and it will slow down the application.

Dgraph is an open source graph database built for web-scale production environments are written entirely in Go.

Dgraph helps to handle the more interconnected data in the more effective way. Dgraph v0.8 and above uses Badger, a persistent key-value store written in pure Go. Dgraph built to be horizontally scalable while keeping operations efficient to support running arbitrarily complex queries in real time. So that we can perform distributed joins, filters, and sorts efficiently which is a hard problem.

The key feature of Dgraph

  1. Shard Rebalancing: Dgraph balances the data across the shards automatically and manage the maximum resource management for the high performance.
  2. Highly Available: Dgraph synchronized data automatically on the replication, so losing a hard disk or a server doesn’t affect the services.
  3. User Interface: Dgraph provides the user interface on the top of the JSON to manage the data easily. We can easily validate data and see data into the Graph formation.
  4. Transactional: Dgraph provides the distributed ACID property so that we can perform the transactional operations without worrying about any other things.
  5. Flexible Schema: Dgraph does not work on the hard schema. It works on the top of the flexible schema so the user can get the better experience. We can change the schema as our project evolves.
  6. Distributed: Dgraph works on the distributed environment. It can be increased on hundreds of servers.
  7. Fast: Dgraph works like a search engine. It divides the query into sub-query and then executes it on the concurrently to achieve low-latency and high throughput.
  8. Designed for SSD: Dgraph internal store data into the key-value store, Badger is designed to reduce RAM usage and rely on SSD for performance. That’s fast and cheap.

These are the main key feature of the Dgraph which help to achieve the goals and make easy to build the applications in the better way.

Dgraph Cluster

Dgraph cluster is consist of three different nodes where each node works as different from others. These are the three nodes:

  1. Dgraph Zero: This node controls the Dgraph cluster and assigns the servers to re-balancing and group data between server groups.
  2. Dgraph Server: This node hosts the predicates and indexes of the data.
  3. Dgraph Ratel: This node provides the UI for runs the queries, mutations and alters the schema.

Please find the way to install Dgraph here: Installation of Dgraph.

Dgraph works with the GraphQL+- query language.

Benefits of the GraphQL+-

  • GraphQL+- is used as the primary language of communication.
  • GraphQL+- is a feature-rich variation of GraphQL.
  • GraphQL+-  is added support for graph operations.
  • GraphQL+- is removed features not fitting well for a graph database.

Why GraphQL +-

  • Graph-like query syntax
  • Schema validation
  • Subgraph shaped response

Graph Database does not work only with the social media it also works with:

  • Interconnected data, like SQL tables requiring joins
  • Advanced search
  • Pattern detection
  • Networks, like computers, roads, and telecommunications
  • Processes, like the business and biological processes
  • Events and the causality or other links between them
  • Structures of firms or markets
  • Recommendation engines

So in the current blog, we have discussed the need of the graph database, key features of the Dgraph, areas where we can use Graph Database along with that how can we install the Dgraph in our local environment. In the coming blog, we will discuss that how can we create the schema, operations, and queries on the Dgraph?

Till then stay tuned 🙂

Thanks 🙂



Written by 

Anurag is the Sr. Software Consultant @ Knoldus Software LLP. In his 3 years of experience, he has become the developer with proven experience in architecting and developing web applications.