ALTER QUOTA
更改配额。
语法
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
子句允许在集群上创建配额,请参阅 分布式 DDL。
示例
限制当前用户在 15 个月内最多查询 123 次
ALTER QUOTA IF EXISTS qA FOR INTERVAL 15 month MAX queries = 123 TO CURRENT_USER;
对于默认用户,限制在 30 分钟内最多执行时间为半秒,并限制在 5 个季度内最多查询 321 次和最多错误 10 次
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;