Moved from GitHub dgraph/5813
Posted by EnricoMi:
Experience Report
What you wanted to do
I want to know how many uids have a specific predicate.
What you actually did
The query
{
result (func: has(pred)) {
count(uid)
}
}
gives me the number of uids that have predicate pred
.
Why that wasn’t great, with examples
This query is very slow for large predicates. There must be some index or cardinality information for a predicate available to answer this query in constant time. The “Schema” tab in Ratel provides for predicates the “Samples & Statistics” tab, which seems to fire the same query, which takes for ever. Improving this query would also improve UX for Ratel: