本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。
openCypher 查詢計劃快取提示
查詢計畫快取行為可以透過查詢層級查詢提示 ,根據每個查詢 (無論是否參數化) 覆寫QUERY:PLANCACHE。它需要與 USING子句搭配使用。查詢提示接受 enabled或 disabled作為值。如需查詢計劃快取的詳細資訊,請參閱 Amazon Neptune 中的查詢計劃快取。
- AWS CLI
-
強制計劃快取或重複使用:
aws neptunedata execute-open-cypher-query \ --endpoint-url https://your-neptune-endpoint:port\ --open-cypher-query "Using QUERY:PLANCACHE \"enabled\" MATCH(n) RETURN n LIMIT 1"使用參數:
aws neptunedata execute-open-cypher-query \ --endpoint-url https://your-neptune-endpoint:port\ --open-cypher-query "Using QUERY:PLANCACHE \"enabled\" RETURN \$arg" \ --parameters '{"arg": 123}'強制計劃不會快取或重複使用:
aws neptunedata execute-open-cypher-query \ --endpoint-url https://your-neptune-endpoint:port\ --open-cypher-query "Using QUERY:PLANCACHE \"disabled\" MATCH(n) RETURN n LIMIT 1"如需詳細資訊,請參閱《 AWS CLI 命令參考》中的 execute-open-cypher-query。
- SDK
-
import boto3 from botocore.config import Config client = boto3.client( 'neptunedata', endpoint_url='https://your-neptune-endpoint:port', config=Config(read_timeout=None, retries={'total_max_attempts': 1}) ) # Forcing plan to be cached or reused response = client.execute_open_cypher_query( openCypherQuery='Using QUERY:PLANCACHE "enabled" MATCH(n) RETURN n LIMIT 1' ) print(response['results'])如需其他語言的 AWS SDK 範例,請參閱 AWS 開發套件。
- awscurl
-
強制計劃快取或重複使用:
awscurl https://your-neptune-endpoint:port/openCypher \ --regionus-east-1\ --service neptune-db \ -X POST \ -d "query=Using QUERY:PLANCACHE \"enabled\" MATCH(n) RETURN n LIMIT 1"注意
此範例假設您的 AWS 登入資料已在您的環境中設定。將
us-east-1取代為 Neptune 叢集的區域。 - curl
-
強制計劃快取或重複使用:
curl https://your-neptune-endpoint:port/openCypher \ -d "query=Using QUERY:PLANCACHE \"enabled\" MATCH(n) RETURN n LIMIT 1"使用參數:
curl https://your-neptune-endpoint:port/openCypher \ -d "query=Using QUERY:PLANCACHE \"enabled\" RETURN \$arg" \ -d "parameters={\"arg\": 123}"強制計劃不會快取或重複使用:
curl https://your-neptune-endpoint:port/openCypher \ -d "query=Using QUERY:PLANCACHE \"disabled\" MATCH(n) RETURN n LIMIT 1"
查詢提示
AssumeConsistentDataTypes 提示