Running complex reports or analytical queries on an ApsaraDB RDS for PostgreSQL instance can consume substantial resources and affect the performance and stability of your core business operations. To solve this problem, ApsaraDB RDS for PostgreSQL introduces the DuckDB-based analytical instance. This instance is designed for analytical workloads and uses a dedicated node to implement read/write splitting. It isolates analytical processing (AP) workloads from online transactional processing (TP) workloads, which significantly improves the efficiency of complex queries without affecting the performance of the primary instance.
Features
A DuckDB-based analytical instance is a specialized read-only instance designed for analytical queries. It provides the following features:
Read/write splitting and workload isolation: As a dedicated node, the instance completely isolates resource-intensive analytical queries from the transactional operations on the primary instance, ensuring that your core business operations remain stable and performant.
Zero-ETL real-time columnar conversion: The instance synchronizes data from the primary instance in real time using physical replication and logical subscription, and automatically converts the data to the columnar storage format. You can also configure synchronization policies for each database.
Hybrid row and columnar storage: The instance stores two copies of the data: a row store (original format) copy and a columnar storage (analytical format) copy. By default, the instance uses the columnar engine to accelerate complex analytical queries. For queries that cannot be processed by the columnar engine, the system automatically falls back to the row store engine to ensure compatibility. The instance also supports row store compression.
Prerequisites
To create a DuckDB-based analytical instance, the primary ApsaraDB RDS for PostgreSQL instance must meet the following requirements:
Instance status: Running.
Major engine version: ApsaraDB RDS for PostgreSQL 13.0 or later.
Edition: High-availability Edition.
Billing method: Subscription or pay-as-you-go.
Minor engine version: 20260130 or later.
Instance parameters: The following parameters are configured as required.
wal_levelis set tological,shared_preload_librariesincludesrds_duckdb, andmax_replication_slots,max_worker_processes, andmax_wal_sendersare all set to1024or greater.The instance is not a disaster recovery instance.
Free trial
After you create a primary ApsaraDB RDS for PostgreSQL instance, you can add a DuckDB analysis read-only instance for free. The specifications for the DuckDB analysis read-only instance free trial are as follows:
Billing Method:Subscription (select a Duration of one month).
Major engine version: ApsaraDB RDS for PostgreSQL 16 or later.
Edition: Basic Edition.
Instance Type: pgro.x2.large.1c (4 vCPUs, 8 GB, Dedicated).
Capacity: less than 3 TB.
Each verified Alibaba Cloud account is eligible for one free trial.
Billing
The cost depends on factors such as the edition, instance type, storage type, and storage capacity. The final price is shown on the purchase page.
Usage notes
After you create a DuckDB-based analytical instance, do not modify the required parameters on the primary instance.
If you create multiple DuckDB-based analytical instances for a single primary instance, they all share the same columnar storage configuration, such as which databases are enabled for automatic conversion.
If the primary instance has columnar acceleration enabled through the rds_duckdb extension, we recommend that you disable this feature on the primary instance after you create the DuckDB-based analytical instance. This ensures complete workload isolation.
To ensure query compatibility, the DuckDB-based analytical instance retains a copy of the data in row store format. You can compress the row store data to control storage costs.
Create a DuckDB analytical instance
Go to the ApsaraDB RDS console, select a region in the top navigation bar, and then click the ID of the target instance.
On the Basic Information page, in the Instance Distribution section, click Add to the right of DuckDB-based analytical instance.

