- Foundation DB Notes
- Directories
- Example data
Nomure is built on top of FoundationDB, to understand the way it works, check out the links for more info
node_name
: string
describing the name of the node
node_uid
: global unique non-sequential integer
id
uid
: (node_name, node_uid)
Where A
and B
are nodes/vertex and C
is an Edge
Primitive types of the Node
(uid, property_name) = value
An User datamodel, the primitive properties could be age
, name
, birthday
and their respective value
Secondary property index
(node_name, property_name, value, node_uid) = ''
Give me all nodes of the node name A
with the property name y
and the value z
Relationship properties, reference other nodes
unix_utc_timestamp
is to keep the "insert order" in order to paginate correctly
(uid, edge_name, unix_utc_timestamp, uid) = ''
Give me all the vertex that go from "A"
Indexing edges of the out edges
(uid, edge_name, edge_property_name, value, edge_id) = uid
Reverse of the out edges, acts like and index for relationships
(uid, edge_name, uid) = ''
Give me all the vertex that go to "B"
Give me all the vertex that go to "B" through "C"
Primitive types of the Edge
(edge_name, parent_node_uid, relation_node_uid, edge_property_name) = value
By default all primitive (int, bool, date, enum) types are indexes except the string
type
-
integer
it could be 8, 16, 32, 64 bits depending the length of the integer
-
float
32 bits big endian
-
bool
single byte
-
datetime
tuple with the format
{year, month, day, hour, minute, second}
-
date
tuple with the format
{year, month, day}
-
time
tuple with the format
{hour, minute, second}
-
enum
bit-string
-
string
unicode-string, it is compressed with zstd once the data reach certain length, length handled as a config value
-
uid
tuple encoded
(string, integer)
In nested queries the childs might fetch parent nodes that are already loaded in the first steps of query request, that could be a big problem for performance and resource usage.
Use the Facebook Dataloader, it caches the requests over the query, is a good way solve this problem and improve the performance of the queries (even more if are computationally expensive, like sum of values, but at the moment of writing this Nomure doesn't support it)
One of the problems that Graph databases solves is analysis over large amounts of relationships, a good example is described on facebook (at https://code.fb.com/data-infrastructure/dragon-a-distributed-graph-query-engine/):
Suppose we follow a really famous user, with millions of followers and I want to know which of my friends follow that person, this is super expensive if the data is huge in the way that Nomure works right now, it can be distributed operations over a range of data (sharding?), due to the nature of Elixir and FDB this is "easy", but is an advance topic to cover.
This problem is simple if I have a few friends, in that case I can iterate over my friends and check if the user key contains my friends and get the result, but if I have millions of friends as the user does it became really expensive with the methods we have now.
There are a lot of graph algorithms out there, but the real challenge is to implement then with the use of FDB.
Not planned yet, For the moment this functionality is out of the scope for Nomure