Binary “fields” – index, lookup, etc

Hi!

We have ID field in our data which is a concatenation of two uuids – it is cheaper to store than a respective concatenation of two uuid strings: 32 vs 74 bytes.

Am I understand it right there is no index type for such kind of data? And is there any way to request for exact binary ID of such kind?

All scalar types can have indices. Dgraph supports exact and hash indices for strings. There’s also int indices for integer values. https://docs.dgraph.io/query-language/#indexing

So, no way to lookup and index. This is a shame I must say: as I said we only need to store 32 bytes in binary format vs 74 bytes in case of uuid strings.

There’s a binary type in Dgraph (there’s missing documentation for this but there’s a PR to add it). There’s also custom tokenizers. So I think you could store your data in a binary format and write a custom tokenizer to output the two separate IDs.

Link to PR: docs: Add Binary Type by MichelDiz · Pull Request #3307 · dgraph-io/dgraph · GitHub
Custom tokenizers: https://docs.dgraph.io/query-language/#indexing-with-custom-tokenizers