--- slug: /en/operations/quotas sidebar_position: 51 sidebar_label: Quotas title: Quotas --- Quotas allow you to limit resource usage over a period of time or track the use of resources. Quotas are set up in the user config, which is usually ‘users.xml’. The system also has a feature for limiting the complexity of a single query. See the section [Restrictions on query complexity](../operations/settings/query-complexity.md). In contrast to query complexity restrictions, quotas: - 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. Let’s look at the section of the ‘users.xml’ file that defines quotas. ``` xml 3600 0 0 0 0 0 0 0 ``` By default, the quota tracks resource consumption for each hour, without limiting usage. The resource consumption calculated for each interval is output to the server log after each request. ``` xml 3600 1000 100 100 100 1000000000 100000000000 900 86400 10000 10000 10000 1000 5000000000 500000000000 7200 ``` For the ‘statbox’ quota, restrictions are set for every hour and for every 24 hours (86,400 seconds). The time interval is counted, starting from an implementation-defined fixed moment in time. In other words, the 24-hour interval does not necessarily begin at midnight. When the interval ends, all collected values are cleared. For the next hour, the quota calculation starts over. Here are the amounts that can be restricted: `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. `read_rows` – The total number of source rows read from tables for running the query on all remote servers. `execution_time` – The total query execution time, in seconds (wall time). 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: ``` xml ``` 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.