Quotas

    The system also has a feature for limiting the complexity of a single query. See the section “Restrictions on query complexity”).

    In contrast to query complexity restrictions, quotas:

    Let’s look at the section of the ‘users.xml’ file that defines quotas.

    By default, the quota just 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.

    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 doesn’t necessarily begin at midnight.

    Here are the amounts that can be restricted:

    – The total number of requests.

    – The number of queries that threw an exception.

    – The total number of rows given as the result.

    – The total number of source rows read from tables for running the query, on all remote servers.

    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 in order to report on resources for multiple keys independently. Here is an example of this:

    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.