Re: Union Query Optimization
Vinayak Bali
Hi, cmilowka, The property title has a composite index created on it. Further modified the query as follows: g.V().has('title',within('V1','V2')).union(has('title', 'V1').as('v1').outE().hasLabel('E1').as('e').inV().has('title', 'V2').as('v2'),has('title', 'V2').as('v1').union(outE().hasLabel('E2').as('e').inV().has('title', 'V2'),outE().hasLabel('E3').as('e').inV().has('title', 'V3')).as('v2')).select('v1','e','v2').by(valueMap().by(unfold())) the only change is adding has('title',within('V1','V2')) at start of query. The warning is gone now and performance is also improved. Earlier the time taken was around 3.5 mins now it's 55 sec to return only 44 records. The problem is my source changes, need to consider it. For example: v1 - e1 -v2 v3 -e2 -v4 Want the want in a single query. now the query for this will be as follows: g.V().has('title',within('V1','V3')).union(has('title','V1').as('v1').outE().has('title','E1').as('e').inV().has('title','V2').as('v2'),has('title','V3').as('v1').outE().has('title','E2').as('e').inV().has('title','V4').as('v2')).select('v1','e','v2').by(valueMap().by(unfold())) Request all of you to provide your feedback to improve it further. Thanks & Regards, Vinayak On Thu, Apr 22, 2021 at 5:14 AM cmilowka <cmilowka@...> wrote:
|
|