Re: Count Query Optimization


Hi Vinayak,

For query 1.

What is the degree centrality of vertex having property A. How much percentage satisfy out edge having property E. If it is small, VCI will help to increase speed for this traversal.

You can give it a try to below query, not sure if it will speed up.

g.V().has('property1', 'A').
    inV().has('property1', 'B').

On Fri, 12 Mar 2021, 13:30 Vinayak Bali, <vinayakbali16@...> wrote:
Hi All,

The schema consists of A, B as nodes, and E as an edge with some other nodes and edges. 
A: 183468
B: 437317
E: 186513

Query:  g.V().has('property1', 'A').as('v1').outE().has('property1','E').as('e').inV().has('property1', 'B').as('v2').select('v1','e','v2').dedup().count()
Output: 200166
Time Taken: 1min

Query: g.V().has('property1', 'A').aggregate('v').outE().has('property1','E').aggregate('e').inV().has('property1', 'B').aggregate('v').select('v').dedup().as('vetexCount').select('e').dedup().as('edgeCount').select('vetexCount','edgeCount').by(unfold().count())
Output: ==>[vetexCount:383633,edgeCount:200166]
Time: 3.5 mins
Property1 is the index.
How can I optimize the queries because minutes of time for count query is not optimal. Please suggest different approaches. 

Thanks & Regards,

Join to automatically receive all group messages.