![[New Service] Announcing the Amazon Redshift extension for DuckDB: Trying Out Queries to Redshift Serverless Express Configuration from the DuckDB UI #AWSreInvent](https://devio2024-media.developers.io/image/upload/f_auto,q_auto/c_limit,w_1200/v1796065559/eyecatch/oa5mrax2eso8c2ol0qog.png)
[New Service] Announcing the Amazon Redshift extension for DuckDB: Trying Out Queries to Redshift Serverless Express Configuration from the DuckDB UI #AWSreInvent
This page has been translated by machine translation. View original
<!--
Title:
[New Service] Amazon Redshift extension for DuckDB is here, so I queried Redshift Serverless express configuration from the DuckDB UI
Description:
I tried the Amazon Redshift extension for DuckDB, which sends SQL from DuckDB to Redshift and lets you JOIN the result with local CSVs. With Redshift Serverless express configuration, aggregating 10 million rows on S3 took 957ms, about 5.7x faster than reading S3 directly.
-->
This is Ishikawa from the Cloud Business Division. The "Amazon Redshift extension for DuckDB" has been released. From a DuckDB session you can now send SQL to Redshift and join the result with local files in the same SQL statement. I tried it from the DuckDB UI, using Redshift Serverless express configuration, announced the same day, as the target.
DuckDB is an analytical database that runs inside the application process. The official documentation explains that a DuckDB session can only process within the memory and compute of its machine, and scans or joins that don't fit fail or get slow. Until now you had to set up another analytics engine, move the data, and rewrite your processing.
With this extension, you can run heavy queries on Amazon Redshift from the same DuckDB session and receive the results as a DuckDB table. The results can be joined with local Parquet or CSV in the same SQL statement. Targets are a provisioned cluster, a Redshift Serverless workgroup, or the Redshift Serverless express configuration announced the same day.
The extension is published on GitHub as OSS under the Apache License 2.0. Builds for DuckDB v2.0.1 are provided for macOS (Apple silicon / Intel), Linux (x86_64 / ARM), and Windows (x86_64), and it is available in all commercial Regions where Amazon Redshift is available.
The express configuration announcement is here.
What is Amazon Redshift extension for DuckDB
How it works
The extension is named redshift. You register a Redshift target as a "handle" with ATTACH and send SQL with the table function redshift_query(handle_name, 'Redshift SQL'). The SQL is sent to Redshift as written and runs with Redshift syntax and behavior. The result comes back as a DuckDB table, so you can filter, aggregate, join with local data, write to Parquet, or save it into a DuckDB table.
DuckDB does not rewrite the SQL inside redshift_query. Therefore filtering, joins, and aggregation written in DuckDB SQL outside redshift_query run locally on all rows Redshift returned. Put the filtering and aggregation you want Redshift to handle inside the Redshift SQL passed to redshift_query.
The extension bundles the Amazon Redshift ODBC driver, so you don't need to prepare a driver, driver manager, or DSN (data source name) separately. Authentication is IAM only, and you specify one of the following credentials per ATTACH.
| Credential source | ATTACH option |
|---|---|
AWS default credential chain (environment variables, ~/.aws settings, instance or container roles) |
CREDENTIAL_PROVIDER aws_default_chain |
| Named profile | CREDENTIAL_PROVIDER profile, PROFILE '<profile name>' |
DuckDB secret (created with DuckDB's aws extension) |
SECRET <secret name> |
The Redshift database user is determined from the IAM identity, and for an IAM role it becomes IAMR:<role name>. No database password is used.
Amazon Redshift Serverless with express configuration
Express configuration is a new way to use Amazon Redshift Serverless. Without creating a workgroup or namespace, you send queries directly to the service-managed per-Region endpoint express-default. No VPC, subnet, or security group setup is needed, and the documentation says SQL can be run in about 2 seconds.
If you don't specify a target in the DuckDB extension's ATTACH, it connects to this express configuration.
The main specifications are as follows.
- It must be enabled once per account and Region. Opening express configuration in the console or calling the
GetExpressConfigurationAPI enables it. Querying from a client such as the DuckDB extension does not enable it. Enabling itself is free - The data you can read is Amazon S3 / Amazon S3 Tables data registered in the AWS Glue Data Catalog, and Redshift Managed Storage (RMS) data registered with Redshift federated permissions
- There is no persistent storage. Writes are limited to Iceberg writes and datashare writes, and temporary tables can also be used
- Base capacity is fixed at 64 RPU. You can set the max capacity from 64 to 1024 RPU (multiples of 8); if not set, it scales up to 512 RPU
- Pricing is the same as Redshift Serverless: per-second billing of RPU-hours (60-second minimum). You aren't charged while idle
Authentication and permissions
The IAM identity connecting to express configuration from the DuckDB extension needs redshift-serverless:GetCredentials and redshift-serverless:DbConnect on the express-default workgroup ARN. The IAM policy example from the documentation is as follows.
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": ["redshift-serverless:GetCredentials", "redshift-serverless:DbConnect"],
"Resource": "arn:aws:redshift-serverless:us-east-1:123456789012:workgroup/express/express-default"
}
]
}
You also need permissions on the data you read (Glue read permission and S3 read permission, plus Lake Formation permissions if you manage with it).
Express configuration doesn't run inside a VPC. The host running DuckDB must be able to reach TCP port 5439 of the endpoint and redshift-serverless.<Region>.amazonaws.com (HTTPS) for obtaining credentials. Based on the documentation, the connection flow looks like this.
Trying it out
Test environment
| Item | Details |
|---|---|
| Region | ap-northeast-1 (Tokyo) |
| Machine | Apple M4 (10 cores, 32GB memory), macOS 26.7.3 |
| DuckDB | v2.0.1 (osx_arm64), operated via DuckDB UI |
| redshift extension | v1.1.0 |
| Target | Redshift Serverless with express configuration (Redshift 1.0.567987) |
| AWS CLI | 2.43.0 |
| IAM | IAM role for testing (registered as an AWS Lake Formation data lake administrator) |
| Pricing | Redshift Serverless in Tokyo is $0.494/RPU-hour |
Data preparation (uploading to S3 and creating the Glue table) was done with the AWS CLI; everything else was done in the Management Console and the DuckDB UI (a DuckDB notebook that runs in the browser).

