Create a Hologres internal table

更新时间:
复制 MD 格式

You can create Hologres internal tables by using DDL statements or the visual interface in DataWorks. This topic describes how to create a Hologres internal table by using the DataWorks visual interface.

Prerequisites

Background

Hologres supports two types of tables: internal tables and external tables.

  • An internal table stores data synchronized from MaxCompute, enabling fast queries and analysis with better performance than an external table.

  • An external table maps to a MaxCompute source table without storing data locally, avoiding data redundancy and eliminating the need for data import and export.

DataWorks provides a visual interface for creating tables. You can also create tables directly in Hologres by using DDL statements. For more information, see CREATE TABLE.

Limitation

This feature is available only in the China (Shanghai) and China (Beijing) regions.

Procedure

  1. Go to the Data Studio page.

    Log on to the DataWorks console. In the target region, click Data Integration > Data Integration in the left-side navigation pane. Select a workspace from the drop-down list and click Go to Data Integration.

  2. Create a Workflow.

    If you have an existing Workflow, skip this step.

    1. Hover over the 新建 icon and select Create Workflow.

    2. In the Create Workflow dialog box, enter a Workflow Name.

    3. Click Create.

  3. Create a Hologres internal table.

    1. Hover over the Create icon icon and select Create Table > Hologres > Table.

    2. In the Create Table dialog box, set Table Type to Internal Table, and configure the engine, path, and name for the table.

      Set Engine Type to Hologres, and then click Create after you complete the configuration.

  4. Configure the Hologres internal table.

    On the table editing page, configure the following information.

    1. Configure basic properties.

      The basic properties are described below.

      Parameter

      Description

      Storage Mode

      The storage mode of the table in Hologres. The default value is column-oriented storage.

      • Column-oriented Storage: Applicable to OLAP scenarios. Suitable for complex queries, data joins, scans, filters, and aggregations. Write and update performance is lower than that of row-oriented storage tables.

      • Row-oriented Storage: Applicable to KV (key-value) scenarios. Suitable for primary key-based point queries and scans. More friendly for writes and updates.

      • Hybrid Row-column Storage: Applicable to scenarios that require both column-oriented and row-oriented storage. Supports both efficient point queries and OLAP analysis. This mode incurs higher storage overhead and internal data synchronization overhead.

      Note

      For more information about storage formats, see the orientation parameter in CREATE TABLE.

      Lifecycle

      The lifecycle of the table, in seconds. The default lifecycle is permanent.

      Note

      The lifecycle is calculated from the time data is first written to the table. When the lifecycle expires, the table data is cleared within a random time period.

      Binlog

      Specifies whether to enable Binlog for the table. If Binlog is enabled, you must specify the lifecycle for Binlog. The default Binlog lifecycle is permanent.

      Note

      Only Hologres V0.9 and later support table-level Binlog. For more information about Binlog, see Subscribe to Hologres binlogs.

    2. Configure business information.

      Note

      The business information of a table is only used for management purposes based on business requirements and does not involve underlying logic implementation.

      Parameter

      Description

      Theme

      The level-1 folder and level-2 folder to which the table belongs. You can classify tables based on business purposes and place tables of the same type in the same folder.

      Note

      Level-1 themes and level-2 themes are only the folder structure presented in DataWorks and are intended to help you manage tables.

      Layer

      The physical data warehouse layer to which the table belongs. Layers are used to define and manage the hierarchy of a data warehouse. Typical layers include the staging layer, the shared layer, and the analytics layer. You can assign the table to an appropriate layer based on its business purpose.

      Note

      Click the Create icon icon to customize layers. For more information, see Table management.

      Physical Category

      The physical category of the table. This provides a more detailed classification of the table from a business perspective. Typical categories include the basic business layer, the advanced business layer, and others.

      Note

      Click the Create icon icon to customize physical categories. For more information, see Category management.

    3. Configure the table structure.

      Parameter

      Description

      Field Design

      Add and define the columns of the table. For more information about data types supported by Hologres, see Data types overview.

      Storage Design

      Define the storage design for table columns.

      • Distribution Column: Specifies the distribution policy of the table. Data is distributed to shards based on the distribution column, and subsequent computations and scans are performed on a per-shard basis.

      • Segment key: Typically, you specify a column that is strongly correlated with time as the segment key. When a query includes the segment key in the filter condition, the system can quickly locate the storage position of the corresponding data. This is suitable for time-sensitive data such as logs and traffic data.

      • Clustering Key: Creates a clustered index on the specified columns. Hologres sorts data based on the clustered index to accelerate range and filter queries on the indexed columns.

      • Dictionary Encoding Columns: Builds a dictionary mapping for the values in specified columns. Dictionary encoding converts string comparisons to numeric comparisons, which accelerates GROUP BY, filter, and other queries.

      • Bitmap Column: A bitmap-encoded column that enables fast equality filtering on data within storage files. We recommend that you build bitmap encoding for data that is used in equality filter conditions.

      For more information about storage design options, see CREATE TABLE.

      Partition

      Define the partition columns for the table.

      Note

      If a partitioned table has a primary key, the primary key must include the partition columns.

  5. Submit and deploy the Hologres internal table.

    After you define the table structure, submit it to the development environment and the production environment. The table is visible in the corresponding engine project only after submission.

    Note

    If your workspace is in basic mode, you only need to submit the table to the production environment. For more information about basic mode and standard mode workspaces, see Workspace mode differences.

    Operation

    Description

    Load from Development Environment

    Loads information about the development table from the development environment and displays it on the current page.

    Note

    This operation is available only after the table has been submitted to the development environment. After this operation is performed, the table information from the development environment overwrites the table information on the current page.

    Commit to Development Environment

    Submits the table to the development environment of DataWorks, which creates the table in the Hologres database that corresponds to the development environment.

    After you submit the table, you can view the table structure in the Hologres directory of the corresponding workflow (the path you selected when creating the table) in Data Studio.

    Load from Production Environment

    Loads information about the production table from the production environment and displays it on the current page.

    Note

    This operation is available only after the table has been submitted to the production environment. After this operation is performed, the table information from the production environment overwrites the table information on the current page.

    Commit to Production Environment

    Submits the table to the production environment of DataWorks, which creates the table in the Hologres database that corresponds to the production environment.

Next steps

After you create a Hologres internal table, you can perform the following operations: