Connecting Filters are very slow!

Dgraph version   : v20.11.0-rc5
raph codename  : tchalla
Dgraph SHA-256   : 95d845ecec057813d1a3fc94394ba1c18ada80f584120a024c19d0db668ca24e
Commit SHA-1     : b65a8b10c
Commit timestamp : 2020-12-14 19:09:28 +0530
Branch           : HEAD
Go version       : go1.15.5
jemalloc enabled : true

There are two types in the schema, with a total of 800 million nodes.

type <Company> {
	RlNode.rlid
	Company.name
	Company.status
	Company.invest
	Company.invested
	Company.manager
	Company.shareholder
}
type <Person> {
	RlNode.rlid
	Person.name
	Person.manager
	Person.shareholder
	Person.avatar
}

Use the following statement to query. The query without filter takes 500 milliseconds, and the query with filter takes 41 seconds.


{
  var(func:eq(RlNode.rlid,"2ff24d7cb0d894649584f304e074cc65")){
    uid
    expand(_all_){
      uid
      expand(_all_) {
        u as uid
      }
    }
  }
  c(func:uid(u)) {
    count:count(uid) @filter(type(Company))
   
  }
}

800 million is a heavy load. Are you using a balanced cluster(shards)?
Does your application consume 800 million nodes all the time?

Of course, my cluster is already balanced.

This is just a simple two-degree relationship query, and there are almost 700 nodes in the result set.
I want to make a statistics based on the type of the node.