View a markdown version of this page

openCypher クエリタイムアウトヒント - Amazon Neptune

翻訳は機械翻訳により提供されています。提供された翻訳内容と英語版の間で齟齬、不一致または矛盾がある場合、英語版が優先します。

openCypher クエリタイムアウトヒント

クエリタイムアウト動作は、クエリレベルのクエリヒント によってクエリごとに設定できますQUERY:TIMEOUTMILLISECONDSUSING 句とともに使用する必要があります。クエリヒントは、負以外の を値として受け入れます。

AWS CLI
aws neptunedata execute-open-cypher-query \ --endpoint-url https://your-neptune-endpoint:port \ --open-cypher-query "USING QUERY:TIMEOUTMILLISECONDS 100 MATCH(n) RETURN n LIMIT 1"

詳細については、 コマンドリファレンスの execute-open-cypher-query AWS CLI を参照してください。

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}) ) response = client.execute_open_cypher_query( openCypherQuery='USING QUERY:TIMEOUTMILLISECONDS 100 MATCH(n) RETURN n LIMIT 1' ) print(response['results'])

他の言語の AWS SDK の例については、「」を参照してくださいAWS SDK

awscurl
awscurl https://your-neptune-endpoint:port/openCypher \ --region us-east-1 \ --service neptune-db \ -X POST \ -d "query=USING QUERY:TIMEOUTMILLISECONDS 100 MATCH(n) RETURN n LIMIT 1"
注記

この例では、 AWS 認証情報が 環境で設定されていることを前提としています。us-east-1 を Neptune クラスターのリージョンに置き換えます。

curl
curl https://your-neptune-endpoint:port/openCypher \ -d "query=USING QUERY:TIMEOUTMILLISECONDS 100 MATCH(n) RETURN n LIMIT 1"

クエリタイムアウトの動作では、クラスターレベルのタイムアウトとクエリレベルのタイムアウトの最小値が考慮されます。クエリタイムアウトの動作については、以下の例を参照してください。クラスターレベルのクエリタイムアウトの詳細については、「neptune_query_timeout」を参照してください。

# Suppose `neptune_query_timeout` is 10000 ms and query-level timeout is set to 100 ms # It will consider 100 ms as the final timeout curl https://your-neptune-endpoint:port/openCypher \ -d "query=USING QUERY:TIMEOUTMILLISECONDS 100 MATCH(n) RETURN n LIMIT 1" # Suppose `neptune_query_timeout` is 100 ms and query-level timeout is set to 10000 ms # It will still consider 100 ms as the final timeout curl https://your-neptune-endpoint:port/openCypher \ -d "query=USING QUERY:TIMEOUTMILLISECONDS 10000 MATCH(n) RETURN n LIMIT 1"

クエリがタイムアウトを超えると、Neptune はクエリを終了し、タイムアウトエラーを返します。タイムアウトしたクエリを再試行するかどうかは、障害の性質とワークロードによって異なります。ガイダンスについては、「例外処理と再試行」を参照してください。