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
@filter
onpred
, I need to indexpred
. Should I give differentpred
by types or can I use samepred
?
E.g. op1) usename
as predicate of CITY type and COUNTRY type.
op2) usecity_name
as predicate of CITY type and usecountry_name
as predicate of the other. -
On above query, if I have other types and they have
pred
, how does dgraph work? - filter bybar
on all index table? or filter bybar
on result of has(foo)? -
If I use same predicates across all subject like
create_datetime
and use index, is it possible cause a performance issue or memory issue?
Thanks