Data flow
The data flow is as follows.
The numbers in the diagram are the processing order. Of the SQL entered in the DuckDB UI (①), only the part passed to redshift_query is sent to Express (②, purple line). Express reads the Parquet on S3 (④) based on the Glue Data Catalog table definition (③), aggregates it, and returns only the 48 aggregated rows to DuckDB (⑤, green line). Joining with the local CSV (⑥) and writing to Parquet (⑦) are executed by the local DuckDB (the diagram groups the input CSV and output Parquet as "local files").
Preparing DuckDB v2.0.1
The extension build is specific to DuckDB v2.0.1. My local DuckDB was a v2.0.0 pre-release, so without touching the existing environment, I placed the official v2.0.1 release in bin in my working directory.
% aws --version
aws-cli/2.43.0 Python/3.14.10 Darwin/25.6.0 exe/arm64
% curl -sSL -o dl/duckdb-cli-osx-arm64.tar.gz https://github.com/duckdb/duckdb/releases/download/v2.0.1/duckdb-cli-osx-arm64.tar.gz && ls -l dl
total 39384
-rw-r--r--@ 1 user wheel 19349951 Dec 2 04:38 duckdb-cli-osx-arm64.tar.gz
% tar -xzf dl/duckdb-cli-osx-arm64.tar.gz -C dl && cp dl/duckdb bin/duckdb
% ./bin/duckdb --version
v2.0.1 (Cyanoptera) 8d78114e90
Generating sample data
I generated 10 million rows of sales data as 10 Parquet files (1 million rows each) with DuckDB. For testing, I included a few rows where customer_id is NULL and rows with pref_code = 99, which isn't in the prefecture master.
-- data/gen_sales.sql
CREATE MACRO sales_part(p) AS TABLE
SELECT
i::BIGINT AS sale_id,
(DATE '2026-01-01' + CAST(hash(i, 1) % 334 AS INTEGER)) AS sale_date,
(DATE '2026-01-01' + CAST(hash(i, 1) % 334 AS INTEGER))::TIMESTAMP
+ to_seconds(CAST(hash(i, 2) % 86400 AS BIGINT)) AS sold_at,
CASE WHEN hash(i, 3) % 1000 = 0 THEN 99
ELSE CAST(hash(i, 4) % 47 AS INTEGER) + 1 END AS pref_code,
CAST(hash(i, 5) % 500 AS INTEGER) + 1 AS store_id,
(['食品','飲料','日用品','家電','衣料','書籍','玩具','医薬品'])[CAST(hash(i, 6) % 8 AS INTEGER) + 1] AS category,
CAST(hash(i, 7) % 10 AS INTEGER) + 1 AS quantity,
CAST((hash(i, 8) % 99901 + 100) / 100.0 AS DECIMAL(10,2)) AS unit_price,
CAST((CAST(hash(i, 7) % 10 AS INTEGER) + 1)
* CAST((hash(i, 8) % 99901 + 100) / 100.0 AS DECIMAL(10,2)) AS DECIMAL(12,2)) AS amount,
CASE WHEN hash(i, 9) % 50 = 0 THEN NULL
ELSE CAST(hash(i, 10) % 2000000 AS BIGINT) + 1 END AS customer_id
FROM range(p * 1000000 + 1, (p + 1) * 1000000 + 1) t(i);
COPY (FROM sales_part(0)) TO 'data/sales/part-00.parquet' (FORMAT parquet);
-- same for part-01 to part-09
% time ./bin/duckdb -no-agent -f data/gen_sales.sql
./bin/duckdb -no-agent -f data/gen_sales.sql 1.37s user 0.35s system 89% cpu 1.917 total
% du -sh data/sales
279M data/sales
I computed the expected values to check the results against later.
% ./bin/duckdb -no-agent -c "SELECT count(*) AS rows, sum(amount) AS total_amount, count(*) FILTER (WHERE customer_id IS NULL) AS null_customer, count(*) FILTER (WHERE pref_code = 99) AS unknown_pref, min(sale_date) AS min_date, max(sale_date) AS max_date FROM 'data/sales/*.parquet';"
┌──────────┬────────────────┬───────────────┬──────────────┬────────────┬────────────┐
│ rows │ total_amount │ null_customer │ unknown_pref │ min_date │ max_date │
│ int64 │ decimal(38,2) │ int64 │ int64 │ date │ date │
├──────────┼────────────────┼───────────────┼──────────────┼────────────┼────────────┤
│ 10000000 │ 27530683812.61 │ 200859 │ 10075 │ 2026-01-01 │ 2026-11-30 │
└──────────┴────────────────┴───────────────┴──────────────┴────────────┴────────────┘
The prefecture master data/prefectures.csv is a 47-row CSV with 3 columns: pref_code, pref_name, and region.
pref_code,pref_name,region
1,北海道,北海道
2,青森県,東北
...
47,沖縄県,九州・沖縄
Uploading to S3 and creating the Glue table
I create an S3 bucket, upload the Parquet files, and create the database rsduck_demo and table sales in the Glue Data Catalog.
% aws s3 mb s3://rsduck-demo-123456789012-04940af9 --region ap-northeast-1
make_bucket: rsduck-demo-123456789012-04940af9
% aws s3 cp data/sales/ s3://rsduck-demo-123456789012-04940af9/sales/ --recursive --only-show-errors && aws s3 ls s3://rsduck-demo-123456789012-04940af9/sales/ --human-readable --summarize
2026-12-02 04:39:45 27.9 MiB part-00.parquet
2026-12-02 04:39:45 27.9 MiB part-01.parquet
...
2026-12-02 04:39:45 27.9 MiB part-09.parquet
Total Objects: 10
Total Size: 279.1 MiB
The table definition is the following JSON.
{
"Name": "sales",
"TableType": "EXTERNAL_TABLE",
"Parameters": {"classification": "parquet", "EXTERNAL": "TRUE"},
"StorageDescriptor": {
"Columns": [
{"Name": "sale_id", "Type": "bigint"},
{"Name": "sale_date", "Type": "date"},
{"Name": "sold_at", "Type": "timestamp"},
{"Name": "pref_code", "Type": "int"},
{"Name": "store_id", "Type": "int"},
{"Name": "category", "Type": "string"},
{"Name": "quantity", "Type": "int"},
{"Name": "unit_price", "Type": "decimal(10,2)"},
{"Name": "amount", "Type": "decimal(12,2)"},
{"Name": "customer_id", "Type": "bigint"}
],
"Location": "s3://rsduck-demo-123456789012-04940af9/sales/",
"InputFormat": "org.apache.hadoop.hive.ql.io.parquet.MapredParquetInputFormat",
"OutputFormat": "org.apache.hadoop.hive.ql.io.parquet.MapredParquetOutputFormat",
"SerdeInfo": {"SerializationLibrary": "org.apache.hadoop.hive.ql.io.parquet.serde.ParquetHiveSerDe"}
}
}
% aws glue create-database --region ap-northeast-1 --database-input '{"Name":"rsduck_demo","Description":"Redshift extension for DuckDB verification"}'
% aws glue create-table --region ap-northeast-1 --database-name rsduck_demo --table-input file://data/glue_table_sales.json
% aws glue get-table --region ap-northeast-1 --database-name rsduck_demo --name sales --query 'Table.StorageDescriptor.Columns' --output table
----------------------------------
| GetTable |
+--------------+-----------------+
| Name | Type |
+--------------+-----------------+
| sale_id | bigint |
| sale_date | date |
| sold_at | timestamp |
| pref_code | int |
| store_id | int |
| category | string |
| quantity | int |
| unit_price | decimal(10,2) |
| amount | decimal(12,2) |
| customer_id | bigint |
+--------------+-----------------+
In this account I haven't set the Lake Formation default permissions (grants to IAMAllowedPrincipals). Since I query from Express with the IAM role that created the database and table, I proceeded without granting additional permissions.
Enabling express configuration
From here I work in the Management Console. Opening the Redshift Serverless dashboard in the Amazon Redshift console showed the "Serverless with express configuration - new" screen. Under "General information" are the name express-default, the endpoint express-default.express.ap-northeast-1.redshift-serverless.amazonaws.com:5439/dev, the ARN, the JDBC URL, and the ODBC URL. As the documentation says, it was enabled the moment I opened this screen.

