

本文属于机器翻译版本。若本译文内容与英语原文存在差异，则一律以英文原文为准。

# 最佳实践：充分利用 Neptune
<a name="best-practices"></a>

下面是有关使用 Amazon Neptune 的一些一般建议。使用此信息作为参考可以快速找到使用 Amazon Neptune 和最大程度地提高性能的建议。

**Contents**
+ [Amazon Neptune 基本操作指导](best-practices-general-basic.md)
  + [Amazon Neptune 安全最佳实践](best-practices-general-security.md)
  + [避免在集群中使用不同的实例类](best-practices-general-basic.md#best-practices-loader-heterogeneous-instances)
  + [避免在批量加载期间重复重启](best-practices-general-basic.md#best-practices-loader-repeated-restarts)
  + [如果您的谓词数量很多，则启用 OSGP 索引](best-practices-general-basic.md#best-practices-general-predicates)
  + [尽可能避免长时间运行的事务](best-practices-general-basic.md#best-practices-general-long-running-transactions)
  + [使用 Neptune 指标的最佳实践](best-practices-general-metrics.md)
  + [优化 Neptune 查询的最佳实践](best-practices-general-basic.md#best-practices-general-tuning)
  + [跨只读副本的负载均衡](best-practices-general-basic.md#best-practices-general-loadbalance)
  + [使用较大的临时实例加快加载速度](best-practices-general-basic.md#best-practices-loader-tempinstance)
  + [通过失效转移到只读副本来调整写入器实例的大小](best-practices-general-basic.md#best-practices-resize-instance)
  + [数据预提取任务中断错误后重试上传](best-practices-general-basic.md#load-api-reference-status-interrupted)
+ [将 Gremlin 与 Neptune 结合使用的一般最佳实践](best-practices-gremlin.md)
  + [Neptune 无服务器的心跳配置](best-practices-gremlin-heartbeat-serverless.md)
  + [构建更新插入查询以利用 DFE 引擎](best-practices-gremlin.md#best-practices-gremlin-upserts)
  + [在要部署 Gremlin 代码的上下文中对其进行测试](best-practices-gremlin-console-glv-differences.md)
  + [创建高效的多线程 Gremlin 写入](best-practices-gremlin-multithreaded-writes.md)
  + [使用创建时间属性修剪记录](best-practices-gremlin-prune.md)
  + [将 `datetime( )` 方法用于 Groovy 时间数据](best-practices-gremlin-datetime.md)
  + [将本机日期和时间用于 GLV 时间数据](best-practices-gremlin-datetime-glv.md)
+ [将 Gremlin Java 客户端与 Neptune 结合使用的最佳实践](best-practices-gremlin-java-client.md)
  + [跨多个线程重用客户端对象](best-practices-gremlin-java-reuse.md)
  + [为读取和写入端点创建单独的 Gremlin Java 客户端对象](best-practices-gremlin-java-separate.md)
  + [将多个只读副本端点添加到 Gremlin Java 连接池](best-practices-gremlin-java-multiple.md)
  + [关闭客户端以避免连接限制](best-practices-gremlin-java-close-connections.md)
  + [在失效转移后创建新连接](best-practices-gremlin-java-new-connection.md)
  + [将 `maxInProcessPerConnection` 和 `maxSimultaneousUsagePerConnection` 设置为相同值](best-practices-gremlin-java-maxes.md)
  + [将查询以字节码而不是字符串的格式发送到服务器](best-practices-gremlin-java-bytecode.md)
  + [始终完全消耗查询返回的 ResultSet 或迭代器](best-practices-gremlin-java-resultset.md)
  + [按批次批量添加顶点和边缘](best-practices-gremlin-java-batch-add.md)
  + [禁用 Java 虚拟机中的 DNS 缓存](best-practices-gremlin-java-disable-dns-caching.md)
  + [（可选）在每个查询级别设置超时](best-practices-gremlin-java-per-query-timeout.md)
  + [排除 `java.util.concurrent.TimeoutException` 问题](best-practices-gremlin-java-exceptions-TimeoutException.md)
+ [使用 openCypher 和 Bolt 的 Neptune 最佳实践](best-practices-opencypher.md)
  + [在失效转移后创建新连接](best-practices-opencypher.md#best-practices-opencypher-renew-connection)
  + [长寿命应用程序的连接处理](best-practices-opencypher.md#best-practices-opencypher-long-connections)
  + [的连接处理 Amazon Lambda](best-practices-opencypher.md#best-practices-opencypher-lambda-connections)
  + [在查询中首选定向边缘而非双向边缘](best-practices-opencypher-directed-edges.md)
  + [Neptune 不支持在一个事务中进行多个并发查询](best-practices-opencypher-multiple-queries.md)
  + [完成后关闭驱动程序对象](best-practices-opencypher-close-driver.md)
  + [使用显式事务模式进行读写](best-practices-opencypher-use-explicit-txs.md)
    + [只读事务](best-practices-opencypher-use-explicit-txs.md#best-practices-opencypher-read-txs)
    + [突变事务](best-practices-opencypher-use-explicit-txs.md#best-practices-opencypher-mutation-txs)
  + [异常的重试逻辑](best-practices-opencypher-retry-logic.md)
  + [使用单个 SET 子句一次设置多个属性](best-practices-content-0.md)
    + [使用 SET 子句一次删除多个属性](best-practices-content-0.md#best-practices-content-1)
  + [使用参数化查询](best-practices-content-2.md)
  + [在 UNWIND 子句中使用扁平化映射而非嵌套映射](best-practices-content-3.md)
  + [在可变长度路径（VLP）表达式中将限制性更强的节点放在左侧](best-practices-content-4.md)
  + [使用精细的关系名称避免冗余节点标签检查](best-practices-content-5.md)
  + [尽可能指定边缘标签](best-practices-content-6.md)
  + [尽可能避免使用 WITH 子句](best-practices-content-7.md)
  + [尽早在查询中放置限制性筛选条件](best-practices-content-8.md)
  + [显式检查属性是否存在](best-practices-content-9.md)
  + [不要使用命名路径（除非必需）](best-practices-content-10.md)
  + [避免使用 COLLECT(DISTINCT())](best-practices-content-11.md)
  + [检索所有属性值时，最好使用 properties 函数而不是单个属性查找](best-practices-content-12.md)
  + [在查询之外执行静态计算](best-practices-content-13.md)
  + [对批量输入使用 UNWIND（而非单个语句）](best-practices-content-14.md)
  + [最好 IDs 对节点/关系使用自定义](best-practices-content-15.md)
  + [避免在查询中进行 \~id 计算](best-practices-content-16.md)
  + [更新/合并多个节点](best-practices-merge-multiple-nodes.md)
+ [使用 SPARQL 的 Neptune 最佳实践](best-practices-sparql.md)
  + [默认查询所有命名图形](best-practices-sparql-query.md)
  + [为加载指定命名图形](best-practices-sparql-graph.md)
  + [在查询的 FILTER、FILTER...IN 和 VALUES 之间进行选择](best-practices-sparql-batch.md)