A pre-check runs automatically. Once it passes, click Confirm opening.
If the pre-check fails, click One-key repair and select a time for the fix in the panel that appears. The system automatically configures the dependencies that failed the pre-check. After the fix is complete, click Add to the right of DuckDB-based analytical instance again. On the pre-check page, click Confirm opening.
ImportantIf the major engine version of the instance does not meet the requirements, you must manually upgrade the major engine version.
Configure the parameters for the DuckDB-based analytical instance.
Parameter
Description
Billing Method
Subscription : Ideal for long-term use (one-time payment).
Pay-As-You-Go: Ideal for short-term use (hourly billing). You can start with a pay-as-you-go instance and switch to a Subscription plan once it meets your needs.
Edition
Basic Edition: A single-node DuckDB-based analytical instance. This edition is cost-effective and suitable for learning or testing purposes. Recovery and restart times for the instance can be long.
High-availability Edition (default): Includes a primary node and a secondary node to provide high availability for the DuckDB-based analytical instance. It is suitable for production environments and meets the requirements of more than 80% of use cases.
NoteIf you select Edition, you must also specify the zone for the primary node, the deployment solution (multi-zone deployment or single-zone deployment), and the zone for the secondary node.
Product Type
Only Standard Edition is supported.
For more information, see Product types.
Zone
A zone is an independent physical region. All zones within the same region provide the same level of service. Compared with a single-zone deployment, a multi-zone deployment provides zone-level disaster recovery.
Instance Type
Only Dedicated instance types are supported. The instance types are the same as the ApsaraDB RDS for PostgreSQL read-only instance types.
Storage Capacity
Storage space includes data space, system file space, write-ahead logging (WAL) file space, and transaction file space. You can adjust the storage space in increments of 5 GB.
NoteThe storage space of a DuckDB-based analytical instance cannot be smaller than that of its primary instance. For information about the storage space of each instance type, see ApsaraDB RDS for PostgreSQL read-only instance type list.
Click Next: Instance Configurations and configure the following parameters.
Parameter
Description
Network Type
Defaults to the same network type, VPC, and vSwitch of Primary Node as the primary instance.
Release Protection
If you set the Billing Method to pay-as-you-go, you can enable Release Protection for the instance to prevent it from being accidentally released. For more information, see Enable or disable release protection for an instance.
Resource Group
Defaults to the same resource group as the primary instance and cannot be modified.
Time Zone
Defaults to the same time zone as the primary instance.
SLR Authorization
No action is required. The authorization was granted when you purchased the primary instance.
Instance Name
Set a name for the instance for easy management.
Tags
You can add tags to an instance when you create it. After the instance is created, you can filter instances by tag. For more information, see Filter instances by tag.
Click Next: Confirm Order.
Confirm the Parameter Configuration, select the Quantity and Duration (for Subscription instances only), and then click Pay Now to complete the payment.
Configure columnar databases
A DuckDB-based analytical instance uses columnar storage to accelerate analytical queries. Before you use the instance, you must convert row store data from the primary instance to the columnar storage format.
You can convert an entire database or convert tables on demand. We recommend that you first try converting the entire database. Select a method based on your business requirements and resource availability.
Prerequisites
Before you start, make sure that the primary ApsaraDB RDS for PostgreSQL instance meets the following requirements:
A DuckDB-based analytical instance is created and is in the Running state.
A privileged account is created.
The target database must contain at least one data table.
Usage notes
Generating columnar data consumes additional storage space, typically 20% to 50% of the original data size. Ensure the DuckDB-based analytical instance has sufficient storage space.
For a large database, converting the entire database may take a long time. The duration is affected by factors such as the instance type (for example, disk bandwidth and memory).
Method 1: Convert an entire database
With this recommended method, you can use the console to automatically convert all tables in a database to the columnar storage format. It is ideal for a comprehensive analysis of an entire database.
This method applies only to existing tables. For new tables, you can manually execute the create_duckdb_table function to convert them to columnar storage format, or enable the rds_duckdb.auto_create_duckdb_table parameter for automatic creation.
Log on to the ApsaraDB RDS console. In the navigation pane on the left, click Instances. In the top navigation bar, select a region.
In the instance list, find the primary instance (identified by the
icon) and expand its drop-down list.Click the ID of the DuckDB-based analytical instance.

In the navigation pane on the left, click Databases.
On the Databases page, select the databases that you want to automatically convert to columnar storage, and then click Batch configure columnar storage at the bottom of the page.
In the dialog box that appears, click Yes.
Method 2: Convert tables on demand
This method is ideal for optimizing specific slow SQL queries by converting only the involved tables, or for conserving storage space on an instance with limited resources. If a query involves a table that has not been converted, the system automatically falls back to the row store engine to ensure business compatibility.
Procedure
Connect to the primary ApsaraDB RDS for PostgreSQL instance and run the following SQL statements in the desired database:
-- Create the rds_duckdb extension (skip if it already exists).
CREATE EXTENSION IF NOT EXISTS rds_duckdb;-- Convert the specified table to the columnar storage format.
SELECT rds_duckdb.create_duckdb_table('local_table_name');