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.

CREATE RESOURCE GROUP reference

Enterprise:

Resource groups isolate competing query workloads inside a single QuestDB instance.

CREATE RESOURCE GROUP creates a query workload policy.

For what the limits actually guarantee, see resource groups.


Syntax​

CREATE RESOURCE GROUP [IF NOT EXISTS] groupName
[WITH ( parameter = value [, parameter = value ...] )];

Parameters​

Every parameter is optional. An unset parameter falls back to the instance default, which is not always "unlimited":

ParameterAccepted valuesUnset behaviour
cpu_weightinteger, 1 to 10000100
max_active_queriesinteger, 1 or moreunlimited
max_queued_queriesinteger, 0 or moreunlimited
queue_timeoutwhole milliseconds, or a duration such as '15s' or '2m'30 seconds
memory_limita byte size such as '8G', or 0 or UNLIMITED for no group ceilingno group ceiling

Description​

CREATE RESOURCE GROUP adds a policy with no principals mapped to it. Creating the group alone changes nothing: map a user, ACL group or service account to it with ALTER USER, ALTER GROUP or ALTER SERVICE ACCOUNT before it governs anything.

The name must be unique across resource groups. If it is already taken the statement fails, unless IF NOT EXISTS is included.

The statement requires the RESOURCE GROUP ADMIN permission.

Creating a second resource group engages CPU scheduling for the whole instance. While DEFAULT is the only group there is no CPU slicing at all, so weights have no effect until a second group exists. See when scheduling engages.

A group ceiling only ever lowers what a query may use. memory_limit is capped by resource.groups.process.memory.limit.bytes, and it never raises a limit set on the principal or by cairo.query.memory.limit.bytes.

Examples​

A policy with no limits of its own
CREATE RESOURCE GROUP analytics;
Half the default CPU share, four concurrent queries, 2 GiB
CREATE RESOURCE GROUP reporting WITH (
cpu_weight = 50,
max_active_queries = 4,
memory_limit = '2G'
);
A background workload that yields to everything else
CREATE RESOURCE GROUP IF NOT EXISTS exports WITH (
cpu_weight = 10,
max_active_queries = 1
);

Verify with resource_groups():

SELECT name, cpu_weight, max_active_queries, memory_limit_bytes
FROM resource_groups()
ORDER BY name;
namecpu_weightmax_active_queriesmemory_limit_bytes
DEFAULT100null0
analytics100null0
exports1010
reporting5042147483648

max_active_queries is null when the group sets no admission limit, and memory_limit_bytes is 0 when it sets no memory ceiling. cpu_weight always reports an effective value, so a group that sets none shows 100.

See also​