Monitoring and terminating queries and update requests

You can monitor and terminate queries and update requests manually from the Workbench and automatically by configuring GraphDB to abort them after a certain query timeout period is reached.

Query monitoring and termination using the Workbench

When there are running queries or update requests, their numbers are shown in the upper right next to the repositories dropdown menu.

To track and interrupt long running queries:

  1. Go to Monitor ‣ Queries and Updates or click the Running queries status next to the repositories dropdown menu. This displays a table of any running queries or update requests.

  2. Click the Abort query or Abort update button on a table row to stop the execution of one of those.

To pause the current state of the running queries, use the Pause button. Note that this will not stop their execution on the server.

The following shows the monitor while both an update request and a query are running. (The update request and query in this example are deliberately inefficient examples so that they would display on the monitor long enough to take the screenshot. Most are displayed there only very briefly.)

_images/query-monitoring.png

The table of running queries or update request has columns with the following information about those queries:

id

The ID of the query

node

Local or remote node repository ID

username

The ID of the user who initiated the query

type

The operation type QUERY or UPDATE

query

The first 500 characters of the query string

lifetime

The time in seconds since the iterator was created

state

The internal state of the operation

You can also interrupt a query or update request directly from the SPARQL Editor with the Abort query button in the lower right:

_images/editorWithAbort.png

Automatically prevent long running queries

You can set a global query timeout period by adding a query-timeout configuration parameter. All queries will stop after a number of seconds defined by this parameter, where the default value of 0 indicates no limit.

You can also control whether a terminated query returns partial results or an error using the throw-QueryEvaluationException-on-timeout parameter. By default, this parameter is set to false.

  • If the parameter is set to true, upon reaching a timeout, GraphDB will return an error and no results.

  • If the parameter is set to false, upon reaching a timeout, GraphDB will return partial results that were received before the timeout was reached. However, GraphDB will not indicate that the results are incomplete.