Get started with Dgraph
The ultimate guide to graph databases | Dgraph
- Dgraph is the native Graph database with native GraphQL support.
- It is open-source, scalable, distributed, highly available, and fast.
- It is different from other graph databases:
- Distributed Scale
- GraphQL Support
- GraphQL is built-in to make data access simple and standards-compliant.
- Unlike most GraphQL solutions, no resolvers are needed - DGraph resolves queries automatically through graph navigation.
- Fully Transactional and ACID Compliant
- It satisfies demanding OLTP workloads that require frequent inserts and updates.
- Language support & Text Search
- Full-text searching is included, and strings can be expressed in multiple languages.
- Geo data and geo queries
- It supports points and shapes data.
- Queries can use near, within, contains, or intersects geo functions.
- In Dgraph, GraphQL is not an afterthought or an add-on; it is core to the product.
- GraphQL developers can get started in minutes and need not concern themselves with the robust graph database running in the background.
- The difference with Dgraph is that no resolvers or custom queries are needed.
- Simply update a GraphQL schema, and all APIs are ready to go.
- The “resolvers” are transparently implemented by simply following graph relationships from node to node and node to field and with native graph performance.
- For complex queries that the GraphQL specification does not support, Dgraph provides a query language called “DQL” which is inspired by GraphQL, but includes more features.
- With GraphQL, simple use cases remain simple, and with DQL, more complex cases become possible.
The Graph Model - Nodes, Relationships, and Values
- Dgraph is fundamentally a property-graph database because it stores nodes, relations among those nodes, and associated properties for any relation.
- Dgraph supports JSON data as both a return structure and an insert/update format.
- In Dgraph JSON nesting represents relations among nodes, so
{ "name":"Bob", "homeAddress": { "Street":"123 Main st" } }
efficiently and intuitively represents a Person node, an Address node, and a relation (called “homeAddress”) between them.
- Dgraph supports RDF triples as an input and output format.
- Dgraph relationships are directed links between nodes, allowing optimized traversal from node to node.
- Dgraph allows a bidirectional relation via directed relationships in both directions if desired.
Dgraph Cloud Cluster Types
- Shared Instance
- Dgraph Cloud with shared instances is a fully-managed graph database service that lets you focus on building apps, not managing infrastructure.
- This is a fast and easy way to start with GraphQL and does not require any graph database knowledge to start and run.
- Shared instances run in a common database using Dgraph multi-tenancy.
- Your data is protected, but you share resources and will have limited scale.
- Dedicated instances
- Run on their dedicated hardware to ensure consistent performance.
- This option extends the capabilities of the lower-cost shared instances to support enterprise and production workloads and includes a high availability option.
Dgraph Architecture
- Dgraph scales to more extensive data sizes than other graph databases because it is designed from the ground up to be distributed.
- Therefore, Dgraph runs as a cluster of server nodes communicating to form a single logical data store.
- Two main types of processes (nodes) are running: Zeros and Alphas.
- Dgraph Zero server nodes hold metadata for the Dgraph cluster, coordinate distributed transactions, and re-balance data among server groups.
- Dgraph Alpha server nodes store the graph data and indices.
- Unlike non-distributed graph databases, Dgraph alphas store and index predicates, representing the data elements' relations.
- This unique indexing approach allows Dgraph to perform a database query with depth N in only N network hops, making it faster and more scalable for distributed (sharded) data sets.