Gremlin 查詢提示 - Amazon Neptune

本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。

Gremlin 查詢提示

您可以在 Amazon Neptune 中使用查詢提示,來指定特定 Gremlin 查詢的最佳化和評估策略。

使用以下語法在查詢中新增 withSideEffect 步驟,即可指定查詢提示。

g.withSideEffect(hint, value)
  • 提示 - 識別要套用的提示類型。

  • - 確定正在考慮的系統方面的行為。

例如,以下示範如何在 Gremlin 周遊中包含 repeatMode 提示。

注意

所有 Gremlin 查詢提示的副作用皆加上 Neptune# 字首。

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

上述查詢會指示 Neptune 引擎周遊圖形時「深度優先」(DFS),而非預設 Neptune「廣度優先」(BFS)。

以下章節提供可用查詢提示及其用法的詳細資訊。