<subject> <predicate> <object>
. In this view, a posting list is a list of all
triples that share a <subject>+<predicate>
pair.
(Note that in Dgraph docs, we typically use the term “relationship” rather than
predicate, but here we will refer to predicates explicitly.)
The posting lists are grouped by predicate into tablets
. A tablet therefore
has all data for a predicate, for all subject UIDs.
Tablets are the basis for data shards in Dgraph. In the near future, Dgraph may
split a single tablet into two shards, but currently every data shard is a
single predicate. Every server then hosts and stores a set of tablets. Dgraph
will move or allocate different tablets to different servers to achieve balance
across a sharded cluster.
Node | Attribute | Value |
---|---|---|
person1 | friend | person2 |
person1 | friend | person4 |
Node | Attribute | Value |
---|---|---|
person2 | friend | person1 |
Node | Attribute | Value |
---|---|---|
person3 | friend | person2 |
person3 | friend | person4 |
Node | Attribute | Value |
---|---|---|
person4 | friend | person2 |
person4 | friend | person1 |
person4 | friend | person3 |
Node | Attribute | Value |
---|---|---|
person1 | name | ”James” |
person1 | name | ”Jimmy” |
person1 | name | ”Jim” |
Node | Attribute | Value |
---|---|---|
person2 | name | ”Rajiv” |
Node | Attribute | Value |
---|---|---|
person3 | name | ”Rachel” |
friend
predicate will hold all posting lists for all
“friend” relationships in the entire graph. The tablet for the name
property
will hold all posting lists for name
in the graph.
If other types such as Pets or Cities also have a name property, their data will
be in the same tablet as the Person names.
tablet
on one server/shard. This means, one RPC
to the machine serving that tablet
will be adequate, as documented in
How Dgraph Minmizes Network Calls.
Posting lists are the unit of data access and caching in Dgraph. The underlying
key-value store stores and retrieves posting lists as a unit. Queries that
access larger posting lists will use more cache and may incur more disk access
for un-cached posting lists.