Indexes can't handle these type of constraints, so defining/not defining indexes will not make a difference. These type of join-constraints are always handled internally. The only thing that you could improve with your query is not select * but only a simple property (e.g. node.[jcr:name]) since you're only interested in the count.
Apart from this you should try to profile the query and investigate where time is being spent. Using certain JCR features (most notably ACLs) is known to reduce the throughput of queries because each result has to be checked for permissions against the ACL manager.