Changes quotas.
Syntax:
ALTER QUOTA [IF EXISTS] name [ON CLUSTER cluster_name]
[RENAME TO new_name]
[KEYED BY {user_name | ip_address | client_key | client_key,user_name | client_key,ip_address} | NOT KEYED]
[FOR [RANDOMIZED] INTERVAL number {second | minute | hour | day | week | month | quarter | year}
{MAX { {queries | query_selects | query_inserts | errors | result_rows | result_bytes | read_rows | read_bytes | execution_time} = number } [,...] |
NO LIMITS | TRACKING ONLY} [,...]]
[TO {role [,...] | ALL | ALL EXCEPT role [,...]}]
键 user_name
、ip_address
、client_key
、client_key, user_name
和 client_key, ip_address
对应于 system.quotas 表中的字段。
参数 queries
、query_selects
、query_inserts
、errors
、result_rows
、result_bytes
、read_rows
、read_bytes
、execution_time
对应于 system.quotas_usage 表中的字段。
ON CLUSTER
子句允许在集群上创建配额,请参阅 Distributed DDL。
示例
限制当前用户在 15 个月内的最大查询数为 123 查询:
ALTER QUOTA IF EXISTS qA FOR INTERVAL 15 month MAX queries = 123 TO CURRENT_USER;
对于默认用户,限制 30 分钟内的最大执行时间为半秒,并限制查询的最大数量为 321,错误的最大数量为 10,在 5 个季度内:
ALTER QUOTA IF EXISTS qB FOR INTERVAL 30 minute MAX execution_time = 0.5, FOR INTERVAL 5 quarter MAX queries = 321, errors = 10 TO default;