The max capacity was unset (-), in which case it scales up to 512 RPU. To keep test costs down, I chose "Edit" for "Max capacity" on the "Limits" tab and entered 64. Below the field, "The value must be from 64 to 1024 RPUs, in increments of 8." is displayed.

After choosing "Save changes", "Max capacity has been updated successfully for Serverless with express configuration." appeared and the max capacity became 64 RPU.

Checking the Glue table from Query Editor v2
Before connecting from DuckDB, I confirm in Query Editor v2 that Express can read the Glue table. "Redshift Serverless (SQL)" appears in the left tree, and expanding it shows three catalogs: "Redshift Catalog", "S3 Tables Catalog", and "AWS Glue Catalog". rsduck_demo was visible under AWS Glue Catalog.
I chose "Redshift Serverless (SQL)" as the editor's target and ran the following SQL.
SELECT current_user, count(*) AS rows, sum(amount) AS total_amount
FROM awsdatacatalog.rsduck_demo.sales;
| current_user | rows | total_amount |
|---|---|---|
| IAMR:cm-user | 10000000 | 27530683812.61 |
The row count and total amount matched the expected values, and the elapsed time was 1237 ms.

Starting the DuckDB UI
I start the DuckDB UI server. Since I keep it running in the background for this test, I feed standard input from tail -f /dev/null.
% tail -f /dev/null | ./bin/duckdb -no-agent -cmd "CALL start_ui_server();"
┌─────────────────────────────────────────────┐
│ result │
│ varchar │
├─────────────────────────────────────────────┤
│ UI server started at http://localhost:4213/ │
└─────────────────────────────────────────────┘
I opened http://localhost:4213/ in the browser and created an empty notebook. The following SQL was entered and run in notebook cells.
SELECT version() AS duckdb_version, platform FROM pragma_platform();
| duckdb_version | platform |
|---|---|
| v2.0.1 | osx_arm64 |
Installing the extension
I register the AWS extension repository under the hostname aws.amazon.com and install the redshift extension.
CREATE EXTENSION REPOSITORY IF NOT EXISTS aws.amazon.com;
INSTALL redshift FROM aws.amazon.com;
SELECT repository_name, key_fingerprints FROM duckdb_extension_repositories();
The three statements ran in 2.7 seconds, and the aws.amazon.com repository was registered together with its signing key fingerprint (sha256:57c7b512...). DuckDB uses this key to verify the signatures of extensions installed from the repository.

