Thresholds and Rate Limits
Group thresholds protect your databases from queries that run too long or are called too often. The owner and the editors set the group's values in Group settings → Thresholds, each with its SET button. A new query starts with the group's values; change them for one query in its settings in the editor (Thresholds).
Slow-query threshold
The slow-query threshold is a duration (in seconds). When a run of a query
takes at least this long, Kvery tags the query with a _slow-query tag that shows
the run time (the tag keeps the longest run), so you can spot and optimise problem
queries; the logs show the run time of every logged run. The default
threshold is 30 seconds. The group's value is the default for its new queries,
and every query can override it in its own settings; a query whose value is 0 or
empty uses the group's value.
Use this to surface queries that need an index, a LIMIT, or a rewrite — before
they affect your production database.
Rate limit
The rate limit caps how many times a query can be called through its public API within a time window, so a public endpoint cannot be called far more often than intended. It is counted separately for every query and every caller (client IP address; an IPv6 address counts by its /64 network). Opening the query through its shared link or a shared dashboard, running it in Kvery itself as a member of its group, scheduled runs and the MCP server and its REST API — which has its own per-user and per-IP limits — are not limited by it.
You configure:
- The maximum number of requests allowed.
- The window (in seconds) over which that maximum applies.
The group's values are the defaults for its new queries, and every query can
override them in its own settings. A value of 0 switches the limit off.
The window starts with the first request. When the maximum is reached, further
requests are answered with HTTP 429 Too Many Requests, a Retry-After header and
the body {"status": 0, "response": "Rate limit exceeded. Try again later."} until
the window ends; then a new window starts. Every counted request gets the headers
X-RateLimit-Limit, X-RateLimit-Remaining and X-RateLimit-Reset. An answer from
the result cache counts too. A POST, PUT,
PATCH or DELETE call with several rows in its body runs the query once per row,
and every row counts as a request: when the limit is reached in the middle of such
a call, the rows before have run and the call is answered with the 429. Requests
that stay within the limit are never rejected. By default the rate limit is off
(no cap); set it explicitly to enforce one.
Choosing good values
- Start the slow-query threshold near your acceptable response time, then lower it as you optimise.
- Set a rate limit on any group that exposes public API endpoints, sized to your expected legitimate traffic plus headroom.
- Look for the
_slow-querytag on your queries, and sort the logs by the time column, to see which queries trip the slow-query threshold.