AnalyticDB for PostgreSQL is a cloud-native Massively Parallel Processing (MPP) data warehouse for online analytical processing (OLAP) of large-scale data. In Serverless Pro mode, compute and storage scale independently, so you pay only for the resources you use.
This tutorial walks you through the complete flow: create an instance, configure access, load sample data, and run your first query.
What you'll learn:
Create a Serverless Pro instance and configure its key parameters
Set up an IP address whitelist for client access
Create an initial database account
Load a built-in sample dataset
Connect to the database and run a SQL query
Prerequisites
Before you begin, make sure you have:
An Alibaba Cloud account. If you don't have one, register on the Alibaba Cloud website.
Authorized a service-linked role. The first time you use AnalyticDB for PostgreSQL, authorize this role in the console:
Log on to the AnalyticDB for PostgreSQL console.
In the upper-right corner, click Create Instance.
In the Create Service Linked Role dialog box, click OK.
Billing
Creating an instance incurs charges for compute and storage resources. For pricing details, see Pricing.
Step 1: Create an instance
Log on to the AnalyticDB for PostgreSQL console.
In the upper-right corner, click Create Instance to go to the purchase page.
Configure the core parameters in the table below. Keep the default values for any parameters not listed. For a full parameter reference, see Create an instance.
Parameter Description Example Product type Subscription: Prepaid billing, suitable for long-term use. The longer the subscription period, the higher the discount. Pay-as-you-go: Hourly billing, suitable for short-term use. Release the instance after use to stop charges. Pay-as-you-go Region and zone The geographic location of the instance. The region cannot be changed after purchase. To connect over a private network, create the instance in the same region as your Elastic Compute Service (ECS) instance. China (Hangzhou): Zone J Instance resource type Storage Elastic Mode: Supports independent disk scale-out and online smooth scale-out. Serverless Pro: Specify only the compute resources you need—no storage reservation required. Serverless Pro Master resources The Master node specifications. Use the formula: Master compute unit (CU) = number of CPU cores per segment. Increase Master resources after instance creation if needed. 8 CU (Free) Reserved compute resources The total number of CUs for compute nodes. Each CU corresponds to one segment. The minimum is 16 CUs (16 segments). 16 Serverless cache space The total cloud disk size attached to all compute nodes (not the per-node cache size). Set the minimum to 800 GB. If your total data volume exceeds 800 GB, set this to approximately 30% of your total data volume to cover frequently accessed (hot) data. 800 GB Virtual Private Cloud (VPC) The VPC for the instance. To connect to an ECS instance over a private network, select the same VPC. vpc-xxxx vSwitch A vSwitch within the selected VPC. If no vSwitches are available in the current zone, switch to another zone or create a vSwitch. vsw-xxxx Click Buy Now, confirm the order, and click Activate Now.
After payment, click Management Console to return to the instance list.
Instance initialization takes a few minutes. Wait until the instance status changes to Running before proceeding.
Step 2: Configure a whitelist (optional)
Skip this step if you only access the database through Data Management (DMS). If you plan to connect from a local integrated development environment (IDE), add your client IP address to the whitelist first. To find your client IP address, see Preparations.
In the instance list, click the instance ID to open the instance details page.
In the left navigation pane, click Security Controls.
Click Create Whitelist and set the following parameters:
Parameter Description Whitelist name Must consist of lowercase letters, digits, and underscores (_). Must start with a lowercase letter and end with a lowercase letter or digit. Length: 2–32 characters. IP addresses The IP addresses or CIDR blocks to allow. Separate multiple entries with commas (,). Up to 999 unique entries. Accepted formats: specific IP addresses (e.g., 10.23.12.24) and CIDR blocks (e.g.,10.23.12.24/24, prefix length 1–32). Setting0.0.0.0/0allows access from all IP addresses—use this with caution. Setting127.0.0.1blocks all external access.Click OK.
Step 3: Create an initial account
AnalyticDB for PostgreSQL has two account types:
Privileged user: The initial account is a privileged user with the
RDS_SUPERUSERrole, which grants full operational permissions on the database.Regular user: Has no permissions by default. A privileged user (or another account with the GRANT permission) must explicitly grant access to database objects. See Create and manage users.
In the left navigation pane, click Account Management.
Click Create Account, fill in the fields, and click OK.
Parameter Description Account Must consist of lowercase letters, digits, and underscores (_). Must start with a lowercase letter and end with a lowercase letter or digit. Cannot start with gp. Length: 2–16 characters.New password and Confirm password Must contain at least three of the following character types: uppercase letters, lowercase letters, digits, and special characters ( ! @ # $ % ^ & * ( ) _ + - =). Length: 8–32 characters. Change your password regularly and avoid reusing old passwords.
Step 4: Load a sample dataset
Loading the built-in sample dataset takes 6–8 minutes.
In the upper-right corner of the instance details page, choose Sample Dataset > Load Dataset.

In the Load Sample Dataset dialog box, click OK.
Step 5: Connect to the database
This section uses DMS to connect. For other client options, see 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 your Database Account and Database Password, then click Logon.
Step 6: Query data
In the left navigation pane of the DMS console, click the target instance. If you are in simple mode, switch to the Database Instances tab first. Confirm that the
adb_sampledata_tpchdatabase appears. If it doesn't, click the refresh button next to the instance.

Double-click the
publicschema underadb_sampledata_tpchto open an SQL Console window. Run the following query:SELECT count(*) FROM lineitem;The result shows the total row count in the
lineitemtable:+-----------+ | count(*) | +-----------+ |59986052 | +-----------+
What's next
You've created a Serverless Pro instance, loaded sample data, and run your first query. To continue:
Scale compute resources: Manage Master resources or scale reserved compute resources
Release the instance: If you no longer need the instance, release it from the console to stop charges.