Skip to content

Instantly share code, notes, and snippets.

View peter-hartmann-emrsn's full-sized avatar

peter-hartmann-emrsn

View GitHub Profile

Modeling timeseries data in Dgraph with timestamp on value object

Problem is, you will likely want to query by TimeStamp and need to index the TimeStamp in your schema. However when sending tons of mutations adding new values with high frequency the index keeps rebuilding and all attempts querying the timeseries data will either timeout or fail saying something like “try again later”. Recording a few values per minute should work fine, but for anything more aggressive run more tests before building a whole product relying on it. This approach puts timestamps on the node. An alternative approach is to put the timestamps on a facet, see below.

Schema

Name: string @index(fulltext, term, trigram) .
Value: uid @reverse .