Gremlin query hints - Amazon Neptune

Gremlin query hints

You can use query hints to specify optimization and evaluation strategies for a particular Gremlin query in Amazon Neptune.

Query hints are specified by adding a withSideEffect step to the query with the following syntax.

g.withSideEffect(hint, value)
  • hint – Identifies the type of the hint to apply.

  • value – Determines the behavior of the system aspect under consideration.

For example, the following shows how to include a repeatMode hint in a Gremlin traversal.

Note

All Gremlin query hints side effects are prefixed with Neptune#.

g.withSideEffect('Neptune#repeatMode', 'DFS').V("3").repeat(out()).times(10).limit(1).path()

The preceding query instructs the Neptune engine to traverse the graph Depth First (DFS) rather than the default Neptune, Breadth First (BFS).

The following sections provide more information about the available query hints and their usage.