For AI agents: the complete documentation index is at llms.txt. Every page is also available as markdown by appending .md to its URL, or by sending an Accept: text/markdown request header.

ALTER USER SET MEMORY LIMIT reference

Enterprise:

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 size caps the native memory each of the user's queries may allocate. size is a byte count or a size with a K, M, or G suffix, such as 512M or 2G.
  • ALTER USER username SET MEMORY LIMIT UNLIMITED clears the user's own limit. A group limit or the workload limit (cairo.query.memory.limit.bytes) then applies. SET MEMORY LIMIT 0 does 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.

See also​