HTTP interface for the query plan cache

The query plan cache HTTP API lets you list the AQL execution plans that are in the cache as well as clear the cache

Introduced in: v3.12.4

To cache execution plans for AQL queries as well as to utilize cached plans, set the usePlanCache query option to true when issuing a query. See HTTP interfaces for AQL queries for details and The execution plan cache for AQL queries for general information about the feature.

List the entries of the AQL query plan cache

GET /_db/{database-name}/_api/query-plan-cache

Returns an array containing information about each AQL execution plan currently stored in the cache of the selected database.

This requires read privileges for the current database. In addition, only those query plans are returned for which the current user has at least read permissions on all collections and Views included in the query.

Path Parameters
  • The name of the database.

Query Parameters
    HTTP Headers
      Responses
      • The list of cached query plans.

          Response Body application/json
        • The entries of the query plan cache.

          • A subset of the original bind parameters with only the collection bind parameters (e.g. @@coll). They need to have the same names and values for utilizing a cached plan.

          • The date and time at which the query plan has been added to the cache (in ISO 8601 format).

          • The collections and Views involved in the query.

          • The value of the fullCount query option in the original query. This option generally leads to different execution plans.

          • The plan cache key.

          • How many times the cached plan has been utilized so far.

          • How much memory the plan cache entry takes up for the execution plan, query string, and so on (in bytes).

          • The query string.

          • The hash value of the query string.

      Retrieve the entries stored in the AQL query plan cache of the current database:

      curl --header 'accept: application/json' --dump - 'http://localhost:8529/_api/query-plan-cache'
      Show output

      Clear the AQL query plan cache

      DELETE /_db/{database-name}/_api/query-plan-cache

      Clears all execution plans stored in the AQL query plan cache for the current database.

      This requires write privileges for the current database.

      Path Parameters
      • The name of the database.

      Query Parameters
        HTTP Headers
          Responses
          • The query plan cache has been cleared for the current database.

              Response Body application/json object
            • The HTTP response status code.

            • A flag indicating that no error occurred.

          Clear the AQL query plan cache of the current database:

          curl -X DELETE --header 'accept: application/json' --dump - 'http://localhost:8529/_api/query-plan-cache'
          Show output