Next I load the extension and check the version. LOAD takes the repository name.
LOAD redshift FROM aws.amazon.com;
SELECT extension_name, loaded, installed, extension_version, installed_from
FROM duckdb_extensions()
WHERE extension_name IN ('redshift', 'aws', 'httpfs', 'ui');
| extension_name | loaded | installed | extension_version | installed_from |
|---|---|---|---|---|
| aws | false | false | ||
| httpfs | true | true | f71cfdb4bf | core |
| redshift | true | true | v1.1.0 | aws.amazon.com |
| ui | true | true | b19dfd587f | core |
redshift extension v1.1.0 was installed from aws.amazon.com and loaded.

Creating a secret and ATTACHing to express configuration
With DuckDB's aws extension, I create a secret from the credential chain. In this environment, temporary credentials for an IAM role are set in environment variables.
CREATE SECRET rs_secret (TYPE aws, PROVIDER credential_chain, REGION 'ap-northeast-1');
Then I ATTACH without specifying a target. Without a target, it connects to the express configuration in the secret's Region.
ATTACH '' AS rs (TYPE redshift, SECRET rs_secret);
I ran into two errors here.
The first happened when I wrote CREATE SECRET and ATTACH in the same cell of the DuckDB UI. ATTACH failed with the following error.
Invalid Configuration Error: Cannot attach rs: the aws or s3 secret the ATTACH named in SECRET, or chose for a cluster identifier path, does not exist: SECRET must name a DuckDB secret of type aws or s3
Even writing CREATE SECRET and SELECT ... FROM duckdb_secrets() in the same cell didn't list rs_secret. When I ran only CREATE SECRET in one cell it returned Success: true, and duckdb_secrets() in the next cell showed rs_secret (storage: memory). I couldn't confirm the reason, but in the DuckDB UI, running CREATE SECRET in its own cell and ATTACH in a separate cell was the reliable approach.
The second occurred when I ran ATTACH after creating the secret.
IO Error: Cannot attach rs: ODBCINI is set; the Redshift driver would read it, and it can change the driver's connection or security settings. Unset it to connect.

On this machine, I had earlier set ODBCINI in ~/.zprofile to use the Redshift ODBC driver. According to the extension documentation, if environment variables that can change the driver's connection or security settings (ODBCINI, some PG* variables, SSL_CERT_DIR, AWS_ENDPOINT_URL, etc.) are set in the DuckDB process, the extension refuses to connect.
% env | grep -E '^ODBC'
ODBCINI=/Users/user/.odbc.ini
ODBCSYSINI=/opt/amazon/redshift/Setup
Without changing ~/.zprofile, I restarted only the DuckDB process with ODBCINI removed.
% tail -f /dev/null | env -u ODBCINI ./bin/duckdb -no-agent -cmd "CALL start_ui_server();"
┌─────────────────────────────────────────────┐
│ result │
│ varchar │
├─────────────────────────────────────────────┤
│ UI server started at http://localhost:4213/ │
└─────────────────────────────────────────────┘
The notebook cells were saved, so after re-running the LOAD and CREATE SECRET cells, ATTACH succeeded in 1.1 seconds. rs was added under "ATTACHED DATABASES" on the left.

