Create an AnalyticDB for PostgreSQL table

更新时间:
复制 MD 格式

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

Prerequisites

Procedure

  1. Go to the DataStudio page.

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

  2. On the DataStudio page, move the pointer over the 新建 icon, and then choose Create Table > AnalyticDB for PostgreSQL > Table.

    Alternatively, you can open the desired workflow, right-click AnalyticDB for PostgreSQL, and choose Create Table.

  3. In the Create Table dialog box, enter a Name.

    Important
    • The format of the table name is schema_name.table_name.

    • schema_name and table_name must start with a letter or an underscore (_), contain only letters, numbers, or underscores (_), and not exceed 63 characters in length.

    • If multiple compute resources are bound in DataStudio, select the required AnalyticDB for PostgreSQL compute resource.

  4. Click Create to open the table configuration page.

    The top of the page displays the Table Name and Compute Engine Instance that you configured in the Create Table dialog box.

  5. In the General section, configure the parameters.

    Parameter

    Description

    Level-1 Folder

    The level-1 folder for the new table.

    Note

    Level-1 and level-2 folders are used to organize tables in DataWorks.

    Level-2 Folder

    The level-2 folder for the new table.

    Create Folder

    Click Create Folder to open the Folder Management page, where you can create level-1 and level-2 folders.

    After you create the folders, click the 刷新 icon to refresh.

    Description

    A description of the new table.

  6. In the Physical Model section, configure the parameters.

    Parameter

    Description

    Level Selection

    A data warehouse typically includes the ODS, CDM, and ADS layers. You can customize the layer names.

    For more information about physical layers, see data warehouse layering.

    Category

    Includes basic business layer, advanced business layer, and others. You can customize the classification names.

    Note

    Physical classification is for management purposes only and does not affect the underlying implementation.

    Create Level

    To create a new layer or physical classification, click Create Level and add it on the Level Management page. After the creation is successful, click the 刷新 icon to refresh.

  7. In the AnalyticDB for PostgreSQL table design section, configure the parameters.

    This section contains the following tabs: Column Information Settings, Index Settings, Distribution Key Design, and Table Partition Design (Optional).

    Category

    Parameter

    Description

    Column Information Settings

    Insert Column

    Click to add a column and configure its information.

    Name

    The name of the column.

    Field Type

    The data type of the column.

    Length Setting

    You can customize the length only for some data types.

    Default Value

    The default value of the column.

    Unspecified or Specified

    Specifies whether the column allows NULL values.

    Primary Key

    Specifies whether the column is a primary key.

    Unique Key

    Specifies whether the column is a unique key.

    Actions

    • For a new column, you can perform operations such as Save, Cancel, Delete, Up, and Down.

    • For an existing column, you can perform operations such as Modify, Delete, Up, and Down.

    Index Settings

    Insert Column

    Click to add an index and configure its information.

    Index Name

    Enter a unique name for the index.

    Columns to Include

    Click Edit. In the Select at least one indexes. dialog box, click + to display the available columns.

    From the Column information list, select the columns to add and click Save.

    Index Type

    The options are Regular Index, Primary Key Index, and Unique index.

    Indexing Method

    The options are Tree Index, Bitmap Index, and GiST Index.

    Actions

    • For a new index, you can perform operations such as Save, Cancel, Delete, Up, and Down.

    • For an existing index, you can perform operations such as Modify, Delete, Up, and Down.

    Distribution Key Design

    The options are Hash Distribution (Recommended), Replicated Distribution, and random distribution (Not recommended).

    Take Hash Distribution (Recommended) as an example. Click Insert Column and select a column from the Name list. The column information is automatically displayed. Click Save.

    For more information, see Column Information Settings in this table.

    Table Partition Design (Optional)

    Table Partition Design (Optional)

    Use this tab to design a partitioned table. For more information, see table partitioning.

  8. Click Commit to Development Environment and then Commit to Production Environment.

    If you are using a workspace in basic mode, click Commit to Production Environment.

  9. In the Submit Change dialog box, verify the table creation statement, select the required resource group from the Select Resource Group drop-down list, and then click Start Task.

    Note

    The selected resource group must be the same one that passed the connectivity test when you configured the data source.

Next steps

After you create the table, you can query, modify, or delete it. For more information, see Table management.