AnalyticDB for PostgreSQL is a cloud native Massively Parallel Processing (MPP) data warehouse designed for online analytical processing (OLAP) of massive datasets. AnalyticDB for PostgreSQL supports two instance resource types: Storage-elastic Mode and Serverless Pro. Based on a cloud native architecture, the Serverless Pro mode completely decouples compute from storage, which eliminates the need for proportional scaling. This topic describes how to create a Serverless Pro instance and query its data.
Prerequisites
-
You must have an Alibaba Cloud account. If you do not have one, register for an account on the Alibaba Cloud official website.
-
If you are using AnalyticDB for PostgreSQL for the first time, you must authorize a service-linked role in the console. Follow these steps:
- Log on to the AnalyticDB for PostgreSQL console.
-
In the upper-right corner of the page, click Create Instance.
-
In the Create Service Linked Role dialog box, click OK.
Billing
Creating an instance incurs fees for compute and storage resources. For more information, see Product pricing.
Procedure
Create an instance
- Log on to the AnalyticDB for PostgreSQL console.
-
In the upper-right corner of the page, click Create Instance to open the purchase page.
-
On the purchase page, configure the core parameters. You can keep the default values for other parameters. For more information about the parameters, see Create an instance.
Parameter
Description
Example
Region and Zone
-
Subscription: A prepaid billing method where you pay upfront. It is suitable for long-term needs and is more cost-effective than pay-as-you-go. The longer the subscription period, the higher the discount.
-
Pay-as-you-go: A postpaid billing method where you are charged hourly. It is suitable for short-term needs. You can release the instance immediately after use to save costs.
Pay-as-you-go
Product Type
The instance's geographic location.
The region cannot be changed after the instance is created. We recommend that you create the instance in the same region as the Elastic Compute Service (ECS) instances to which you want to connect. This enables internal network communication.
China (Hangzhou): Availability Zone J
Instance resource type
-
Elastic Storage Mode: Supports independent scaling of cloud disks and smooth online scaling.
-
ServerlessPro: You only need to specify the required compute resources without having to pre-allocate storage resources.
Serverless Pro
Master resources
Select the Master resource specifications. We recommend that you select the specifications based on the following formula:
Master CU = Number of CPU cores per segment.If you need more master resources, you must upgrade the specifications after the instance is created. For more information, see Master resource management.
8 CU (free)
Reserved compute resources
The number of CUs for the compute nodes. The minimum is 16 CUs (16 segments).
16
Serverless cache space
The total cache size across all compute nodes. We recommend a minimum of 800 GB. If you require more than 800 GB, you can adjust the size based on the amount of hot data. For example, you can set the size to 30% of your total data volume.
NoteThis parameter specifies the total cache space for all compute nodes, not for a single compute node.
800
Virtual Private Cloud
Select the ID of the Virtual Private Cloud (VPC).
To connect to an ECS instance in the same region over an internal network, select the same VPC as the ECS instance. You can select an existing VPC or create a VPC and VSwitch as prompted on the page.
vpc-xxxx
vSwitch
Select a VSwitch that belongs to the VPC. If no VSwitches are listed, the current availability zone has no available VSwitch resources. You can switch to another availability zone, or create a VSwitch in the current availability zone as prompted on the page.
vsw-xxxx
-
-
Click Buy Now, confirm the order information, and then click Create Now.
-
After you complete the payment, click Console to return to the instance list and view the new instance.
NoteAn AnalyticDB for PostgreSQL instance takes some time to initialize. You can proceed to the next steps only when the instance status changes to Running in the instance list.
(Optional) Configure an IP whitelist
Skip this step if you access the instance only through DMS. To connect from a local IDE, configure an IP whitelist. Obtain your client IP address as described in Before you begin.
-
In the instance list, click the instance ID to open its details page.
-
In the left-side navigation pane, click Security Controls.
-
Click Create Whitelist and configure the following parameters:
Parameter
Description
Whitelist Name
The name of the new whitelist group. The name must meet the following requirements:
-
It must consist of lowercase letters, digits, or underscores (_).
-
It must start with a lowercase letter and end with a lowercase letter or a digit.
-
The name must be 2 to 32 characters in length.
IP Addresses
The IP addresses to add to the whitelist. Note the following:
-
Separate multiple IP addresses with commas (,). Duplicate IP addresses are not allowed. You can add a maximum of 999 IP addresses.
-
You can use IP addresses in the
10.23.12.24format and CIDR blocks in the10.23.12.24/24format. CIDR stands for Classless Inter-Domain Routing. In CIDR mode, /24 specifies the length of the address prefix. The prefix length can be an integer from 1 to 32. -
Setting the prefix length to 0, such as in
0.0.0.0/0or127.0.0.1/0, allows access from any IP address. This poses a high security risk. Proceed with caution. -
127.0.0.1denies access from all external IP addresses.
-
-
Click OK.
Create an initial account
AnalyticDB for PostgreSQL provides two types of users:
-
Privileged user: The initial account has the
RDS_SUPERUSERrole with full database permissions. -
Standard user: No default permissions. A privileged user or a user with the
GRANTpermission must grant access to database objects. Create and manage users.
-
In the left-side navigation pane, click Account Management.
-
Click Create Account. In the Create Account window, enter an account name and set a password. Then, click OK.
Parameter
Description
Account
The initial account name must meet the following requirements:
-
Must contain only lowercase letters, digits, and underscores (_).
-
Must start with a lowercase letter and end with a lowercase letter or digit.
-
Cannot start with
gp. -
Must be 2 to 16 characters long.
New Password and Confirm Password
The password must meet the following requirements:
-
Must contain characters from at least three of the following categories: uppercase letters, lowercase letters, digits, and special characters.
-
The supported special characters are
!@#$%^&*()_+-=. -
Must be 8 to 32 characters long.
ImportantFor data security, change your password regularly and do not reuse previous passwords.
-
Load a sample dataset
Load a sample dataset for testing. This takes about 6 to 8 minutes.
-
In the upper-right corner of the instance details page, choose .

-
In the Load Sample Dataset dialog box, click OK.
Connect to the database
This section uses DMS to connect. Other methods are covered in Client connections.
-
In the upper-right corner of the instance details page, click Log On to Database.
-
On the Log On to Instance page, enter the Database Account and Database Password, and then click Log On.
Query data
-
In the DMS left navigation pane, click the target instance (in simple mode, switch to the Database Instance tab first) and verify the
adb_sampledata_tpchdatabase exists.If not displayed, click the refresh icon next to the instance.

-
Double-click the
publicschema underadb_sampledata_tpchto open a SQL console. Run the following query.SELECT count(*) FROM lineitem;Expected result:
+-----------+ | count(*) | +-----------+ |59986052 | +-----------+
Related topics
To scale your instance, see Master Resource Management and Reserved Resource Scaling.