Checking the target with redshift_query
With redshift_query, I check the target's user, database, and version.
SELECT * FROM redshift_query('rs', 'SELECT current_user, current_database(), version()');
| current_user | current_database | version |
|---|---|---|
| IAMR:cm-user | dev | PostgreSQL 8.0.2 on i686-pc-linux-gnu, compiled by GCC gcc (GCC) 3.4.2 20041017 (Red Hat 3.4.2-6.fc3), Redshift 1.0.567987 |
The result returned in 90ms. The database user is IAMR:cm-user, determined from the IAM role name, and the database is dev.
The handle's tables aren't visible as a DuckDB catalog, so I check the Redshift-side database list with Redshift's SHOW DATABASES.
SELECT database_name, database_type, database_owner
FROM redshift_query('rs', 'SHOW DATABASES');
| database_name | database_type | database_owner |
|---|---|---|
| aws-s3@s3tablescatalog | auto mounted catalog | 1 |
| awsdatacatalog | auto mounted catalog | 1 |
| dev | local | 1 |
| rs-express-demo-tables@s3tablescatalog | auto mounted catalog | 1 |
Besides dev, the Glue Data Catalog (awsdatacatalog) and the catalogs of the S3 table buckets in this account were auto-mounted.
At first I guessed the column name and wrote database_options, which caused a DuckDB Binder Error. The error lists the Redshift result's column names (database_owner, database_type, database_name, database_isolation_level, database_acl) as candidates. The column names of redshift_query results are checked on the DuckDB side just like those of ordinary DuckDB tables.
Aggregating in Redshift and joining with the local CSV
I try the extension's main use case. Redshift aggregates the November data from 10 million rows by prefecture, and DuckDB joins that result with the local CSV and re-aggregates by region.
SELECT p.region,
sum(r.orders) AS orders,
sum(r.amount) AS amount
FROM redshift_query('rs', $$
SELECT pref_code, count(*) AS orders, sum(amount) AS amount
FROM awsdatacatalog.rsduck_demo.sales
WHERE sale_date BETWEEN '2026-11-01' AND '2026-11-30'
GROUP BY pref_code $$) r
JOIN read_csv('data/prefectures.csv') p USING (pref_code)
GROUP BY p.region
ORDER BY amount DESC;
| region | orders | amount |
|---|---|---|
| Chubu | 171435 | 472352768.56 |
| Kyushu/Okinawa | 152563 | 419581032.03 |
| Kanto | 133657 | 367709216.28 |
| Kinki | 133435 | 366059008.43 |
| Tohoku | 114528 | 315326536.48 |
| Chugoku | 95563 | 262381381.67 |
| Shikoku | 76252 | 210058485.89 |
| Hokkaido | 19039 | 52420466.14 |
8 rows came back in 1.4 seconds. Wrapping the Redshift SQL in $$ ... $$ lets you write single quotes inside without doubling them. On the DuckDB side, the types were HUGEINT for orders and DECIMAL(38,2) for amount.

