Union Query Optimization


Vinayak Bali
 

Hi All, 

I need to select multiple nodes and edges and display the content in v1 - e - v2 format. The query generated is as follows:

g.V().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()))

It throws the warning:
05:20:21 WARN  org.janusgraph.graphdb.transaction.StandardJanusGraphTx  - Query requires iterating over all vertices [()]. For better performance, use indexes

How can we optimize the query may be without a union step?

Thanks & Regards,
Vinayak

Join janusgraph-users@lists.lfaidata.foundation to automatically receive all group messages.