All Products
Search
Document Center

Hologres:Manage data permissions

Last Updated:Nov 05, 2025

This topic describes how to grant virtual warehouses the permissions to access data.

Usage notes

  • If you use virtual warehouse A to create a table group, Virtual Warehouse A is used as the primary virtual warehouse of the table group by default.

  • Memory status is automatically synchronized across virtual warehouses in milliseconds in real time. When you use a primary virtual warehouse to write data, the system automatically synchronizes data in the memory of the primary virtual warehouse to the secondary virtual warehouses. A small amount of CPU and memory overheads are generated for secondary virtual warehouses. We recommend that specification differences among virtual warehouses be no more than four times.

  • If you want to write data to foreign tables, you can only use the default virtual warehouse of a virtual warehouse instance.

  • In Hologres V2.0, virtual warehouse support for read/write tasks are as follows:

    • Secondary virtual warehouse can only handle data reads on loaded table groups.

    • Primary virtual warehouses can handle reads/writes on loaded table groups.

    • Virtual warehouses cannot read/write data on unloaded table groups.

  • After the architectural upgrade in Hologres V4.0, virtual warehouse instances offer enhanced read/write task support:

    • To leverage this upgraded architecture, enable the GUC parameter hg_warehouse_enable_use_local_resource. For more information, see GUC parameters.

    • Virtual warehouses can now perform read/write tasks on unloaded table groups, provided these tasks are not optimized by a Fixed Plan.

    • For read/write tasks that support Fixed Plans, see Accelerate the execution of SQL statements by using fixed plans.

    • Batch and real-time writes can be automatically routed to the primary virtual warehouse for execution.

Task / Virtual warehouse type

Primary virtual warehouse

Secondary virtual warehouse

Other virtual warehouse
(table group not loaded)

Real-time write
(Fixed Plan accelerated)

Supported

Unsupported

Unsupported

Batch write
(not Fixed Plan accelerated)

Supported

Supported (V4.0+)
(Requires enabling hg_warehouse_enable_use_local_resource)

Supported (V4.0+)
(Requires enabling hg_warehouse_enable_use_local_resource)

Point query, PrefixScan
(Fixed Plan accelerated)

Supported

Supported

Unsupported

Other read task
(not Fixed Plan accelerated)

Supported

Supported

Supported (V4.0+)
(Requires enabling hg_warehouse_enable_use_local_resource)

View permissions on loaded table groups

  • Syntax

    Execute the following SQL statement to view permissions on all loaded table groups in the connected instance:

    SELECT * FROM hologres.hg_warehouse_table_groups;
  • Fields

    The following table describes fields in the hg_warehouse_table_groups table.

    Field

    Data type

    Description

    Example

    warehouse_name

    TEXT

    The name of the virtual warehouse.

    init_warehouse

    warehouse_id

    INTEGER

    The unique ID of the virtual warehouse.

    1

    database_name

    TEXT

    The name of the database.

    wh_demo

    tablegroup_name

    TEXT

    The name of the table group.

    wh_demo_tg_default

    leader

    BOOLEAN

    Specifies whether the virtual warehouse is the primary virtual warehouse of the table group.

    t

    replica_count

    INTEGER

    The number of replicas.

    1

Set a secondary virtual warehouse

  • To set a secondary virtual warehouse for a table group, load the table group to the virtual warehouse.

    • You can perform operations on shards in a table group by using a virtual warehouse only after the table group is loaded to the virtual warehouse.

    • Only users with the superuser role have the permission to load a table group to a virtual warehouse.

  • Syntax

    CALL hg_table_group_load_to_warehouse ('<database_name>.<table_group_name>', '<warehouse_name>', <replica_count>);
  • Parameters

    Parameter

    Data type

    Description

    database_name

    TEXT

    The name of the database.

    table_group_name

    TEXT

    The name of the table group.

    warehouse_name

    TEXT

    The name of the virtual warehouse to which you want to load a table group.

    replica_count

    INTEGER

    The number of replicas. Default value: 1. This parameter is optional.

  • Examples

    -- Load the table group table_group_1 in the database db1 to the virtual warehouse warehouse_1 and set the number of replicas to 1.
    CALL hg_table_group_load_to_warehouse ('db1.table_group_1', 'warehouse_1');
    -- Load the table group table_group_1 in the database db1 to the virtual warehouse warehouse_1, and set the number of replicas to 2.
    CALL hg_table_group_load_to_warehouse ('db1.table_group_1', 'warehouse_1',2);

Configure a primary virtual warehouse

  • Usage notes

    • DML operations, such as data writes, on shards in a table group can be performed only by using the primary virtual warehouse of the table group.

    • Only one primary virtual warehouse can be configured for a table group. When you modify the primary virtual warehouse of a table group, the primary virtual warehouse will be restarted. Take note of the impact on your business.

    • Only users with the superuser role can configure a primary virtual warehouse for a table group.

  • Syntax

    CALL hg_table_group_set_leader_warehouse ('<database_name>.<table_group_name>', '<warehouse_name>');
  • Parameters

    Parameter

    Data type

    Description

    database_name

    TEXT

    The name of the database.

    table_group_name

    TEXT

    The name of the table group.

    warehouse_name

    TEXT

    The name of the virtual warehouse that you want to configure as the primary virtual warehouse.