Verifying the results
I compare the results Redshift returned against values computed from the local Parquet. Following the extension documentation's recommendation, I first saved the Redshift result into a DuckDB temporary table.
CREATE TEMP TABLE nov_by_pref AS
SELECT * FROM redshift_query('rs', $$
SELECT pref_code, count(*) AS orders, sum(amount) AS amount
FROM awsdatacatalog.rsduck_demo.sales
WHERE sale_date BETWEEN '2026-11-01' AND '2026-11-30'
GROUP BY pref_code $$);
48 rows (47 prefectures plus 99, which isn't in the master) were saved in 1.1 seconds.
WITH local_agg AS (
SELECT pref_code, count(*) AS orders, sum(amount) AS amount
FROM read_parquet('data/sales/*.parquet')
WHERE sale_date BETWEEN '2026-11-01' AND '2026-11-30'
GROUP BY pref_code
)
SELECT (SELECT count(*) FROM nov_by_pref) AS remote_rows,
(SELECT count(*) FROM local_agg) AS local_rows,
(SELECT count(*) FROM (FROM nov_by_pref EXCEPT FROM local_agg)) AS diff_rows,
(SELECT orders FROM nov_by_pref WHERE pref_code = 99) AS unknown_pref_orders;
| remote_rows | local_rows | diff_rows | unknown_pref_orders |
|---|---|---|---|
| 48 | 48 | 0 | 896 |
The difference between Redshift's aggregate and the local aggregate was 0 rows. There were 896 rows with pref_code = 99, which isn't in the master, in November, and the previous SQL's inner join (JOIN) excluded them from the aggregate. If you want to keep codes not in the master, use LEFT JOIN.

I also checked type and NULL handling.
SELECT * FROM redshift_query('rs', $$
SELECT * FROM awsdatacatalog.rsduck_demo.sales
WHERE customer_id IS NULL
ORDER BY sale_id LIMIT 3 $$);
| sale_id | sale_date | sold_at | pref_code | store_id | category | quantity | unit_price | amount | customer_id |
|---|---|---|---|---|---|---|---|---|---|
| 111 | 2026-01-30 | 2026-01-30 07:28:35 | 32 | 246 | Food | 10 | 290.61 | 2906.10 | NULL |
| 157 | 2026-10-29 | 2026-10-29 17:30:51 | 31 | 198 | Food | 10 | 461.99 | 4619.90 | NULL |
| 180 | 2026-06-25 | 2026-06-25 07:24:17 | 34 | 68 | Daily goods | 4 | 964.06 | 3856.24 | NULL |
The DuckDB-side types were BIGINT, DATE, TIMESTAMP, INTEGER, INTEGER, VARCHAR, INTEGER, DECIMAL(10,2), DECIMAL(12,2), and BIGINT. They correspond to the Glue table definition, and NULLs came back as NULL.
Writing to Parquet
I run the Redshift aggregation, the join with the local CSV, and the Parquet write in a single statement.
COPY (
SELECT p.region, sum(r.orders) AS orders, sum(r.amount) AS amount
FROM redshift_query('rs', $$
SELECT pref_code, count(*) AS orders, sum(amount) AS amount
FROM awsdatacatalog.rsduck_demo.sales
WHERE sale_date BETWEEN '2026-11-01' AND '2026-11-30'
GROUP BY pref_code $$) r
JOIN read_csv('data/prefectures.csv') p USING (pref_code)
GROUP BY p.region
ORDER BY amount DESC
) TO 'data/sales_by_region_202611.parquet' (FORMAT parquet);
Count 8 was returned in 1.0 seconds and the Parquet file was created. Reading it back gave the same values as the earlier result.
SELECT * FROM 'data/sales_by_region_202611.parquet';
However, the orders column read back as DOUBLE, though it was HUGEINT in DuckDB. If you want to keep it as an integer, specify the type before writing, such as sum(r.orders)::BIGINT.
Testing the limitations
I tried two limitations described in the documentation.
First, referencing the handle as a DuckDB catalog.
SELECT * FROM rs.public.sales LIMIT 1;
Catalog Error: Redshift handle "rs" cannot be browsed as a catalog: catalog access is not available. Query Redshift through the handle with redshift_query('rs', '<Redshift SQL>')
Second, using redshift_query on the same handle twice in one statement.
SELECT *
FROM redshift_query('rs', 'SELECT 1 AS id') a,
redshift_query('rs', 'SELECT 2 AS id') b;
Binder Error: redshift_query cannot use attach handle "rs" more than once in the same DuckDB statement. Each attach handle has one Redshift connection. Stage one result in a DuckDB temporary table in a separate statement, or use different attach handles. No Redshift statement was executed.
Both were rejected on the DuckDB side, and the errors explained how to work around them. As the second says "No Redshift statement was executed.", nothing is sent to Redshift. To combine two results from the same target, save one into a DuckDB temporary table as in the earlier test, or ATTACH another handle under a different name.
Writes and sessions in express configuration
Express configuration has no persistent storage. I tried creating a persistent table.
SELECT * FROM redshift_query('rs', 'CREATE TABLE public.rsduck_t1 (id INT)');
Binder Error: Redshift refused the statement: ERROR: Cannot execute CREATE TABLE: Persistent objects are not supported on Amazon Redshift Serverless with Express configuration.
SQLSTATE: 0A000
Redshift rejected it, and the error message and SQLSTATE were returned to DuckDB. Temporary tables can be created.
SELECT * FROM redshift_query('rs', $$
CREATE TEMP TABLE top_pref AS
SELECT pref_code, sum(amount) AS amount
FROM awsdatacatalog.rsduck_demo.sales
GROUP BY pref_code
ORDER BY amount DESC
LIMIT 5 $$);
Statements that return no result set return one row with a rowcount column. Here rowcount 0 came back in 1.6 seconds. From the next cell, I reference this temporary table and join it with the local CSV.
SELECT p.pref_name, t.amount
FROM redshift_query('rs', 'SELECT * FROM top_pref') t
JOIN read_csv('data/prefectures.csv') p USING (pref_code)
ORDER BY t.amount DESC;
| pref_name | amount |
|---|---|
| Osaka | 588690273.87 |
| Saitama | 588106965.18 |
| Shiga | 588097553.05 |
| Kagoshima | 588067124.41 |
| Gunma | 588008750.29 |
A handle holds one Redshift session per DuckDB connection, so temporary tables and SET values persist across cells. After running SET enable_result_cache_for_session TO off, running SHOW enable_result_cache_for_session in another cell returned off.
Entering Redshift SQL directly with CONNECT
After CONNECT rs;, all statements until DISCONNECT; are sent to Redshift as written. I tried this in the DuckDB UI too.
CONNECT rs;
SELECT current_user, getdate() AS redshift_now, count(*) AS rows
FROM awsdatacatalog.rsduck_demo.sales;
| current_user | redshift_now | rows |
|---|---|---|
| IAMR:cm-user | 2026-12-01 19:55:35 | 10000000 |
DISCONNECT;
The Redshift function getdate() returned a UTC time, showing it ran on Redshift even without wrapping in redshift_query. After DISCONNECT;, running SELECT current_database(), version(); returned memory and v2.0.1, back on the DuckDB side.

However, during CONNECT the column info panel on the right showed an error. The queries the DuckDB UI issues to display column info were also sent to Redshift and failed with "Redshift refused the statement: ERROR: schema "localmemdb" does not exist" (SQLSTATE 3F000). Looking at Redshift's query history later, the statement create table localmemdb._temp_... was recorded as failed 4 times. The documentation also says that during CONNECT, the queries issued by the DuckDB CLI's default prompt are sent to Redshift. In the DuckDB UI, I felt redshift_query is easier to use than CONNECT.
Comparing run times by where the processing happens
I ran the same aggregation (over all 10 million rows: count, total amount, and distinct customers per category) 3 times each, varying where it is processed.
- Aggregate on Express and receive only the 8 result rows in DuckDB
- Local DuckDB reads the same Parquet on S3 directly and aggregates
- (Reference) Local DuckDB aggregates Parquet on local disk
To equalize conditions, Redshift's result cache was disabled in an earlier step. On the DuckDB side, enable_external_file_cache, which keeps remote file contents in memory, was enabled (true) by default, so I disabled it. DuckDB threads is 10 and memory_limit is 25.5 GiB.
CREATE SECRET s3_secret (TYPE s3, PROVIDER credential_chain, REGION 'ap-northeast-1');
SET enable_external_file_cache = false;
The SQL for each is as follows.
-- (1) Aggregate on Express and receive only the result
SELECT * FROM redshift_query('rs', $$
SELECT category, count(*) AS orders, sum(amount) AS amount,
count(DISTINCT customer_id) AS customers
FROM awsdatacatalog.rsduck_demo.sales
GROUP BY category $$)
ORDER BY amount DESC;
-- (2) Local DuckDB reads Parquet on S3 directly and aggregates
SELECT category, count(*) AS orders, sum(amount) AS amount,
count(DISTINCT customer_id) AS customers
FROM read_parquet('s3://rsduck-demo-123456789012-04940af9/sales/*.parquet')
GROUP BY category
ORDER BY amount DESC;
-- (3) Reference: aggregate Parquet on local disk
SELECT category, count(*) AS orders, sum(amount) AS amount,
count(DISTINCT customer_id) AS customers
FROM read_parquet('data/sales/*.parquet')
GROUP BY category
ORDER BY amount DESC;
All three returned the same result.
| category | orders | amount | customers |
|---|---|---|---|
| Clothing | 1250002 | 3755795472.94 | 247953 |
| Food | 1249999 | 3754892417.24 | 247966 |
| Daily goods | 1250000 | 3753055204.78 | 247900 |
| Toys | 1250001 | 3751574932.24 | 247881 |
| Books | 1250001 | 3131738669.81 | 248320 |
| Beverages | 1249996 | 3130929655.98 | 248329 |
| Appliances | 1250001 | 3126662786.98 | 248334 |
| Pharmaceuticals | 1250000 | 3126034672.64 | 248357 |
The run times shown in the DuckDB UI are as follows.
| Pattern | Where it aggregates | 1st | 2nd | 3rd | Median |
|---|---|---|---|---|---|
| (1) Aggregate on Express | Redshift (max 64 RPU) | 1.4 s | 957ms | 805ms | 957ms |
| (2) Read Parquet on S3 directly | Local DuckDB | 5.5 s | 5.6 s | 4.8 s | 5.5 s |
| (3) Parquet on local disk | Local DuckDB | 153ms | 162ms | 134ms | 153ms |

For aggregating data on S3, (1) aggregating on Express was faster than (2) reading S3 directly with local DuckDB, by about 5.7x at the median. (2) pulls the Parquet on S3 to the local machine over the internet before aggregating, so results vary with your network conditions. On the other hand, (3) with data on local disk took 153ms, and at this scale (10 million rows, 279MB), DuckDB alone was the fastest.
Checking the query records in the console
I checked how the queries sent from DuckDB are recorded on the Redshift side, using Query Editor v2.
SELECT start_time, user_id, external_user_id, query_uuid, status,
elapsed_time/1000 AS elapsed_ms, substring(query_text, 1, 60) AS query_text
FROM sys_query_history
WHERE query_text LIKE '%rsduck_demo%'
ORDER BY start_time DESC LIMIT 20;
An excerpt follows (start_time is UTC; the role's unique ID is masked).
| start_time | user_id | external_user_id | status | elapsed_ms | query_text |
|---|---|---|---|---|---|
| 2026-12-01 19:57:16 | -1 | AROAXXXXXXXX@123456789012 | success | 767 | SELECT category, count(*) AS orders, ... |
| 2026-12-01 19:57:10 | -1 | AROAXXXXXXXX@123456789012 | success | 916 | SELECT category, count(*) AS orders, ... |
| 2026-12-01 19:56:55 | -1 | AROAXXXXXXXX@123456789012 | success | 1326 | SELECT category, count(*) AS orders, ... |
| 2026-12-01 19:55:42 | -1 | AROAXXXXXXXX@123456789012 | failed | 4 | create table localmemdb.temp... |
| 2026-12-01 19:55:34 | -1 | AROAXXXXXXXX@123456789012 | success | 665 | SELECT current_user, getdate() AS ... |
| 2026-12-01 19:54:31 | -1 | AROAXXXXXXXX@123456789012 | success | 1574 | CREATE TEMP TABLE top_pref AS ... |
As documented, in express configuration user_id is -1; users are identified by external_user_id (IAM unique ID@account ID) and queries by query_uuid. For comparison (1), the Redshift-side run times were 1,326ms, 916ms, and 767ms, 40 to 80ms less than the times shown in the DuckDB UI (1.4 s, 957ms, 805ms). Most of the elapsed time is Redshift execution time.

On the "Query and database monitoring" tab of the express configuration screen, you can see query counts and the RPU capacity used in graphs. The RPU capacity graph stayed at 64 RPU while queries were running and was 0 around 4:45 to 4:48, when I was dealing with ODBCINI. Since I set the max capacity to 64 RPU, it never exceeded 64 RPU.

Cleanup
In the DuckDB UI I ran DETACH rs; to close the Redshift session, then deleted the S3 bucket and the Glue database and table.
% aws glue delete-table --region ap-northeast-1 --database-name rsduck_demo --name sales && echo 'deleted table rsduck_demo.sales'
deleted table rsduck_demo.sales
% aws glue delete-database --region ap-northeast-1 --name rsduck_demo && echo 'deleted database rsduck_demo'
deleted database rsduck_demo
% aws s3 rm s3://rsduck-demo-123456789012-04940af9/ --recursive
delete: s3://rsduck-demo-123456789012-04940af9/sales/part-04.parquet
...
delete: s3://rsduck-demo-123456789012-04940af9/sales/part-09.parquet
% aws s3 rb s3://rsduck-demo-123456789012-04940af9
remove_bucket: rsduck-demo-123456789012-04940af9
I also confirmed in the S3 and Glue consoles that the bucket and database no longer exist. Express configuration is billed only while queries run, so I left it enabled and left the max capacity at 64 RPU.
Discussion
Choosing where to split the work
In these results, when data is on local disk, DuckDB alone at 153ms was fastest even for 10 million rows, so there was no reason to send queries to Redshift. When data is on S3, however, aggregating on Express and receiving only 8 rows (median 957ms) was faster than local DuckDB reading S3 directly (median 5.5 s).
I think this extension suits the following cases.
- The data is in S3, S3 Tables, or Redshift managed storage, and you want to aggregate it without downloading it
- You want to handle data volumes that your local machine's memory or CPU can't process
- You want to join aggregated results with local CSV or Parquet and process them further
If you finish filtering and aggregation inside the Redshift SQL and return only small results to DuckDB, both the transferred data and DuckDB-side processing shrink.
Caveats
Here are the points I got stuck on in testing, plus the limitations in the documentation.
- The DuckDB version is pinned. The extension build loads only on the DuckDB version it was built with (currently v2.0.1). When you update DuckDB, reinstall the extension
- Some environment variables block connection. In environments where
ODBCINIis set to use the Redshift ODBC driver, you need to remove it from the DuckDB process - In the DuckDB UI, run
CREATE SECRETin its own cell. The created secret wasn't visible to later statements in the same cell - During
CONNECT, the DuckDB UI's own queries are also sent to Redshift. The column info panel's queries failed on Redshift - Authentication is IAM only. Database users and passwords, the driver's IAM Identity Center plugin, IdP plugins such as Okta, and Kerberos can't be used (IAM Identity Center works if you turn credentials obtained with
aws sso logininto a DuckDB secret) - Running queries can't be canceled from DuckDB, and there is no statement timeout. Even with Ctrl-C, the query runs to completion on Redshift. To cancel, run
pg_cancel_backendfrom another connection - NULL can't be passed via
params. Write NULL in the SQL - Express configuration has no persistent storage. Creating persistent tables is rejected; you can use temporary tables, Iceberg writes, and datashare writes
Cost
Express configuration is billed per second in RPU-hours like Redshift Serverless, with a 60-second minimum. Base capacity is fixed at 64 RPU, so using 64 RPU for 60 seconds in Tokyo costs 64 RPU × 1/60 hour × $0.494/RPU-hour = about $0.53.
In this console's RPU capacity graph, 64 RPU persisted while I ran queries intermittently, for about 12 minutes in total. Calculated on that basis, it's about $6.3 (check the actual bill in Billing and Cost Management). If you don't set a max capacity it scales up to 512 RPU, so for testing or personal use, setting a max capacity caps the RPU used by a single query.
What I'd like to see next
- Cancellation and statement timeouts for
redshift_query - Being able to reference the handle's tables as a DuckDB catalog
- Keeping up with newer DuckDB versions
Conclusion
I tried the Amazon Redshift extension for DuckDB against Redshift Serverless express configuration, announced the same day. Express configuration is enabled just by opening its screen in the console, and I could connect from the DuckDB UI with ATTACH '' AS rs (TYPE redshift, SECRET rs_secret). Aggregating 10 million rows on S3 in Redshift, joining the result with a local CSV, and writing it to Parquet all ran in a single DuckDB SQL statement.
A job that took 5.5 seconds when aggregating S3 data locally took 957ms on Express. When data is local, DuckDB alone is faster, so the extension's strength is that, depending on where the data is and how much there is, you can choose within SQL whether DuckDB or Redshift does the processing.
If you use DuckDB daily and keep downloading data from S3 or Redshift, get DuckDB v2.0.1 and give it a try. Watch out for the DuckDB version and environment variables such as ODBCINI.
