Select your cookie preferences

We use essential cookies and similar tools that are necessary to provide our site and services. We use performance cookies to collect anonymous statistics, so we can understand how customers use our site and make improvements. Essential cookies cannot be deactivated, but you can choose “Customize” or “Decline” to decline performance cookies.

If you agree, AWS and approved third parties will also use cookies to provide useful site features, remember your preferences, and display relevant content, including relevant advertising. To accept or decline all non-essential cookies, choose “Accept” or “Decline.” To make more detailed choices, choose “Customize.”

The queryTimeout SPARQL query hint

Focus mode
The queryTimeout SPARQL query hint - Amazon Neptune

The queryTimeout query hint specifies a timeout that is shorter than the neptune_query_timeout value set in the DB parameters group.

If the query terminates as a result of this hint, a TimeLimitExceededException is thrown, with an Operation terminated (deadline exceeded) message.

queryTimeout SPARQL hint syntax

PREFIX hint: <http://aws.amazon.com/neptune/vocab/v01/QueryHints#> SELECT ... WHERE { hint:Query hint:queryTimeout 10 . # OR hint:Query hint:queryTimeout "10" . # OR hint:Query hint:queryTimeout "10"^^xsd:integer . ... }

The time-out value is expressed in milliseconds.

The time-out value must be smaller than the neptune_query_timeout value set in the DB parameters group. Otherwise, a MalformedQueryException exception is thrown with a Malformed query: Query hint 'queryTimeout' must be less than neptune_query_timeout DB Parameter Group message.

The queryTimeout query hint should be specified in the WHERE clause of the main query, or in the WHERE clause of one of the subqueries as shown in the example below.

It must be set only once across all the queries/subqueries and SPARQL Updates sections (such as INSERT and DELETE). Otherwise, a MalformedQueryException exception is thrown with a Malformed query: Query hint 'queryTimeout' must be set only once message.

Available Scopes

The queryTimeout hint can be applied both to SPARQL queries and updates.

  • In a SPARQL query, it can appear in the WHERE clause of the main query or a subquery.

  • In a SPARQL update, it can be set in the INSERT, DELETE, or WHERE clause. If there are multiple update clauses, it can only be set in one of them.

For more information about query hint scopes, see Scope of SPARQL query hints in Neptune.

queryTimeout SPARQL hint example

Here is an example of using hint:queryTimeout in the main WHERE clause of an UPDATE query:

PREFIX hint: <http://aws.amazon.com/neptune/vocab/v01/QueryHints#> INSERT { ?s ?p ?o } WHERE { hint:Query hint:queryTimeout 100 . ?s ?p ?o . }

Here, the hint:queryTimeout is in the WHERE clause of a subquery:

PREFIX hint: <http://aws.amazon.com/neptune/vocab/v01/QueryHints#> SELECT * { ?s ?p ?o . { SELECT ?s WHERE { hint:Query hint:queryTimeout 100 . ?s ?p1 ?o1 . } } }

On this page

PrivacySite termsCookie preferences
© 2025, Amazon Web Services, Inc. or its affiliates. All rights reserved.