2

I have written one query which is taking longer than expected time.

g.V().hasLabel('Person').has('name','Person1').out('BELONGS').in('HAS').dedup().as('x').in('HAS').filter(__.in('HAS').has('name','App1')).store('y').select('x').dedup().in('HAS').hasLabel('Org').repeat(out()).until(outE().hasLabel('IS')).store('a').cap('y').unfold().in('HAS').hasLabel('Class').repeat(inE('IS').dedup().otherV()).until(inE('HAS')).where(within('a'))

Can we do an explain plan to look out what is making this query slower?

Regards

Varun Tahin

4

1 回答 1

9

You have several tools at your disposal when picking apart a Gremlin traversal. You can uses the explain() step and/or the profile() step. The explain() step will show how the traversal is composed and modified by Traversal Strategies which optimize its execution. The profile() step will provide statistics on traversal execution itself.

I would also call the Gremlin Console itself a "tool". Debugging Gremlin sometimes takes me down a path of executing smaller chunks of a traversal so that I can determine what it is returning at any given point in the list of steps. The Gremlin Console, as it is a REPL, provides the ability to get immediate feedback on code execution, thus getting you out of the longer development cycle of your IDE.

于 2017-02-01T12:00:02.713 回答