v.20.1Experimental Feature

Reworked Access Control Quotas and New SQL Functions Added

Reworked quotas as a part of access control system. Added new table system.quotas, new functions currentQuota, currentQuotaKey, new SQL syntax CREATE QUOTA, ALTER QUOTA, DROP QUOTA, SHOW QUOTA. #7257 (Vitaly Baranov)
Reworked the quota management system in ClickHouse by introducing a new system.quotas table, new functions currentQuota and currentQuotaKey, and new SQL syntax for quota operations including CREATE QUOTA, ALTER QUOTA, DROP QUOTA, and SHOW QUOTA.

Why it matters

This feature improves access control by providing a more flexible and powerful way to manage resource usage limits (quotas) in ClickHouse. It enables users to define, modify, and monitor quotas more easily and precisely, helping prevent resource overuse and ensuring fair usage across users and queries.

How to use it

Users can manage quotas using the new SQL commands: CREATE QUOTA to define a quota, ALTER QUOTA to modify an existing quota, DROP QUOTA to remove a quota, and SHOW QUOTA to list quotas. The system.quotas table provides insight into quota configurations, and functions currentQuota() and currentQuotaKey() can be used in queries to retrieve information about the currently applied quota and quota key.