Indexing and Query Performance

I am working on fine tuning a query so that it becomes faster. The query is like: g.V().has('Index1','123').as('p').out('has_rel1').has('Index2,within('A','B').as('q').dedup().out('has_rel2').has('Index3','X').as('r').select('p','q','r').by('id') How to ensure all the three index are used for searching. I created index for all the 3 search attribute named as Index1, Index2 and Index3. But while doing profile I can see only Index1 being used. Any suggestion. Fyi, Firstly I created all as Composite index, but since index2 isnt using equality, so later made it as mixed index, but still no changes.
4 Replies
spmallette
spmallette4w ago
you don't say what graph database you are using. given you index creation description, it sounds like JanusGraph. is that right?
eternallaw
eternallawOP4w ago
My bad @spmallette, yes its JanusGraph
spmallette
spmallette4w ago
i'm not really up to speed on the latest janusgraph does with indices. if no one with janusgraph expertise can jump in here, you might want to post this question in their discord server.
Flynnt
Flynnt2w ago
In Janusgraph, there are different types of indexes. If you want to use indexes during the traversal, I guess that it’s because you have a high degree on your vertices. In this traversal, the index 1 will be used, but not the others. If you want to speed up your traversal, you could to forward the “vertex centric indexes” They create sort of local indexes in the vertex. With denormalization, having your filter property on the edge, it will speed up the traversal. Or, may be you could design your schema in another way xD

Did you find this page helpful?