repeat with times(1) causing timeout

I'm trying to run a subtraversal of my query inside a repeat step. For some reason, it keeps timing out even with the breaking condition of times(1).


Query 1 (runtime: 85 ms)
 g.V().hasLabel("VertexA").as("_start")
     .in("EdgeA")
     .hasLabel("VertexB")
     .out("EdgeB")
     .in("EdgeC")
     .out("EdgeA")
     .dedup()
     .where(not(eq("_start")))
     .limit(10)


Query 2 (timeout)
 g.V().hasLabel("VertexA").as("_start")
     .in("EdgeA")
     .hasLabel("VertexB")
     .repeat(
         out("EdgeB")
         .in("EdgeC")
     ).times(1)
     .out("EdgeA")
     .dedup()
     .where(not(eq("_start")))
     .limit(10)


Profiling these queries shows a huge difference in index operations.

Note: To avoid timeout while profiling I added limit(100) after hasLabel("VertexB") in both queries.

Query 1
 Index Operations
 ================
 Query execution:
     # of statement index ops: 481
     # of unique statement index ops: 473


Query 2
 Index Operations
 ================
 Query execution:
     # of statement index ops: 57142
     # of unique statement index ops: 57134


What could be the reason?
Was this page helpful?