pgx
PGX — Lightweight Postgres for AI agents. Written in Rust. Thousands of isolated databases in one runtime. 🐘
翻譯準備中
個人 GitHub 帳號下公開儲存庫的擁有者可以登入並驗證所有權,自行管理介紹,無需管理員核准。
登入並產生驗證檔案,在 30 分鐘內將其提交至此儲存庫的預設分支。其他分支或分叉儲存庫中的檔案無效。然後在下方檢查檔案,即可無需管理員核准直接管理專案。請保留檔案以維持管理權限。
如需登入,將前往登入頁面。登入後請回到此處,再次點擊所選的驗證按鈕。
在專案資料夾中執行 /nomorevibe verify,即可驗證所有權並自行管理介紹。
一分鐘完成驗證GPU-native composable analytics engine
翻譯準備中
取自儲存庫 README
正在載入完整 README。
檢視完整 README ↗Sirius is a GPU-Native Composable Analytics Engine. It plugs into existing databases via the standard Substrait query format, requiring no query rewrites or major system changes. Sirius currently supports DuckDB and Starrocks (coming soon), other systems marked with * are on our roadmap. Built on NVIDIA CUDA-X libraries including cuDF, cuVS, and cuCascade, Sirius delivers high-performance GPU-accelerated analytics.
Use separate connections to one DuckDB DatabaseInstance and set startup
sirius.max_concurrent_queries (default 1). See the concurrent-query guide
for admission, maintenance, cancellation, memory pressure and qualification scope.
TPC-H hot runs on AWS, 22 queries · best Sirius g7e size vs DuckDB on m9g.16xlarge · cost per run, log scales · lower left is better.
For the legacy Sirius implementation used for the ClickBench results, see the
legacy-dev archive (pinned at f79a6f42).
glibc >= 2.28.io_uring enabled at runtime (CONFIG_IO_URING, kernel.io_uring_disabled=0 recommended). Containers must allow io_uring_setup, io_uring_enter, and io_uring_register.O_DIRECT).Getting started? Download one of our prebuilt extensions instead of building from source:
stable: a maintainer-selected build, promoted manuallylatest: tracks the newest successful build on main automatically, possible to encounter breaking changesBoth include full install instructions in the release notes: installing a matching DuckDB version, downloading the right binary for your platform, and a sample query to try it with.
For full build instructions, alternate build types, pre-commit setup, and testing, see DEVELOPMENT.md.
Quick start:
git clone --no-recurse-submodules https://github.com/sirius-db/sirius.git
cd sirius
git submodule update --init --depth=1 --jobs 5 duckdb substrait cucascade sirius-duckdb/duckdb sirius-duckdb/extension-ci-tools
pixi run make TEST_BUILD_TARGET=
pixi run duckdb
Alternatively, load the extension into an existing DuckDB shell:
LOAD 'sirius-duckdb/build/release/extension/sirius/sirius.duckdb_extension';
Either way, all DuckDB queries are automatically intercepted by the optimizer hook and run on GPU — no query rewrites required. Queries with unsupported operators fall back silently to CPU.
-- Load the TPC-H extension and generate data (scale factor 10 = ~10 GB)
INSTALL tpch;
LOAD tpch;
CALL dbgen(sf=10);
-- Plain SQL runs on GPU automatically
SELECT l_returnflag, sum(l_quantity)
FROM lineitem
GROUP BY l_returnflag
ORDER BY l_returnflag;
-- TPC-H data is exported as Parquet for use in later examples
COPY lineitem TO '/path/to/lineitem.parquet' (FORMAT PARQUET);
-- Disable transparent GPU execution for this connection
SET gpu_execution = false;
-- ... or for every connection of this database instance without a session value
SET GLOBAL gpu_execution = false;
Execution is out-of-core with tiered memory management (GPU/host/disk), automatic data partitioning, and spilling, and works with both Parquet and DuckDB-native storage. See gpu_execution for build, configuration, and testing details.
Use Sirius through DuckDB's Python API: load the extension, execute SQL, and fetch results. Supported queries run on the GPU automatically, just as they do in the DuckDB shell.
The v2 extension requires the exact DuckDB revision pinned in this repository. Use the built CLI above. The default environment's DuckDB 1.5 Python package cannot load this extension; Python use requires a package built from the matching revision.
Save this example as example.py in the repository root and replace /path/to/lineitem.parquet
with your TPC-H Parquet file. allow_unsigned_extensions allows loading the locally built
extension.
import duckdb
con = duckdb.connect(":memory:", config={"allow_unsigned_extensions": "true"})
con.execute("""
CREATE VIEW lineitem AS
SELECT * FROM read_parquet('/path/to/lineitem.parquet')
""")
con.execute("LOAD 'sirius-duckdb/build/release/extension/sirius/sirius.duckdb_extension'")
rows = con.execute("""
SELECT l_returnflag, SUM(l_quantity) AS total_quantity
FROM lineitem
GROUP BY l_returnflag
ORDER BY l_returnflag
""").fetchall()
print(rows)
con.close()
Run it from the repository root:
pixi run python example.py
For an example using TPC-H data from Parquet files or a DuckDB database, see the Python benchmark script.
The Python benchmark and power/throughput runners require a Python DuckDB client built from the pinned v2 revision; the default environment's 1.5 client cannot load this extension. The CLI-based scripts use the built v2 host.
Sirius reads table data from storage on every query. For the best hot-run performance, pin
frequently queried tables: pin_table materializes a table's columns into memory once, and
subsequent queries over that source are served straight from the pinned copy, skipping file
I/O and decode entirely. Queries don't change — pinned tables are matched automatically.
-- Pin a parquet file (or glob) into GPU memory; omit cols to pin all columns
CALL pin_table('/path/to/lineitem.parquet', name = 'lineitem', tier = 'gpu',
cols = ['l_orderkey', 'l_quantity', 'l_extendedprice', 'l_shipdate']);
-- Pin a DuckDB base table
CALL pin_table(format = 'duckdb', name = 'my_table', tier = 'gpu');
-- Served from the pinned copy — no file I/O
SELECT sum(l_extendedprice * l_quantity)
FROM read_parquet('/path/to/lineitem.parquet')
WHERE l_shipdate >= DATE '1994-01-01';
-- Release the pinned memory
CALL unpin_table('lineitem');
tier = 'gpu' pins columns in GPU memory for the fastest scans; tier = 'host' pins them in
pinned host memory instead, for tables larger than GPU memory.
Deletes and committed inserts on pinned DuckDB tables are reconciled per query. UPDATE,
MERGE ... UPDATE, and INSERT ... ON CONFLICT DO UPDATE are rejected while the target table is
pinned; run CALL unpin_table(...) before updating it. An explicit CHECKPOINT while a pin is
live makes that pin ineligible to serve: subsequent queries fall back or error until the table is
unpinned and pinned again.
Sirius can use Simpatico to compress pinned data in GPU or host memory. After loading Sirius,
set both compression options before calling pin_table. This example runs from the
repository root and uses the bundled TPC-H SF1000 compression plans:
SET pin_table_compression = true;
SET pin_table_input_compression_plan_dir = 'src/compression/simpatico_codegen/plans/tpch_sf1000';
CALL pin_table('/path/to/lineitem.parquet', name = 'lineitem', tier = 'gpu',
cols = ['l_returnflag', 'l_quantity']);
-- Normal SQL reads the compressed pinned data automatically
SELECT l_returnflag, SUM(l_quantity) AS total_quantity
FROM read_parquet('/path/to/lineitem.parquet')
GROUP BY l_returnflag
ORDER BY l_returnflag;
CALL unpin_table('lineitem');
Use tier = 'host' to pin compressed data in host memory. For other datasets, point the plan
directory at plans matching your table schemas. A plan file must match the pinned table's
name (for example, lineitem.txt) and contain one column plan per full-table column in schema
order. Tables without a matching plan, small batches, and batches with insufficient compression
savings remain uncompressed. To change whether an existing pin is compressed, unpin and pin it
again. Restart the process when changing a previously loaded compression plan.
From Python, execute the same SQL with con.execute(...) after loading the extension and before
querying. See the compressed pinning guide for plan selection
and tuning.
Sirius loads its settings from a YAML config file, searched in this order:
SIRIUS_CONFIG_FILE environment variable./sirius.yaml (current working directory)~/.sirius/sirius.yamlIf no config file is found, built-in defaults apply (95% GPU memory, 8 GiB pinned host memory per NUMA node). See the Configuration reference for all options: memory tiers, thread pools, operator parameters, and runtime SET variables. An example config is provided at test/cpp/integration/integration.yaml.
Sirius uses spdlog for logging messages during query execution. Default log directory is log (relative to the current working directory) and default log level is info.
Log directory and level can be initialized via environment variables before loading the extension:
export SIRIUS_LOG_DIR=/path/to/logs
export SIRIUS_LOG_LEVEL=trace
Both can also be configured at runtime via DuckDB's SET command:
SET sirius_log_dir = '/path/to/logs';
SET sirius_log_level = 'trace';
SET sirius_log_flush_seconds = 1;
Note: Tracing is experimental and the telemetry schema may change.
Sirius instruments query execution with Quent, emitting per-query traces of operator and pipeline activity that Quent can render as an interactive browser timeline. Enable it in your YAML config file,
sirius:
telemetry:
enable_quent: true
output_directory: telemetry_data
run queries, then visualize:
pixi run quent # serves Quent UI at http://localhost:8080
See the Quent Telemetry guide for the full setup details: enabling the exporter, per-query labeling, generating telemetry (using a TPC-H helper), and visualization.
Sirius is under active development. Notable current limitations include:
Data Type Coverage: Sirius currently supports commonly used data types including INTEGER, BIGINT, FLOAT, DOUBLE, VARCHAR, DATE, TIMESTAMP, and DECIMAL. We are actively working on supporting additional data types—such as nested types.
Operator Coverage: At present, Sirius supports FILTER, PROJECTION, JOIN (Hash/Nested Loop/Delim), GROUP-BY, ORDER-BY, AGGREGATION, TOP-N, LIMIT, and CTE. We are working on adding more advanced operators such as WINDOW functions and ASOF JOIN.
DuckDB v2 regex rewrites: Whole-input backreference replacements, including the ClickBench Q28 URL pattern, are rewritten to regexp_extract(..., 'k') and currently require CPU fallback instead of using the GPU regex implementation. Tracked in #2146.
For a full list of current limitations and ongoing work, please refer to our GitHub issues page. Unsupported types and operators fall back to DuckDB CPU execution when fallback is enabled.
Sirius is still under major development and we are working on adding more features to Sirius, such as multi-node, more operators, data types, accelerating more engines, and many more.
Sirius always welcomes new contributors! If you are interested, check our website, reach out to our email, or join our slack channel.
Let's kickstart the GPU eras for Data Analytics!