Suggest more quickly count predicate total number


(Gao Qi Lin) #1

Hey, guys
The problem is when data size are too large the count predicate are get very slowly .
In my case , 0.65 Billion nodes , when I used count(uid) , the query speed is unbearable.
Can you add a variable to count separately and get total number by used complexity O(1) ?

eg:

curl 127.0.0.1:8080/query -X POST -d '
{
    node(func: has(md5sha1)) {
        num:count(uid)
    }
}'

(Daniel Mai) #2

Instead of using has() you can use can indexed function as the root func. There is also a count index that may be useful for you here.


(Gao Qi Lin) #3

Hey @dmai
The fact is I want all predicate numbers .
Maybe zero state are more suitable to show total numbers .

eg :

          {
            ...
            "tablets": {
                "md5sha1": {
                    "groupId": 1, 
                    "predicate": "md5sha1", 
                    "space": "171416344634",
                    "count": "111111111"  // the total numbers
                }
            
           }
        }