Quotas in ClickHouse CloudQuotas are supported in ClickHouse Cloud but must be created using the DDL syntax. The XML configuration approach documented below is not supported.
- Place restrictions on a set of queries that can be run over a period of time, instead of limiting a single query.
- Account for resources spent on all remote servers for distributed query processing.
queries – The total number of requests.
query_selects – The total number of select requests.
query_inserts – The total number of insert requests.
errors – The number of queries that threw an exception.
result_rows – The total number of rows given as a result.
result_bytes - The total size of rows given as a result.
read_rows – The total number of source rows read from tables for running the query on all remote servers.
read_bytes - The total size read from tables for running the query on all remote servers.
written_bytes - The total size of a writing operation.
execution_time – The total query execution time, in seconds (wall time).
failed_sequential_authentications - The total number of sequential authentication errors.
queries_per_normalized_hash – The maximum number of executions of any single normalized query. Normalized queries are queries with literals replaced by placeholders, so SELECT 1 and SELECT 2 are considered the same normalized query. This limit is tracked per distinct normalized query pattern independently.
If the limit is exceeded for at least one time interval, an exception is thrown with a text about which restriction was exceeded, for which interval, and when the new interval begins (when queries can be sent again).
Quotas can use the “quota key” feature to report on resources for multiple keys independently. Here is an example of this:
SELECT number FROM numbers(1) and SELECT number FROM numbers(2) share the same bucket (because they have the same normalized form), but SELECT number, number FROM numbers(1) uses a separate bucket.
The quota is assigned to users in the ‘users’ section of the config. See the section “Access rights”.
For distributed query processing, the accumulated amounts are stored on the requestor server. So if the user goes to another server, the quota there will “start over”.
When the server is restarted, quotas are reset.