View a markdown version of this page

openCypher query plan cache hint - Amazon Neptune
Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions, see Getting Started with Amazon Web Services in China (PDF).

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.

Amazon 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 Amazon 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 Amazon SDK examples in other languages, see Amazon SDK.

awscurl

Forcing plan to be cached or reused:

awscurl https://your-neptune-endpoint:port/openCypher \ --region us-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 Amazon credentials are configured in your environment. Replace us-east-1 with 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"