About an index merge policy

An index merge policy determines how frequently the Dgraph merges incremental update generations in its index files.

The data layer stores the Dgraph index files as a series of internal files with versions. As a result:

A version of the index is stored as a sequence of generation files. A new version appends a new generation file to the sequence. Query latency depends, in part, on the number and size of generation files used to store the index files.

Generation files are combined through a process called merging. Merging is a background task that does not affect the Dgraph request processing, but may affect its performance. Because of this, you can set a merge policy that dictates the aggressiveness of the merges.

The merge policy has two settings:

In addition to setting the merge policy, you can also force a one-time index merge, without changing the overall policy that will be used in all other instances. See Manually forcing a merge.

You can configure the index merge policy (or force a merge) using one of these two mechanisms: In a clustered environment, a request to set the merge policy is automatically routed to the leader Dgraph node.

Merging is not affected by the Dgraph's memory limit.