Hi, I’m building a database using Dgraph. When I architect data relationship, I need types(or label) of data. I search many article about this, but the unclear parts are remain.
Here is my understanding.
When I use types, it is better to use a particular predicate for each type and use has function to search or filter this. This is because that indexing is unique so it can be too large if I use one predicate.
Here are my questions. Below query is came from docs.
{
q(func: has(foo)) {
pred @filter(bar) {
...
}
}
}
-
To use
@filteronpred, I need to indexpred. Should I give differentpredby types or can I use samepred?
E.g. op1) usenameas predicate of CITY type and COUNTRY type.
op2) usecity_nameas predicate of CITY type and usecountry_nameas predicate of the other. -
On above query, if I have other types and they have
pred, how does dgraph work? - filter bybaron all index table? or filter bybaron result of has(foo)? -
If I use same predicates across all subject like
create_datetimeand use index, is it possible cause a performance issue or memory issue?
Thanks 