# 3. Are any queries waiting on something?

Use the following steps to determine whether your queries are being blocked or waiting for another reason.

1. Check the Active Queries page in Studio, or the `PROCESSLIST`.

   * On the active queries page in Studio, check whether there are many queued queries by sorting on the `status` column.
   * The default `workload_management_max_queue_depth` before queries fail is 100. Refer to the [List of Engine Variables](https://docs.singlestore.com/db/v9.1/reference/configuration-reference/engine-variables/list-of-engine-variables/#sync-variables-lists.md) for more information on this variable. You can also check the current setting by running [SHOW VARIABLES](https://docs.singlestore.com/db/v9.1/reference/sql-reference/show-commands/show-variables.md)

     ![An Active Queries page showing the active processes.](https://images.contentstack.io/v3/assets/bltac01ee6daa3a1e14/blt8f0a75d654768b8d/6a2c431f714c3653bb8ec214/16083b57960a3f-JAxKkB.png)

   * If you are using the database client, query [MV\_PROCESSLIST](https://docs.singlestore.com/db/v9.1/reference/information-schema-reference/query-performance-workload-management-and-statistics/mv-processlist.md). `SELECT * FROM information_schema.MV_PROCESSLIST WHERE state = 'queued';`

2. Are there queries lingering or in an unkillable state?

   * Check the `PROCESSLIST` or the Active Queries page by using the above.

     1. Sort by `time`. If there is a long runtime (depending on a normal run time for your queries, which could be minutes, hours, or days), it is likely the query is hung.

     2. Identify those queries and run [KILL QUERY](https://docs.singlestore.com/db/v9.1/reference/sql-reference/operational-commands/kill-connection-and-kill-query.md) on them. This can be done in Studio by checking the boxes shown above, or from the client.

     3. You can also run [KILLALL QUERIES](https://docs.singlestore.com/db/v9.1/reference/sql-reference/operational-commands/killall-queries.md) to remove a large number of queries at once. **Note: This will kill all queries, whether hanging or running.**

     4. If you see queries with both a long runtime and a state of `KILLED` on a given node, there may be queries stuck in an unkillable state. Restart the affected node.&#x20;
   * Are queries queued by the workload manager? Check this by querying [MV\_WORKLOAD\_MANAGEMENT\_STATUS](https://docs.singlestore.com/db/v9.1/reference/information-schema-reference/query-performance-workload-management-and-statistics/mv-workload-management-status.md) and looking at `Queued Queries (from global queue)` & `Queued Queries (from local queue)` within the `Stat` and `Value` columns. `SELECT * FROM information_schema.WORKLOAD_MANAGEMENT_STATUS;`

3. Are queries blocked?

   * Check this by querying [information\_schema.MV\_BLOCKED\_QUERIES](https://docs.singlestore.com/db/v9.1/reference/information-schema-reference/management/mv-blocked-queries.md). `SELECT * FROM information_schema.MV_BLOCKED_QUERIES;`
   * Which query is blocked? Check the `QUERY_TEXT` column.
   * What is blocking it and where is it running? Check the `BLOCKING_NODE_ID` and `BLOCKING_QUERY_TEXT` columns.
   * Check the blocking reason by looking at the `BLOCKING_TYPE`
   * Kill the blocking query by using the `ID` column, which is the same as the `ID` in `information_schema.PROCESSLIST`, with `KILL QUERY <id>`.

4. If your queries are failing:

   * Is the queue depth too large? Query [MV\_PROCESSLIST](https://docs.singlestore.com/db/v9.1/reference/information-schema-reference/query-performance-workload-management-and-statistics/mv-processlist.md) to check this. `SELECT COUNT(*) FROM information_schema.MV_PROCESSLIST WHERE state = 'queued';`
   * Are these queries getting killed by the resource governor? Check resource the status of resource pools by querying [RESOURCE\_POOLS](https://docs.singlestore.com/db/v9.1/reference/information-schema-reference/resource-and-user-management/resource-pools.md). `SELECT * FROM information_schema.RESOURCE_POOLS;`&#x20;
   * Examine the failure errors from failed queries.

## Next Steps

* My queries are queued and waiting on resources: continue to [Step 4](https://docs.singlestore.com/db/v9.1/user-and-cluster-administration/troubleshooting/4-are-key-resources-being-overused.md).
* There are no queued, blocked, or hung queries: continue to [Step 4](https://docs.singlestore.com/db/v9.1/user-and-cluster-administration/troubleshooting/4-are-key-resources-being-overused.md).

***

Modified at: November 26, 2024

Source: [/db/v9.1/user-and-cluster-administration/troubleshooting/3-are-any-queries-waiting-on-something/](https://docs.singlestore.com/db/v9.1/user-and-cluster-administration/troubleshooting/3-are-any-queries-waiting-on-something/)

(An index of the documentation is available at /llms.txt)
