202: TOO_MANY_SIMULTANEOUS_QUERIES (code 202)
The server already runs the max_concurrent_queries limit and rejected the new one.
- 오류 코드
202- 이름
TOO_MANY_SIMULTANEOUS_QUERIES- 카테고리
- Resource limits
의미
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.
일반적인 원인
- 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.
Find the cause
`system.processes` for live queries, `system.query_log` grouped by user and minute to find the source of bursts, `system.metrics` metric `Query` for current concurrency.
해결 방법
-
See what is running right now and who holds the slots.
SELECT query_id, user, elapsed, substring(query, 1, 80) AS q FROM system.processes ORDER BY elapsed DESC;
-
Cancel the pile-up of runaway queries.
KILL QUERY WHERE elapsed > 600 AND user = 'batch_user';
-
Raise the server limit in config once capacity is confirmed.
<max_concurrent_queries>200</max_concurrent_queries>
Other ways to handle it
Throttle at the client or use a queue. max_concurrent_queries_for_user protects interactive users from one account monopolizing the server.
안전하게 재현하세요
Start max_concurrent_queries+1 long SELECT sleep(10) sessions in parallel; the last one gets code 202 immediately.
질문
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.
관련 오류
More resource limits errors
코드와 메시지 텍스트의 출처는 다음과 같습니다 ClickHouse documentation (system.errors). 전체 목록은 ClickHouse error list 또는 모든 데이터베이스 오류 검색.
Work on ClickHouse in SQLly
A native SQL client for macOS, Windows and Linux with schema-aware IntelliSense, guardrails for risky statements and clear error messages, for ClickHouse and the other databases you use.
이 페이지의 텍스트와 데이터: CC BY 4.0, 출처: SQLly (sqlly.app). 코드와 SQL 스니펫: MIT. 라이선스 세부 정보 인용된 오류 메시지 텍스트의 권리는 해당 데이터베이스 공급업체에 있습니다.