This topic describes how to create an AnalyticDB for PostgreSQL table.
Prerequisites
-
You have created a serverless resource group (recommended) or an exclusive resource group for scheduling based on your business requirements.
-
You have bound an AnalyticDB for PostgreSQL compute resource to DataStudio.
NoteA successful connectivity test is required to create an AnalyticDB for PostgreSQL table.
-
After you bind a compute resource in DataStudio, you must collect AnalyticDB for PostgreSQL metadata on the Data Map page. For more information, see Collect AnalyticDB for PostgreSQL metadata.
Procedure
-
Go to the DataStudio 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 Development.
-
On the DataStudio page, move the pointer over the
icon, and then choose .Alternatively, you can open the desired workflow, right-click AnalyticDB for PostgreSQL, and choose Create Table.
-
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.
-
-
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.
-
In the General section, configure the parameters.
Parameter
Description
Level-1 Folder
The level-1 folder for the new table.
NoteLevel-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.
-
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.
NotePhysical 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. -
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.
-
-
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.
-
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.
NoteThe 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.