Learn how to view, create, delete, and scale virtual warehouses.
Notes
Version compatibility: Only Hologres V2.0.4 and later versions support virtual warehouse instances. For earlier versions, contact technical support for an upgrade.
Instance limits: Each instance can host a maximum of 10 virtual warehouses. Each virtual warehouse must have resources between 32 CUs (Compute Units) and 512 CUs.
V3.0.10 and later: The maximum specification increased to 1024 CUs.
V3.0.27 and later: The maximum specification limit for a virtual warehouse was removed.
Default virtual warehouse: When you purchase a new virtual warehouse instance, a default virtual warehouse named
init_warehouseis automatically created. Each instance is limited to one default virtual warehouse. You cannot delete it, but you can modify its name and specifications. SQL commands cannot be used to stop or resume the default virtual warehouse. By default, all users have permission to use the default virtual warehouse.DDL statements: DDL statements can be executed on all virtual warehouses.
Resource isolation: Virtual warehouse instances do not support resource groups (to be deprecated). To isolate resources, create multiple virtual warehouses. For more information, see Manage resource groups (beta).
Billing: See Billing overview.
Create a virtual warehouse
Notes
Only Alibaba Cloud accounts or RAM users with Superuser permission for the instance can create virtual warehouses.
Creating a virtual warehouse is an asynchronous process that runs in the background. To confirm that the virtual warehouse is ready, use the
hg_get_warehouse_statusfunction to query its status.
Procedure
(Recommended) Use the UI
Log on to the Hologres console. In the top menu bar, select the region where your instance is located.
In the left menu, select Instances. Click your instance ID to access its details page.
In the left submenu, click Virtual Warehouse Management and go to the Virtual Warehouse Resource Management tab.
Click Create Virtual Warehouse. In the dialog, configure the following parameters and click OK.
Parameter
Description
Virtual Warehouse Name
The name of the virtual warehouse to create.
Single-cluster Specs
The resources reserved for each cluster in the virtual warehouse.
Reserved Clusters
The initial number of clusters in the virtual warehouse. The compute resources for these reserved clusters are obtained from the Instance's reserved resources.
For more information, see Overview of resource scalability.
Use SQL commands
Syntax
CALL hg_create_warehouse ('<warehouse_name>', <cu>);Parameters
Parameter
Type
Description
warehouse_name
TEXT
The name of the new virtual warehouse. Naming conventions:
Must contain only digits, letters, and underscores.
Must be no more than 127 characters long.
cu
INTEGER
The number of CUs for the virtual warehouse.
Maximum value: 512.
Minimum value: 32.
Must be a multiple of 16.
Delete a virtual warehouse
Notes
Only Alibaba Cloud accounts or RAM users with Superuser permission for the instance can delete virtual warehouses.
You cannot delete the default virtual warehouse of an instance.
You cannot use SQL commands to delete the leader virtual warehouse of a Table Group.
Deleting a virtual warehouse is an asynchronous process that runs in the background. To confirm that it has been deleted, use the
hg_get_warehouse_statusfunction to query the status of the virtual warehouse.
Procedure
(Recommended) Use the UI
Log on to the Hologres console. In the top menu bar, select the region where your instance is located.
In the left menu, select Instances. Click your instance ID to access its details page.
In the left submenu, click Virtual Warehouse Management and go to the Virtual Warehouse Resource Management tab.
In the Actions column of the target virtual warehouse, click Stop and confirm the action.
After the virtual warehouse is stopped, click, click Delete in the Actions column to delete it.
Use SQL commands
Syntax
CALL hg_drop_warehouse ('<warehouse_name>');Parameters
Parameter
Type
Description
warehouse_name
TEXT
The name of the virtual warehouse to delete.
Scale a virtual warehouse
Permissions
Before V3.0.28, only Alibaba Cloud accounts or RAM Users could scale virtual warehouses. Starting from V3.0.28, RAM roles can also perform this operation.
To scale a virtual warehouse, you must have the following permissions:
RAM role permissions:
AliyunHologresWarehouseFullAccessorAliyunHologresFullAccess.Superuser permission within the instance.
For information about elastic scaling for virtual warehouses, see Overview of resource scalability.
Scale up a virtual warehouse
Notes
Before scaling up a virtual warehouse, ensure your instance has sufficient unallocated resources by scaling it up first in the console. Adjusting instance resources will trigger the startup of new pods; these pods do not load shard metadata or participate in computations, and scaling the instance does not impact ongoing queries or writes.
Once the instance is scaled up and has adequate unallocated resources, these resources can be used to scale up the virtual warehouse. Instances lacking sufficient unallocated resources cannot support virtual warehouse scale-ups.
Automatic rebalancing: Starting from Hologres V2.2, when a virtual warehouse has empty pods after scaling, Hologres automatically performs a rebalance to load shard metadata onto these new pods. The newly allocated resources become available for use upon rebalance completion. For earlier versions, you must manually perform a rebalance after scaling up a virtual warehouse.
Rebalance impact: Rebalancing will interrupt reads and writes for about 15 seconds. Starting from Hologres V3.0.28, rebalancing is downtime-free, but associated Flink jobs may fail over.
NoteDuring a scale-up, multi-row DML transactions are still interrupted. This includes DML transactions with the
hg_experimental_enable_transactionparameter explicitly enabled, native INSERT OVERWRITE statements, and incremental refreshes for Dynamic Tables.
Procedure
(Recommended) Use the UI
Log on to the Hologres console. In the top menu bar, select the region where your instance is located.
In the left menu, select Instances. Click your instance ID to access its details page.
In the left submenu, click Virtual Warehouse Management and go to the Virtual Warehouse Resource Management tab.
In the Actions column of the target virtual warehouse, click Modify Configuration. Increase the value of Single-cluster Specs and click OK.
(Optional) Click Rebalance in the Actions column to redistribute shards to newly added pods.
Use SQL commands
Scale up a virtual warehouse:
CALL hg_alter_warehouse ('<warehouse_name>',<cu>);Parameters:
Parameter
Type
Description
warehouse_name
TEXT
The name of the virtual warehouse to modify.
cu
INTEGER
The target number of CUs for the virtual warehouse.
Maximum value: 512.
Minimum value: 32.
Must be a multiple of 16.
Query the status of the virtual warehouse.
The scaling process is asynchronous. To confirm that the operation is complete, use the
hg_get_warehouse_statusfunction:select hg_get_warehouse_status('<warehouse_name>');When the function returns
Running, the virtual warehouse is in the running status, ready for further operations.Rebalance shards.
Rebalance shards on the scaled-up virtual warehouse.
SELECT hg_rebalance_warehouse ('<warehouse_name>');Query the rebalance progress.
The rebalance process is asynchronous. To confirm completion, query its status.
Use the
hg_get_rebalance_warehouse_statusfunction:SELECT hg_get_rebalance_warehouse_status ('<warehouse_name>');When the function returns
DOING, rebalancing is in progress;DONEindicates rebalancing has finished.Use the
hg_wait_until_rebalance_warehouse_donefunction to return a result when the virtual warehouse is in theRunningstatus:select hg_wait_until_rebalance_warehouse_done('<warehouse_name>',<timeout_seconds>);The
timeout_secondsparameter is optional and specifies the timeout period in seconds. When the function returnsDONE, rebalancing has finished.
Example: Use the following SQL statements to scale up the read_warehouse_1 virtual warehouse to 64 CUs.
-- Increase the resources of the virtual warehouse
CALL hg_alter_warehouse ('read_warehouse_1',64);
-- Wait for the virtual warehouse to finish scaling up
SELECT wait_until_warehouse_running ('read_warehouse_1');
-- Rebalance the shards
SELECT hg_rebalance_warehouse ('read_warehouse_1');
-- Wait for the rebalance to complete
SELECT hg_wait_until_rebalance_warehouse_done ('read_warehouse_1');Scale down a virtual warehouse
Notes
When scaling down a virtual warehouse, Hologres first migrates shards from the pods being decommissioned to active pods. Impact:
Before Hologres V3.1: Scale-downs will interrupt reads and writes on affected shards for about 15 seconds. Extra pods are decommissioned after the rebalancing process.
(Beta) Hologres V3.1+: Scale-downs will not interrupt major queries and writes. Connections to pods being decommissioned will experience a brief, second-level disconnection, and associated Flink jobs may fail over. However, long-running operations (over 60 minutes) that are active when the scale-down begins will fail 60 minutes after the scale-down begins.
NoteDuring a scale-down, multi-row DML transactions are still interrupted. This includes DML transactions with the
hg_experimental_enable_transactionparameter explicitly enabled, native INSERT OVERWRITE statements, and incremental refreshes for Dynamic Tables.After the scale-down, the released resources are returned to the instance's unallocated resource pool. These resources can then be used to create new virtual warehouses or scale up other existing ones. Alternatively, you can release these resources by scaling down the instance itself.
Procedure
(Recommended) Use the UI
Follow the steps in Scale up a virtual warehouse, but decrease the Single-cluster Specs.
Use SQL commands
Scale down the virtual warehouse.
CALL hg_alter_warehouse ('<warehouse_name>',<cu>);Parameters
Parameter
Type
Description
warehouse_name
TEXT
The name of the virtual warehouse to scale.
cu
INTEGER
The target number of CUs for the virtual warehouse.
Maximum value: 512.
Minimum value: 32.
Must be a multiple of 16.
Query the status of the virtual warehouse.
The scale-down process is asynchronous. To confirm that the operation is complete, use the
hg_get_warehouse_statusfunction.select hg_get_warehouse_status('<warehouse_name>');If the scale-down has finished, the function returns
Running.
Scale out a virtual warehouse (Add clusters)
Usage notes
See the "Notes" section for Scale up a virtual warehouse.
Procedure
Log on to the Hologres console. In the top menu bar, select the region where your instance is located.
In the left menu, select Instances. Click your instance ID to access its details page.
In the left submenu, click Virtual Warehouse Management and go to the Virtual Warehouse Resource Management tab.
In the Actions column of the target virtual warehouse, click Modify Configuration, increase Reserved Clusters, and click OK.
Scale in a virtual warehouse (Reduce clusters)
Notes
See the "Notes" section for Scale down a virtual warehouse.
Procedure
Log on to the Hologres console. In the top menu bar, select the region where your instance is located.
In the left menu, select Instances. Click your instance ID to access its details page.
In the left submenu, click Virtual Warehouse Management and go to the Virtual Warehouse Resource Management tab.
In the Actions column of the target virtual warehouse, click Adjust Configuration, decrease Reserved Clusters, and click OK.
O&M
View virtual warehouses
Commands
The
hologres.hg_warehousessystem view stores information about all virtual warehouses in the current Instance.SELECT * FROM hologres.hg_warehouses;View the current virtual warehouse:
SELECT current_warehouse();
Parameters
The
hologres.hg_warehousessystem view includes the following fields:Field
Type
Description
Example
warehouse_id
INTEGER
The unique ID of the virtual warehouse.
1warehouse_name
TEXT
The name of the virtual warehouse.
init_warehousecpu
INTEGER
The vCPUs of the virtual warehouse.
32mem
INTEGER
The memory of the virtual warehouse in GB.
128cluster_min_count
INTEGER
The minimum number of clusters for the virtual warehouse.
1cluster_max_count
INTEGER
The maximum number of clusters for the virtual warehouse.
1target_status
INTEGER
The final status of the virtual warehouse. Due to asynchronous status updates, this field reflects the target status. Possible values:
1: Running
2: Manually stopped
1status
INTEGER
The current status of the virtual warehouse. States are:
0: Initializing
1: Running
2: Manually stopped
3: Processing failed. Check the
status_detailfield for the cause of failure.4: Processing
1status_detail
TEXT
Details about the virtual warehouse's status.
is_default
BOOLEAN
Indicates whether this is the default virtual warehouse.
t: True
f: False
tconfig
TEXT
The configuration of the virtual warehouse.
comment
TEXT
Comments for the virtual warehouse.
Stop a virtual warehouse
Notes
You need Superuser permission for the instance to stop a virtual warehouse.
The leader virtual warehouse for a Table Group cannot be stopped.
Stopping a virtual warehouse is an asynchronous process. To confirm the operation is complete, use the
hg_get_warehouse_statusfunction to query its status.
Procedure
(Recommended) Use the UI
Log on to the Hologres console. In the top menu bar, select the region where your instance is located.
In the left menu, select Instances. Click your instance ID to access its details page.
In the left submenu, click Virtual Warehouse Management and go to the Virtual Warehouse Resource Management tab.
In the Actions column of the target virtual warehouse, click Stop.
Use SQL commands
Syntax
CALL hg_suspend_warehouse ('<warehouse_name>');Parameters
Parameter
Type
Description
warehouse_name
TEXT
The name of the virtual warehouse to stop.
Resume a virtual warehouse
Notes
You need Superuser permission for the instance to resume a virtual warehouse.
Resuming a virtual warehouse is an asynchronous process. To confirm the operation is complete, use the
hg_get_warehouse_statusfunction to query its status.
Procedure
(Recommended) Use the UI
Log on to the Hologres console. In the top menu bar, select the region where your instance is located.
In the left menu, select Instances. Click your instance ID to access its details page.
In the left submenu, click Virtual Warehouse Management and go to the Virtual Warehouse Resource Management tab.
In the Actions column of the target virtual warehouse, click Start.
SQL command
Syntax
CALL hg_resume_warehouse ('<warehouse_name>');Parameters
Parameter
Type
Description
warehouse_name
TEXT
The name of the virtual warehouse to resume.
Restart a virtual warehouse
Precautions
You need Superuser Permission for the Instance to restart a virtual warehouse.
Restarting a virtual warehouse is an asynchronous process. To confirm the operation is complete, use the
hg_get_warehouse_statusfunction to query its status.
Procedure
(Recommended) Use the UI
Log on to the Hologres console. In the top menu bar, select the region where your instance is located.
In the left menu, select Instances. Click your instance ID to access its details page.
In the left submenu, click Virtual Warehouse Management and go to the Virtual Warehouse Resource Management tab.
In the Operation column of the target virtual warehouse, click Restart and confirm the action.
SQL command
Syntax
CALL hg_restart_warehouse('<warehouse_name>');Parameters
Parameter
Type
Description
warehouse_name
TEXT
The name of the virtual warehouse to restart.
Get virtual warehouse status
Syntax
Get the current status of a virtual warehouse:
select hg_get_warehouse_status('<warehouse_name>');Operations like creating or scaling a virtual warehouse are asynchronous. Use the
wait_until_warehouse_runningfunction to wait for the virtual warehouse to reachRunningand return a result:select wait_until_warehouse_running('<warehouse_name>',<timeout_seconds>);
Parameters
Parameter
Type
Description
warehouse_name
TEXT
The name of the virtual warehouse.
timeout_seconds
INTEGER
Optional. The timeout period in seconds.
Example
The following example scales up a virtual warehouse before importing data and scales it down afterward.
-- Scale up warehouse_1 to 64 CUs. CALL hg_alter_warehouse ('warehouse_1',64); -- Wait for warehouse_1 to finish scaling up. SELECT wait_until_warehouse_running('warehouse_1'); -- Write data. INSERT INTO res_data SELECT * FROM org_data; -- Scale down warehouse_1 to 32 CUs. CALL hg_alter_warehouse ('warehouse_1',32);
Rename a virtual warehouse
Notes
You need Superuser permission for the instance to rename a virtual warehouse.
Procedure
(Recommended) Use the UI
Log on to the Hologres console. In the top menu bar, select the region where your instance is located.
In the left menu, select Instances. Click your instance ID to access its details page.
In the left submenu, click Virtual Warehouse Management and go to the Virtual Warehouse Resource Management tab.
Find the target virtual warehouse, and click the
icon after its name.
Use SQL commands
Syntax
CALL hg_rename_warehouse('<org_warehouse_name>','<new_warehouse_name>');Parameters
Parameter
Type
Description
org_warehouse_name
TEXT
The current name of the virtual warehouse.
new_warehouse_name
TEXT
The new name for the virtual warehouse.
Advanced operations
Rebalance a virtual warehouse
During runtime, the Worker Nodes of each Hologres virtual warehouse evenly load the shard metadata. However, in some scenarios, such as after a fast recovery or a scale-up operation, shards may become unevenly distributed across the Worker Nodes. You can then trigger a rebalance to redistribute the data shards evenly across the Worker Nodes.
Permissions
You need Superuser permission for the instance to trigger a rebalance.
Notes
V2.1 onwards: Hologres automatically initiates a rebalance for virtual warehouses that have no Shards loaded on their Worker Nodes.
V2.2 onwards: Hologres now supports automatic retries for
SELECTqueries during virtual warehouse rebalancing. This feature enables queries to complete with a minor increase in execution time, preventing failures such asERROR: fail to execute query internal error: Get rundown is not allowed in recovering state.
Syntax
SELECT hg_rebalance_warehouse ('<warehouse_name>');Parameters
Parameter
Type
Description
warehouse_name
TEXT
The name of the virtual warehouse to rebalance.
Return values
After you trigger a rebalance, Hologres returns one of the following results:
true: The rebalance was triggered successfully.false: Rebalancing is not needed.Error: Failed to trigger rebalancing due to causes such as faulty pods.
NoteDuring a rebalance, Hologres assesses the need for redistribution and aims for optimal shard distribution. Specifically, the number of shards on any two Worker Nodes will not differ by more than one. For instance:
With 2 Worker Nodes and 2 shards, each node receives 1 shard.
With 2 Worker Nodes and 3 shards, one node receives 1 shard, and the other receives 2.
Rebalancing typically takes 2 to 3 minutes, with duration increasing based on the number of loaded Table Groups. Writes are interrupted for about 15 seconds during this process.
Rebalancing is an asynchronous process. Check its progress using this SQL command:
SELECT hg_get_rebalance_warehouse_status('<warehouse_name>');This command returns
DOINGto indicate rebalancing is in progress;DONEindicates rebalancing is complete.
Set the timeout duration for a virtual warehouse
Timeout durations can be configured at the session, database, or virtual warehouse level using the statement_timeout parameter. For details, see GUC parameters.
The virtual warehouse-level timeout setting has lower priority than session-level or database-level configs. To ensure it takes effect, first remove any existing database-level timeout setting.
-- Disable the database-level timeout setting.
ALTER DATABASE <db_name> RESET statement_timeout;
-- Set the timeout duration for the virtual warehouse to 600s.
CALL hg_alter_warehouse ('<warehouse_name>', <cu>, '{"configs":{"gucs":{"statement_timeout":"600000"}}}');