Re: Query Optimisation

Vinayak Bali

Hi Marc,

Thank you for your reply. I understand the queries are big, so there is a problem viewing them. 

Actually I am not interested in either of v1 or v2. I want to apply limit on edges, and don't care how many v1 or v2 will returned, with least time taken. 

Query 1 is the main query, and I want to apply limit on all edges. Other queries are for reference which I have tried by just small changes. Some work but time taken is more. 

Please suggest a optimised way in which I can apply limit on edges or may be v1 and v2 if required in future, which will take less time. 

Thanks & Regards,

On Sat, 8 May 2021, 5:38 pm , <hadoopmarc@...> wrote:
Hi Vinayak,

Can you please try and format your code in a consistent way to ease the reading (even if the editor in this forum is not really helpful in this)? After manual reformatting, Query 1 and the first Query 3 are identical, so I stopped looking at the other queries after that.

I have one suggestion though. If you take one of the subclauses:
    outE().has('property1', 'edge1').limit(100).as('e').inV().has('property1', 'vertex1')

you do not seem interested in returning all v2 vertices. You can therefore limit the number of v2 vertices with:
    outE().has('property1', 'edge1').limit(100).as('e').local(inV().has('property1', 'vertex1').limit(1))

Also see:

Best wishes,   Marc

Join { to automatically receive all group messages.