AnalyticDB for PostgreSQL is a cloud-native Massively Parallel Processing (MPP) data warehouse for online analytical processing (OLAP) of large-scale data. AnalyticDB for PostgreSQL supports two instance types: elastic storage mode and Serverless mode. Instances in elastic storage mode use a coupled storage and compute architecture, enabling vertical and horizontal scaling of compute nodes along with flexible storage adjustment. This guide walks you through the entire process, from creating an Elastic Storage Mode instance to running your first query.
Prerequisites
You have an Alibaba Cloud account. If not, register at the Alibaba Cloud official website to create one.
Authorize the service-linked role. The first time you use AnalyticDB for PostgreSQL, you must authorize a service-linked role that allows the service to access other cloud resources. The console guides you through this one-time setup:
- Log on to the AnalyticDB for PostgreSQL console.
In the upper-right corner of the console, click Create Instance.
In the Create Service Linked Role dialog box, click OK.
Billing
Creating an instance incurs fees for its compute and storage resources. For details, see Pricing.
Alibaba Cloud offers a free trial for instances in elastic storage mode. If you are a new user of AnalyticDB for PostgreSQL, visit Alibaba Cloud Free Tier to apply. If you are ineligible for a free trial, you can follow the steps in this guide to create an instance.
Procedure
Create an instance
- Log on to the AnalyticDB for PostgreSQL console.
In the upper-right corner of the page, click Create Instance to go to the purchase page.
On the purchase page, configure the core parameters to quickly launch an instance. You can leave the other parameters at their default settings. For more information about all parameters, see Create an instance.
Parameter
Description
Example for This Tutorial
Product Type
Subscription:A prepaid method, ideal for long-term use, that more cost-effective than pay-as-you-go and offers larger discounts for longer subscription periods.
Pay-as-you-go: A postpaid method with hourly billing, ideal for short-term needs. Release the instance at any time to save costs.
Pay-as-you-go
Region and Zone
The geographical location of the instance.
This cannot be changed after purchase. We recommend that you create the instance in the same region as your ECS instances to enable internal network communication.
China (Hangzhou): Zone J
Instance Resource Type
Elastic Storage Mode: Supports independent disk expansion and smooth online scaling.
Serverless Pro: You need to specify only the required compute resources without pre-allocating storage resources.
Elastic Storage Mode
Engine Version
We recommend that you select 7.0 Standard Edition for its expanded feature set. 6.0 Standard Edition is also supported.
7.0 Standard Edition
Edition
High-performance (Basic Edition): Suitable for most business analysis scenarios.
High-availability Edition: Recommended for core business applications.
High-performance Edition (Basic Edition)
VPC
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.
vpc-xxxx
vSwitch
The vSwitch within the VPC. If no vSwitches are available, no VSwitch resources are available in the current zone. You can switch to another availability zone or create a vSwitch in the current zone as prompted.
vsw-xxxx
Click Buy Now, confirm the order information, and click Activate Now.
After you complete the payment, click Management Console to return to the instance list and view the new instance.
NoteThe initialization of an AnalyticDB for PostgreSQL instance takes some time. Proceed with the next steps only after the instance status changes to Running.
(Optional) Configure an IP whitelist
If you use only Data Management (DMS) for access, you can skip this step. To access the database from a local integrated development environment (IDE), you must configure an IP address whitelist. To obtain the client IP address, see Preparations.
In the instance list, find the instance that you just created and click the instance ID to go to the details page.
In the navigation pane on the left, click Security Controls.
Click Create Whitelist and configure the following parameters:
Parameter
Description
Whitelist Name
The name of the whitelist.
The name can contain lowercase letters, digits, and underscores (_).
The name 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 or CIDR blocks that are allowed to access the instance.
Separate multiple IP addresses with commas (,). A maximum of 999 unique IP addresses can be specified.
You can enter specific IP addresses such as 10.23.12.24 and CIDR blocks such as 10.23.12.24/24. /24 indicates the length of the IP address prefix. An IP address prefix can be 1 to 32 bits in length.
If you set the prefix length to 0, for example, 0.0.0.0/0 or 127.0.0.1/0, all IP addresses are allowed to access the instance. This poses a high security risk. Proceed with caution.
The IP address 127.0.0.1 indicates that no external IP addresses are allowed to access the instance.
Click OK.
Create an initial account
AnalyticDB for PostgreSQL provides two types of users:
Privileged user: The initial account is a privileged user with the RDS_SUPERUSER role, which grants all operational permissions on the database.
Standard user: By default, a standard user does not have any permissions. A privileged user, or another user with the
GRANTpermission, must explicitly grant a standard user permissions on database objects. For more information about how to create a standard user, see 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, set a password, and then click OK.
Parameter
Description
Account
The name of the initial account.
The name can contain lowercase letters, digits, and underscores (_).
The name must start with a lowercase letter and end with a lowercase letter or a digit.
The name cannot start with gp.
The name must be 2 to 16 characters in length.
New Password and Confirm Password
The password of the initial account.
The password must contain at least three of the following character types: uppercase letters, lowercase letters, digits, and special characters.
Special characters include
! @ # $ % ^ & * ( ) _ + - =.The password must be 8 to 32 characters in length.
ImportantTo ensure data security, we recommend that you change your password on a regular basis and do not use passwords that you used before.
Load a sample dataset
You can load a sample dataset for testing. It 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 demonstrates how to connect to the database by using DMS. For other clients, see Client connection.
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 click Logon.
Query data
In the left-side navigation pane of the DMS console, click the target instance (if you are in simple mode, switch to the Database Instances tab first) and verify that the
adb_sampledata_tpchdatabase exists.If the database is not displayed, click the refresh button next to the target instance.

Double-click the
publicschema under theadb_sampledata_tpchdatabase to open a SQL Console window. Execute the following SQL statement to query data.SELECT count(*) FROM lineitem;The following result is returned:
+-----------+ | count(*) | +-----------+ |59986052 | +-----------+
Next steps
After you complete this quickstart, you can explore more features of AnalyticDB for PostgreSQL:
Instance scaling: If your data volume or computing demands increase, you can scale your instance (by adding nodes or upgrading node specifications) to meet higher performance requirements.
Data migration and synchronization: You can migrate data from self-managed databases or other cloud databases to AnalyticDB for PostgreSQL. For details, see Overview.