# Terminate background queries

## Overview

This page provides instructions for terminating background database queries. If your Aerospike database becomes unresponsive as a result of multiple long-running background scans caused by Graph queries, you can manually terminate all Graph-related database operations with the `aerospike.graph.admin.query.abort` Gremlin call step.

This call step is mainly intended to function as a recovery method for an unresponsive Aerospike database due to Graph queries executed during testing or evaluation that unexpectedly caused long-running scans. Long-running scans should not occur during normal application activity, and should be avoided by adjusting the query patterns or creating [indexes](https://aerospike.com/docs/graph/2.5.0/develop/query/indexing) to suit the required queries.

## `abort` call step

The `abort` call step requires a user with [`ADMIN` level permissions](https://aerospike.com/docs/graph/2.5.0/manage/security/rbac-aero).

To invoke the `abort` call step, use the following Gremlin command:

```plaintext
g.call("aerospike.graph.admin.query.abort").next()
```

The command returns data in the format `Map<String, Integer>`, with the following keys:

-   `found`
-   `aborted`

The key values indicate the number of active queries found and the number successfully terminated.