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
-
You have added a Hologres compute resource to your workspace and associated it with Data Studio. For more information, see Data Studio (legacy): Associate a Hologres computing resource.
-
You have the Workspace Administrator or Development role. For more information about how to grant roles, see Manage permissions on workspace-level services.
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
-
Go to the Data Studio page.
Log on to the DataWorks console. In the target region, click in the left-side navigation pane. Select a workspace from the drop-down list and click Go to Data Integration.
-
Create a Workflow.
If you have an existing Workflow, skip this step.
-
Hover over the
icon and select Create Workflow. -
In the Create Workflow dialog box, enter a Workflow Name.
-
Click Create.
-
-
Create a Hologres internal table.
-
Hover over the
icon and select . -
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.
-
-
Configure the Hologres internal table.
On the table editing page, configure the following information.
-
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.
NoteFor more information about storage formats, see the
orientationparameter in CREATE TABLE.Lifecycle
The lifecycle of the table, in seconds. The default lifecycle is permanent.
NoteThe 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.
NoteOnly Hologres V0.9 and later support table-level Binlog. For more information about Binlog, see Subscribe to Hologres binlogs.
-
-
Configure business information.
NoteThe 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.
NoteLevel-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.
NoteClick the
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.
NoteClick the
icon to customize physical categories. For more information, see Category management. -
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.
NoteIf a partitioned table has a primary key, the primary key must include the partition columns.
-
-
-
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.
NoteIf 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.
NoteThis 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.
NoteThis 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:
-
Perform Hologres-related data development. For more information, see Hologres SQL node and Hologres syntax.
-
Periodically import MaxCompute data to a Hologres internal table by using a Hologres external table:
-
Import data by using commands. For more information, see Import data from MaxCompute using SQL.
-
Import data by using the visual interface in DataWorks. For more information, see Data synchronization from MaxCompute node.
-