General Best Practices for Using Gremlin with Neptune
Follow these recommendations when using the Gremlin graph traversal language with Neptune. For information about using Gremlin with Neptune, see Accessing a Neptune graph with Gremlin.
Important
A change was made in TinkerPop version 3.4.11 that improves correctness of how queries are processed, but for the moment can sometimes seriously impact query performance.
For example, a query of this sort may run significantly slower:
g.V().hasLabel('airport'). order(). by(out().count(),desc). limit(10). out()
The vertices after the limit step are now fetched in a non-optimal way because
of the TinkerPop 3.4.11 change. To avoid this, you can modify the query by adding
the barrier() step at any point after the order().by()
.
For example:
g.V().hasLabel('airport'). order(). by(out().count(),desc). limit(10). barrier(). out()
TinkerPop 3.4.11 was enabled in Neptune engine version 1.0.5.0.
Topics
- Structure upsert queries to take advantage of the DFE engine
- Test Gremlin code in the context where you will deploy it
- Creating Efficient Multithreaded Gremlin Writes
- Pruning Records with the Creation Time Property
- Using the datetime( ) Method for Groovy Time Data
- Using Native Date and Time for GLV Time Data
Structure upsert queries to take advantage of the DFE engine
Making efficient upserts with Gremlin mergeV() and mergeE() steps explains how to structure upsert queries to use the DFE engine as effectively as possible.