Unload a table group from a virtual warehouse

  • Usage notes

    • Only users with the superuser role can unload a table group from a virtual warehouse.

    • You cannot unload a table group from its primar y virtual warehouse. If you want to unload it, change the primary virtual warehouse.

  • Syntax

    CALL hg_table_group_unload_from_warehouse ('<database_name>.<table_group_name>', '<warehouse_name>');
  • Parameters

    Parameter

    Data type

    Description

    database_name

    TEXT

    The name of the database.

    table_group_name

    TEXT

    The name of the table group.

    warehouse_name

    TEXT

    The name of the virtual warehouse from which you want to unload a table group.

Modify the number of replicas for a loaded table group

  • Usage notes

    Only users with the superuser role have the permission to modify the number of replicas for a table group that is loaded to a virtual warehouse.

  • Syntax

    CALL hg_table_group_set_warehouse_replica_count ('<database_name>.<table_group_name>', <replica_count>,'<warehouse_name>');
  • Parameters

    Parameter

    Data type

    Description

    database_name

    TEXT

    The name of the database.

    table_group_name

    TEXT

    The name of the table group.

    replica_count

    INTEGER

    The number of replicas.

    warehouse_name

    TEXT

    The name of the virtual warehouse to which the table group is loaded. You want to change the number of replicas for the table group.

Manage automatic routing of DML statements to the primary virtual warehouse (beta)

  • Usage notes

    Only one primary virtual warehouse can be configured for a table group. DML operations on a table group can be performed only by using the primary virtual warehouse of the table group. In Hologres V2.2 and later, DML statements are automatically routed to the primary virtual warehouse of the table group. After you enable this feature, the primary virtual warehouse is automatically used for data writes. However, metrics related to data writes, such as the queries per second (QPS), are calculated for secondary virtual warehouses.

    Note

    After you enable the execution of multiple DML statements in a transaction, automatic routing of DML statements to the primary virtual warehouse is not supported. For more information about the execution of multiple DML statements in a transaction, see SQL transaction capabilities.

  • Enable or disable automatic routing of DML statements to the primary virtual warehouse

    You can use the GUC parameter at the session or database level to specify whether to enable automatic routing of DML statements to the primary virtual warehouse.

    Note

    By default, the GUC parameter hg_experimental_enable_warehouse_dml_auto_routing is set to ON.

    • Session level

      -- Enable automatic routing of DML statements to the primary virtual warehouse.
      SET hg_experimental_enable_warehouse_dml_auto_routing = ON;
      
      -- Disable automatic routing of DML statements to the primary virtual warehouse.
      SET hg_experimental_enable_warehouse_dml_auto_routing = OFF;
    • Database level

      -- Enable automatic routing of DML statements to the primary virtual warehouse.
      ALTER DATABASE <database_name> SET hg_experimental_enable_warehouse_dml_auto_routing = ON;
      
      -- Disable automatic routing of DML statements to the primary virtual warehouse.
      ALTER DATABASE <database_name> SET hg_experimental_enable_warehouse_dml_auto_routing = OFF;

      Parameters

      Parameter

      Data type

      Description

      database_name

      TEXT

      The name of the metadatabase.

  • Example

    1. Log on to the HoloWeb console. For more information, see Connect to HoloWeb and perform queries.

    2. In the top navigation bar, click Security Center.

    3. On the Security Center tab, click Compute Group Management in the left-side navigation pane.

    4. On the Management on Resources in Virtual Warehouses tab, click Create Compute Group to create a virtual warehouse named read_wh1.

      Note

      You can create up to 10 virtual warehouses in an instance. Each virtual warehouse can have a minimum of 32 compute units (CUs) and a maximum of 512 CUs. If the amount of remaining computing resources is less than 32 CUs, you cannot create a virtual warehouse. For more information, see Scale up a virtual warehouse in the "Manage virtual warehouses" topic.

      image

    5. On the Management on Permissions of Virtual Warehouses on Table Groups tab, click Grant Permissions to Virtual Warehouse and configure the virtual warehouse read_wh1 as the secondary virtual warehouse of the table group.

      Note

      For more information about how to create a table group, see Manage table groups.

      image

    6. In the top navigation bar, click SQL Editor. Select read_wh1 from the Current Compute Group drop-down list. Then, execute DML statements when automatic routing of DML statements to the primary virtual warehouse is enabled or disabled.

      • When automatic routing of DML statements to the primary virtual warehouse is enabled, DML statements are automatically executed on the primary virtual warehouse init_warehouse of the table group.

        image

      • When automatic routing of DML statements to the primary virtual warehouse is disabled, DML statements are executed on the current virtual warehouse read_wh1 of the table group instead of the primary virtual warehouse init_warehouse. However, only the primary virtual warehouse supports DML statements on shards in the table group. As a result, an error message is reported.

        image