Skip to content

Instantly share code, notes, and snippets.

@danshev
Created May 22, 2022 18:37
Show Gist options
  • Save danshev/59f0d691d57a79a9405decccbab5d4c6 to your computer and use it in GitHub Desktop.
Save danshev/59f0d691d57a79a9405decccbab5d4c6 to your computer and use it in GitHub Desktop.
Jupyter Output
*******************************************************
Neptune Gremlin Profile
*******************************************************
Query String
==================
g.withSack(120).V('BOS').
repeat(
outE().hasLabel('VOYAGES_TO').sack(sum).by('duration').
sack(sum).by(constant(45))
.inV()
.simplePath()
).
until(or(has('code', 'BCN'), sack().is(gte(660)), loops().is(3))).
and(has('code', 'BCN'), sack().is(lte(660))).
limit(4).
local(union(path().by('code').by('duration'), sack()).fold()).
local(unfold().unfold().fold())
Original Traversal
==================
[GraphStep(vertex,[BOS]), RepeatStep([VertexStep(OUT,edge), HasStep([~label.eq(VOYAGES_TO)]), SackValueStep(sum,value(duration)), SackValueStep(sum,[ConstantStep(45)]), EdgeVertexStep(IN), PathFilterStep(simple,null,null), RepeatEndStep],until([OrStep([[HasStep([code.eq(BCN)])], [SackStep, IsStep(gte(660))], [LoopsStep, IsStep(eq(3))]])]),emit(false)), AndStep([[HasStep([code.eq(BCN)])], [SackStep, IsStep(lte(660))]]), RangeGlobalStep(0,4), LocalStep([UnionStep([[PathStep([value(code), value(duration)]), EndStep], [SackStep, EndStep]]), FoldStep]), LocalStep([UnfoldStep, UnfoldStep, FoldStep])]
Optimized Traversal
===================
Neptune steps:
[
NeptuneGraphQueryStep(Vertex) {
JoinGroupNode {
PatternNode[(?2=<BOS>, <~label>, ?3, <~>) . project distinct ?2 .], {estimatedCardinality=INFINITY, indexTime=0, joinTime=0, numSearches=1}
}, annotations={path=[Vertex(?2):GraphStep], joinStats=true, optimizationTime=5, maxVarId=11, sackVar=?1, initialValues={?1=120}, chunkSize=4, executionTime=21959}
},
NeptuneTraverserConverterStep
]
+ not converted into Neptune steps: RepeatStep([NeptuneMemoryTrackerStep, VertexStep(OUT,[VOYAGES_TO],edge), SackValueStep(sum,value(duration)), SackValueStep(sum,[ConstantStep(45)]), EdgeVertexStep(IN), PathFilterStep(simple,null,null), RepeatEndStep],until([NeptuneMemoryTrackerStep, OrStep([[NeptuneHasStep([code.eq(BCN)])], [SackStep, IsStep(gte(660))], [LoopsStep, IsStep(eq(3))]])]),emit(false)),AndStep([[NeptuneHasStep([code.eq(BCN)])], [SackStep, IsStep(lte(660))]]),RangeGlobalStep(0,4),LocalStep([UnionStep([[PathStep([value(code), value(duration)]), EndStep], [SackStep, EndStep]]), NeptuneMemoryTrackerStep, FoldStep]),LocalStep([UnfoldStep, UnfoldStep, NeptuneMemoryTrackerStep, FoldStep]),
WARNING: >> [RepeatStep([NeptuneMemoryTrackerStep, VertexStep(OUT,[VOYAGES_TO],edge), SackValueStep(sum,value(duration)), SackValueStep(sum,[ConstantStep(45)]), EdgeVertexStep(IN), PathFilterStep(simple,null,null), RepeatEndStep],until([NeptuneMemoryTrackerStep, OrStep([[NeptuneHasStep([code.eq(BCN)])], [SackStep, IsStep(gte(660))], [LoopsStep, IsStep(eq(3))]])]),emit(false))] << (or one of the children for each step) is not supported natively yet
Physical Pipeline
=================
NeptuneGraphQueryStep
|-- StartOp
|-- JoinGroupOp
|-- SpoolerOp(4)
|-- DynamicJoinOp(PatternNode[(?2=<BOS>, <~label>, ?3, <~>) . project distinct ?2 .], {estimatedCardinality=INFINITY})
Runtime (ms)
============
Query Execution: 21959.517
Serialization: 0.224
Traversal Metrics
=================
Step Count Traversers Time (ms) % Dur
-------------------------------------------------------------------------------------------------------------
NeptuneGraphQueryStep(Vertex) 1 1 0.512 0.00
NeptuneTraverserConverterStep 1 1 0.071 0.00
RepeatStep([NeptuneMemoryTrackerStep, VertexSte... 235552 235552 16582.392 75.52
OrStep([[NeptuneHasStep([code.eq(BCN)])], [Sa... 7204.832
NeptuneHasStep([code.eq(BCN)]) 5816.702
SackStep 239106 239106 341.816
IsStep(gte(660)) 122.999
LoopsStep 77970 77970 86.141
IsStep(eq(3)) 32.028
VertexStep(OUT,[VOYAGES_TO],edge) 245815 245815 819.129
SackValueStep(sum,value(duration)) 245815 245815 6037.750
SackValueStep(sum,[ConstantStep(45)]) 245815 245815 743.468
ConstantStep(45) 245815 245815 241.502
EdgeVertexStep(IN) 245815 245815 314.640
PathFilterStep(simple,null,null) 239714 239714 792.339
RepeatEndStep 235552 235552 7775.727
AndStep([[NeptuneHasStep([code.eq(BCN)])], [Sac... 1 1 5374.960 24.48
NeptuneHasStep([code.eq(BCN)]) 5063.459
SackStep 608 608 1.500
IsStep(lte(660)) 1.039
RangeGlobalStep(0,4) 1 1 0.029 0.00
LocalStep([UnionStep([[PathStep([value(code), v... 1 1 0.621 0.00
UnionStep([[PathStep([value(code), value(dura... 2 2 0.435
PathStep([value(code), value(duration)]) 1 1 0.229
EndStep 1 1 0.017
SackStep 1 1 0.005
EndStep 1 1 0.005
FoldStep 1 1 0.161
LocalStep([UnfoldStep, UnfoldStep, NeptuneMemor... 1 1 0.102 0.00
UnfoldStep 2 2 0.008
UnfoldStep 4 4 0.012
FoldStep 1 1 0.023
>TOTAL - - 21958.692 -
Predicates
==========
# of predicates: 4
Results
=======
Count: 1
Output: [[BOS, 435, BCN, 600]]
Response serializer: application/vnd.gremlin-v3.0+json
Response size (bytes): 323
Index Operations
================
Query execution:
# of statement index ops: 725248
# of unique statement index ops: 16887
Duplication ratio: 42.9
# of terms materialized: 0
Serialization:
# of statement index ops: 0
# of terms materialized: 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment