ALTER USER SET MEMORY LIMIT reference
RBAC provides fine-grained database permissions management.
ALTER USER ... SET MEMORY LIMIT caps the native memory each of the user's
queries may allocate.
Syntax
ALTER USER userName SET MEMORY LIMIT { size | UNLIMITED };
Description
ALTER USER username SET MEMORY LIMIT sizecaps the native memory each of the user's queries may allocate.sizeis a byte count or a size with aK,M, orGsuffix, such as512Mor2G.ALTER USER username SET MEMORY LIMIT UNLIMITEDclears the user's own limit. A group limit or the workload limit (cairo.query.memory.limit.bytes) then applies.SET MEMORY LIMIT 0does the same.
The limit applies to the user's queries on both the primary and replicas.
Setting it requires the SET MEMORY LIMIT permission.
The built-in admin and external (SSO/OIDC) users cannot be given a limit; the statement is rejected for both. An external user inherits a limit from its groups instead.
A limit set here takes priority over the user's groups and over the
cairo.query.memory.limit.bytes
workload limit; see memory limits for how
limits resolve.
This is a per-query ceiling. To bound what a whole workload may hold at once instead, use a resource group.
Examples
-- cap the user's queries at 512 MiB of native memory
ALTER USER john SET MEMORY LIMIT 512M;
-- remove the limit
ALTER USER john SET MEMORY LIMIT UNLIMITED;
Use SHOW USERS to inspect the user's own or
inherited group limit in the memory_limit column.