> ## Documentation Index
> Fetch the complete documentation index at: https://private-7c7dfe99-mintlify-fbfa8bee.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

> توثيق QUOTA

# ALTER QUOTA

يعدّل quotas.

الصيغة:

```sql theme={null}
ALTER QUOTA [IF EXISTS] name [ON CLUSTER cluster_name]
    [RENAME TO new_name]
    [KEYED BY {user_name | ip_address | forwarded_ip_address | client_key | client_key,user_name | client_key,ip_address | normalized_query_hash} | NOT KEYED]
    [IPV4_PREFIX_BITS number]
    [IPV6_PREFIX_BITS number]
    [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 | queries_per_normalized_hash} = number } [,...] |
        NO LIMITS | TRACKING ONLY} [,...]]
    [TO {role [,...] | ALL | ALL EXCEPT role [,...]}]
```

المفاتيح `user_name` و`ip_address` و`forwarded_ip_address` و`client_key` و`client_key, user_name` و`client_key, ip_address` و`normalized_query_hash` تقابل الحقول في جدول [system.quotas](/ar/reference/system-tables/quotas).

لا يمكن استخدام الخيارين `IPV4_PREFIX_BITS` و`IPV6_PREFIX_BITS` إلا عندما تكون قيمة `KEYED BY` هي `ip_address` أو `forwarded_ip_address`. وهما يقابلان الحقل في جدول [system.quotas](/ar/reference/system-tables/quotas).

المعلمات `queries` و`query_selects` و`query_inserts` و`errors` و`result_rows` و`result_bytes` و`read_rows` و`read_bytes` و`execution_time` و`queries_per_normalized_hash` تقابل الحقول في جدول [system.quotas\_usage](/ar/reference/system-tables/quotas_usage).

يتيح بند `ON CLUSTER` إنشاء حصص على عنقود، راجع [Distributed DDL](/ar/reference/statements/distributed-ddl).

**أمثلة**

قيّد الحد الأقصى لعدد الاستعلامات للمستخدم الحالي عند 123 استعلامًا ضمن قيد مدته 15 شهرًا:

```sql theme={null}
ALTER QUOTA IF EXISTS qA FOR INTERVAL 15 month MAX queries = 123 TO CURRENT_USER;
```

بالنسبة إلى المستخدم default، حدِّد الحد الأقصى لوقت التنفيذ بنصف ثانية خلال 30 دقيقة، وحدِّد الحد الأقصى لعدد الاستعلامات بـ 321 والحد الأقصى لعدد الأخطاء بـ 10 خلال 5 أرباع:

```sql theme={null}
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;
```
