This topic describes how to create an AnalyticDB for PostgreSQL table.

Prerequisites

  • An AnalyticDB for PostgreSQL compute engine is bound to the current workspace on the Workspace Management page. Then, the AnalyticDB module is available on the DataStudio page. For more information, see Configure a workspace.
  • The metadata of the bound AnalyticDB for PostgreSQL compute engine is collected on the Data Map page.

Procedure

  1. Log on to the DataWorks console. In the left-side navigation pane, click Workspaces. On the Workspaces page, find the target workspace and click Data Analytics in the Actions column.
  2. On the DataStudio page that appears, move the pointer over Create and choose AnalyticDB > table.
    You can also find the target workflow, right-click AnalyticDB for PostgreSQL, and choose Create > table.
  3. In the Create Table dialog box that appears, enter a table name in the Table Name field.
    Notice If you have bound multiple AnalyticDB for PostgreSQL compute engines to the current workspace, you need to select the target AnalyticDB for PostgreSQL compute engine in this step.
  4. Click Commit.
  5. Configure the basic properties of the table.
    Parameter or button Description
    The stair theme The name of the level-1 folder where the table resides.
    Note Level-1 and level-2 folders only show the table locations in DataWorks so that you can better manage tables.
    The secondary theme The name of the level-2 folder where the table resides.
    New theme Click New theme to go to the Folder Management page. On this page, you can create level-1 and level-2 folders for tables.
    Describe The description of the table.
  6. Configure the physical model of the table.
    Parameter Description
    Level selection The level of the table. Generally, tables are divided into operation data store (ODS), common data model (CDM), and application data service (ADS) levels. You can specify a custom level name.
    Physical classification The category of the table. Tables are categorized into basic services, advanced services, and other services. You can specify a custom category name.
    If you want to create a table category or level, click New Level to go to the Level Management page.
    Note Categories are designed only for your management convenience and do not involve underlying implementation.
  7. Configure the schema of the table.
    You can configure the schema of an AnalyticDB for PostgreSQL table in the following sections: Column information settings, Index settings, Sub-table design, and Partition settings (optional).
    Section Parameter or button Description
    Column information settings New columns Click the button and set the relevant parameters to create a field.
    Name The name of the field.
    Field type The data type of the field.
    Field length The length of the field. You can only specify the length for fields of some specific data types.
    Default value The default value of the field.
    Allow to be empty Specifies whether the field can be empty.
    Is it the primary key? Specifies whether the field serves as the primary key.
    Foreign Key Specifies whether the field serves as a foreign key.
    Operation
    • You can perform the following operations on a newly created field: save, cancel, delete, move up, and move down.
    • You can perform the following operations on an existing field: modify, delete, move up, and move down.
    Index settings New columns Click the button and set the relevant parameters to create an index.
    Index name The name of the index. Make sure that you specify a unique name.
    Include columns The field on which the index is to be created. To select a field, click Edit. In the Select at least one index dialog box that appears, click the + icon. All created fields appear in the Column information drop-down list.

    Select the target field from the Column information drop-down list and click Save.

    Index type The type of the index. Valid values: Normal, Primary Key, and Unique.
    Index mode The mode for indexing data in the fields. Valid values: B-tree, Bitmap, and GiST.
    Operation
    • You can perform the following operations on a newly created index: save, cancel, delete, move up, and move down.
    • You can perform the following operations on an existing index: modify, delete, move up, and move down.
    Sub-table design Hash (Recommended), Copy Schema, and Random (Not Recommended) The way in which the partition key is generated. Take Hash (Recommended) as an example. Click New columns and select the target field from the Name drop-down list. The information about the selected field appears. Click Save.

    For more information, see the Column information settings section of this table.

    Partition settings (optional) Partition settings (optional) The partitions of the table. You can configure the partitions as required.
  8. Click Commit in Development Environment and Commit to Production Environment in sequence.
    If you are using a workspace in basic mode, you only need to click Commit to Production Environment.
  9. In the Submit changes dialog box that appears, verify that the DDL statement is correct, select a resource group, and then click Confirm execution.
    Notice You can only select an exclusive resource group. For more information, see Use exclusive resource groups for data integration.

What to do next

After the table is created, you can query the table data and modify or delete the table.