Hologres supports executing tasks with serverless computing resources. Available serverless resources are limited at both the instance and SQL levels. This topic describes the resource limits for serverless computing and explains how to manage serverless resources for your SQL queries.
Serverless resource quota
Serverless resource quota is the maximum amount of serverless resources a Hologres instance can request. This quota is determined by the instance's dedicated computing resources. The table below outlines this relationship.
Dedicated resources (CUs) | Serverless resource quota |
Less than 32 CUs | Serverless Computing is not supported. |
32 CUs to 688 CUs | The quota is 3 times the instance's dedicated computing resources. For example, an instance with 32 dedicated CUs has a quota of 32 * 3 = 96 CUs. Starting with Hologres v3.0.33, the quota increases to 5 times the instance's dedicated computing resources, capped at 2048 CUs. This cap is raised to 4096 CUs starting with v3.1.9. |
688 CUs or more | The quota is capped at 2048 CUs. This cap increases to 4096 CUs starting with v3.1.9. |
The serverless resource quota is the maximum concurrent serverless resources that all active SQL queries (in the
EXECUTEstate) can use on an instance.The serverless resource pool in each zone is shared by all instances within that zone.
If an instance's serverless resource quota is exceeded or the serverless resource pool in the zone is exhausted, new SQL queries are queued (entering the
QUEUEstate) until serverless resources become available.
Set serverless resources for SQL queries
SQL query resource allocation is determined by the minimum of the three factors in the table below. Resources are requested in 15 CU increments.
Factor (Parameter) | Description |
Resource quota | The maximum serverless computing resources a Hologres instance can use. |
Max resources ( | Specifies the upper limit of serverless resources allocatable to any single SQL query. This parameter is configurable. Default value:
|
Required resources ( | The serverless resources that Hologres estimates a SQL query requires. The default value of |
Set max resources
Run the following statement to set the upper limit of serverless resources for a single SQL query.
To ensure adequate resources for SQL execution, avoid changing this parameter. If you must change it, perform thorough testing first.
-- Set the maximum CUs to allocate for a single serverless computing task. Default: 512.
SET hg_experimental_serverless_computing_max_cores = 512;
-- Reset the configuration.
reset hg_experimental_serverless_computing_max_cores;Example:
-- Enable serverless computing for the query.
SET hg_computing_resource = 'serverless';
-- Set the maximum CUs for a single SQL query to 32.
SET hg_experimental_serverless_computing_max_cores = 32;
-- Execute the SQL query.
INSERT INTO sink_tbl SELECT * FROM source_tbl;
-- Reset the configuration.
reset hg_computing_resource;
reset hg_experimental_serverless_computing_max_cores;Set required resources
By default, Hologres automatically estimates the required resources for a query based on its complexity. This automatic estimation provides a balance between resource utilization and query execution time.
To improve a query's performance by allocating more serverless resources, run the following statement.
We do not recommend changing this parameter. Allocating too few resources can cause an OOM error. If you must change it, perform thorough testing first.
To ensure stability, if this parameter is manually specified, Hologres will use the greater of your specified value or 50% of its own estimate.
-- The default value of 0 enables automatic resource estimation.
SET hg_experimental_serverless_computing_required_cores = XX;
-- Reset the configuration.
reset hg_experimental_serverless_computing_required_cores;Example:
-- Enable serverless computing for the query.
SET hg_computing_resource = 'serverless';
-- Manually request 96 CUs. Actual requested resources is max (96, Hologres' estimate * 0.5)
SET hg_experimental_serverless_computing_required_cores = 96;
-- Execute the SQL query.
INSERT INTO sink_tbl SELECT * FROM source_tbl;
-- Reset the configuration.
reset hg_computing_resource;
reset hg_experimental_serverless_computing_required_cores;Adjust automatic estimation strategy
If the automatic resource estimation is consistently inaccurate, adjust the estimation strategy by modifying the hg_experimental_serverless_computing_resource_allocation_ratio parameter.
The default value is
4, which represents a neutral strategy.If Hologres consistently underestimates resources, increase this value. For example, setting it to
8doubles the estimated resources (e.g., a 60 CU estimate becomes 120 CUs).If Hologres consistently overestimates resources, decrease this value. For example, setting it to
2halves the estimated resources (e.g., a 60 CU estimate becomes 30 CUs).
-- Modify at the SQL level
SET hg_experimental_serverless_computing_resource_allocation_ratio = 4;
-- Modify at the user level
ALTER USER "<role_name>" IN DATABASE <db_name> SET hg_experimental_serverless_computing_resource_allocation_ratio = 4;
-- Modify at the DB level
ALTER DATABASE <db_name> SET hg_experimental_serverless_computing_resource_allocation_ratio = 4;