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)
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)
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
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
Index Operations
================
Query execution:
# of statement index ops: 57142
# of unique statement index ops: 57134
What could be the reason?
6 Replies
jessea
jessea2y ago
(adding to this - I work with @moosa - we're seeing this behaviour with Neptune)
kelvinl2816
kelvinl28162y ago
Which Neptune engine version are you currently using?
jessea
jessea2y ago
We're on engine version 1.1.1.0
spmallette
spmallette2y ago
@neptune any thoughts on this one?
kelvinl2816
kelvinl28162y ago
It would help (if you are able to share) to have the full profile for each query. It would also be interesting to know if things improve on the latest engine. Gremlin query performance improvements go in to just about every Neptune release as more patterns are found that will benefit from additional optimization. Feel free to contact me privately if you are unable to share a profile here. A repeat query, even a times(1) will likely always be a little slower than just out().out() as under the covers repeat has to initialize some extra data structures etc. but timing out does sound odd. We need to look into what is going on and the profile will really help.
spmallette
spmallette2y ago
Just to close the loop on this one, seems that an issue has been opened in Neptune for this concern to be resolved in a future version.
Want results from more Discord servers?
Add your server