# 202: TOO_MANY_SIMULTANEOUS_QUERIES (code 202)

> The server already runs the max_concurrent_queries limit and rejected the new one.

Source: https://sqlly.app/errors/clickhouse/too-many-simultaneous-queries
Last updated: 2026-11-30
License: Text and data [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/) (credit SQLly, sqlly.app); code and SQL snippets [MIT](https://opensource.org/license/mit). [Details](https://sqlly.app/license).
Note: Quoted error message text belongs to its database vendor.

- Error code: `202`
- Name: `TOO_MANY_SIMULTANEOUS_QUERIES`
- Category: Resource limits

Error message:

```text
Too many simultaneous queries. Maximum: {max_queries}
```

## What it means

`TOO_MANY_SIMULTANEOUS_QUERIES` (202) means a concurrency cap was hit: either the server-wide `max_concurrent_queries` is full, or one user has reached `max_concurrent_queries_for_user`. Backfills, dashboards polling in a loop, or one slow query type piling up are typical. The right fix is finding the pile-up, not just raising the limit.

## Common causes

- A batch job fires more concurrent queries than the server can drain.
- A few very slow queries block the pool and everything else queues.
- The limit was set low for safety and real load outgrew it.

## How to fix it

1. See what is running right now and who holds the slots.

   ```sql
   SELECT query_id, user, elapsed, substring(query, 1, 80) AS q FROM system.processes ORDER BY elapsed DESC;
   ```
2. Cancel the pile-up of runaway queries.

   ```sql
   KILL QUERY WHERE elapsed > 600 AND user = 'batch_user';
   ```
3. Raise the server limit in config once capacity is confirmed.

   ```sql
   <max_concurrent_queries>200</max_concurrent_queries>
   ```

## Reproduce it safely

```sql
Start max_concurrent_queries+1 long SELECT sleep(10) sessions in parallel; the last one gets code 202 immediately.
```

## How SQLly helps

SQLly's activity monitor lets you kill a query straight from the list, which is how you find what filled the server's slots without shelling into the host.

## Questions

### Is 202 per user?

Code 202 is returned for both limits. The server-wide limit (max_concurrent_queries) says "Too many simultaneous queries. Maximum: {max}". The per-user limit (max_concurrent_queries_for_user) also returns 202, with "Too many simultaneous queries for user {user}. Current: N, maximum: M".

### Retry immediately?

Back off. The server is at capacity; retrying in a tight loop makes it worse. Use exponential backoff on 202.

## Related errors

- [`241`](https://sqlly.app/errors/clickhouse/memory-limit-exceeded): MEMORY_LIMIT_EXCEEDED (code 241)
- [`159`](https://sqlly.app/errors/clickhouse/timeout-exceeded): TIMEOUT_EXCEEDED (code 159)
- [`252`](https://sqlly.app/errors/clickhouse/too-many-parts): TOO_MANY_PARTS (code 252)

The code and message text are from the [ClickHouse documentation (system.errors)](https://clickhouse.com/docs/en/operations/system-tables/errors).
