openCypher query plan cache hint
Query plan cache behavior can be overridden on a per-query (parameterized or not) basis by query-level query hint
QUERY:PLANCACHE. It needs to be used with the USING clause. The query hint accepts
enabled or disabled as a value. For more information on query plan cache, see
Query plan cache in Amazon Neptune.
- AWS CLI
-
Forcing plan to be cached or reused:
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"With parameters:
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}'Forcing plan to be neither cached nor reused:
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"For more information, see execute-open-cypher-query in the AWS CLI Command Reference.
- 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'])For AWS SDK examples in other languages, see AWS SDK.
- awscurl
-
Forcing plan to be cached or reused:
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"Note
This example assumes that your AWS credentials are configured in your environment. Replace
us-east-1with the Region of your Neptune cluster. - curl
-
Forcing plan to be cached or reused:
curl https://your-neptune-endpoint:port/openCypher \ -d "query=Using QUERY:PLANCACHE \"enabled\" MATCH(n) RETURN n LIMIT 1"With parameters:
curl https://your-neptune-endpoint:port/openCypher \ -d "query=Using QUERY:PLANCACHE \"enabled\" RETURN \$arg" \ -d "parameters={\"arg\": 123}"Forcing plan to be neither cached nor reused:
curl https://your-neptune-endpoint:port/openCypher \ -d "query=Using QUERY:PLANCACHE \"disabled\" MATCH(n) RETURN n LIMIT 1"