Get Started with GPU-Accelerated DuckDB Analytics Using the Sirius Core Extension
Learn how to install Sirius, run supported DuckDB SQL queries on NVIDIA GPUs, and compare analytical query performance and compute costs. This guide covers the workflow for accelerating queries without rewriting SQL.
Tags
Quick summary
Learn how to install Sirius, run supported DuckDB SQL queries on NVIDIA GPUs, and compare analytical query performance and compute costs. This guide covers the workflow for accelerating queries without rewriting SQL.
Get Started with GPU-Accelerated DuckDB Analytics Using the Sirius Core Extension
As datasets grow in size and complexity, analytical queries can take longer to run, slowing down data exploration, pipelines, and applications. For developers using DuckDB, reducing query times helps keep analytics responsive and can lower compute costs. To address these challenges, NVIDIA and DuckLabs collaborated to release Sirius as a DuckDB core extension, bringing GPU acceleration directly to DuckDB’s analytical query engine.
Sirius is an open-source, GPU-native SQL engine developed through a collaboration between the University of Wisconsin–Madison and NVIDIA. This integration allows users to accelerate supported analytical queries on NVIDIA GPUs without rewriting SQL or changing database schemas. The core extension brings this capability into DuckDB’s standard workflow: install Sirius, load it, and run your queries.
Installation and Workflow
Getting started with Sirius requires DuckDB 2.0 and an NVIDIA GPU with a compatible driver. The process is designed to be seamless, retaining familiar SQL syntax while leveraging GPU parallelism for supported workloads.
To begin, you must install the extension directly from DuckDB. The workflow involves two specific SQL commands: INSTALL sirius; and LOAD sirius;. These commands download and activate the extension in the current connection. The core extension automatically selects the CUDA backend for your driver.
Once installed, you can execute supported analytical queries on NVIDIA GPUs without translating them into a separate GPU programming API. DuckDB handles SQL parsing and optimization, while Sirius executes the resulting query plans on the GPU. If a query contains unsupported features, the system automatically falls back to DuckDB’s CPU engine, ensuring reliability without manual intervention.
Running a Sample Query
To illustrate the workflow, you can create a small analytical dataset using DuckDB’s TPC-H extension. This extension creates example tables, including lineitem, which contains order line items. It supplies sample data for the walkthrough and is separate from the Sirius extension.
First, open DuckDB with a file-backed database:
duckdb getting_started.duckdbNext, use the TPC-H extension to generate the dataset. The INSTALL tpch; and LOAD tpch; commands load the extension, followed by CALL dbgen(sf=0.01); to generate the data. Finally, the CHECKPOINT statement persists the generated data so Sirius can read the native DuckDB tables.
INSTALL tpch;
LOAD tpch;
CALL dbgen(sf=0.01);
CHECKPOINT;With the data prepared and Sirius loaded, you can run an analytical query. The following example groups line items by return flag and calculates the total quantity for each group:
SELECT l_returnflag, SUM(l_quantity) AS total_quantity FROM lineitem GROUP BY l_returnflag ORDER BY l_returnflag;The output displays the return flag and the aggregated quantity:
| l_returnflag | total_quantity |
|---|---|
| A | 380456.00 |
| N | 774222.00 |
| R | 381449.00 |
This small dataset keeps setup quick and illustrates how to use Sirius; it is not intended to demonstrate a performance advantage. You can apply the same approach to your own DuckDB tables or supported Parquet workflows.
Query Execution Architecture
Sirius integrates GPU execution into DuckDB’s query-processing workflow. The application receives query results through DuckDB, preserving the interface used by existing scripts and applications. This integration lets developers continue expressing analytical operations in SQL while using GPU parallelism for supported workloads.
In this architecture, DuckDB remains the application’s SQL interface and handles query parsing and optimization. Sirius executes supported queries on the GPU and returns results through the same connection. This separation of concerns ensures that the familiar SQL workflow remains intact while backend performance is enhanced.
Performance Benchmarks and Cost Analysis
NVIDIA evaluated Sirius against CPU-based DuckDB using cold runs of queries derived from the TPC-H benchmark. The tests covered scale factors of 100 (100 GB), 1,000 (1 TB), 3,000 (3 TB), and 10,000 (10 TB), measuring total query runtime and query-time compute cost under default and tuned settings. These tests used pinned development builds.
The results highlight significant improvements in both speed and efficiency. With tuned settings, Sirius running on AWS instances with two NVIDIA GPUs delivered 3.25x to 5.50x speedups over the best tested CPU-based DuckDB configurations.
At a scale factor of 1,000 (1 TB), total query runtime fell from 347.3 seconds to 63.2 seconds. At a scale factor of 3,000 (3 TB), runtime dropped from 752.4 seconds to 160.6 seconds, delivering a 4.69x speedup. Query-time compute cost at this scale also decreased by approximately 71%.
The largest cost advantage appeared at a scale factor of 10,000 (10 TB). The tuned two-GPU configuration completed the workload in 729.9 seconds compared with 2,369.4 seconds for the best tested CPU-based DuckDB configuration. This represents a 3.25x speedup and approximately 79% lower query-time compute cost.
The results also show how workload size affects configuration choices. At a scale factor of 100, one GPU offered the lowest cost, while two GPUs delivered the shortest runtime. At a scale factor of 10,000, the tuned two-GPU configuration outperformed the tuned single-GPU configuration in both runtime and cost. Tuning was particularly important at this scale: at a scale factor of 10,000, the default configuration with two GPUs was marked "did not finish," while the tuned configuration completed the workload in 729.9 seconds.
Next Steps and Community Resources
The Sirius core extension brings GPU-accelerated analytics into DuckDB’s familiar SQL workflow. Install the extension, run the example, and explore how GPU execution applies to your data. As your data grows, use Sirius to accelerate supported queries while keeping your SQL, tools, and workflow in DuckDB.
For additional guidance, the Sirius repository provides a benchmark runner, query definitions, configuration details, and setup instructions for reviewing the test setup and evaluating performance on your own hardware. Results will vary with query structure, dataset size, hardware, and cache conditions.
Developers are encouraged to share their results and feedback with the Sirius community. Join the Sirius Slack community to connect with other users and contribute to the project's development.
By leveraging Sirius, organizations can reduce query times, lower compute costs, and maintain the efficiency of their data pipelines without the overhead of rewriting complex SQL queries.
Source: https://developer.nvidia.com/blog/get-started-with-gpu-accelerated-duckdb-analytics-using-the-sirius-core-extension



