I study database internals as a hobby. I am curious how dgraph works internally. I hope you can answer my questions regarding data storage. I’ve had a quick whiz through the code but couldn’t find what I was looking for, maybe you could point me in the right direction.
I am curious how dgraph takes a graph and turns it into keyvalues for badger.
How are edges stored in a keyvalue storage?
I am guessing range queries are used to iterate over an outgoing edge.
Do you store the relationship data using uids?
Maybe store a key saying from_uuid with value to_uuid. Then if I add an index, I store the reverse connection: reverse_uuid parent_uuid
I have written a very simple graph database that uses matrix multiplication to do breadth first search. You can find it here GitHub - samsquire/hash-db: distributed keyvalue database imitating dynamodb querying with SQL support, distributed joins and Cypher graph support It’s inspired by graphblas and redis-graph
I am interested in dgraph internals because I might want to simulate the same keyvalue storage mechanism in my noddy database which isn’t for serious use, it’s just a hobby.