wiki/duckdb/duckdb-en.md
[ AliSQL DuckDB 引擎 | DuckDB in AliSQL ]
DuckDB is an open-source embedded analytical database system (OLAP) designed for data analysis workloads. DuckDB is rapidly becoming a popular choice in data science, BI tools, and embedded analytics scenarios due to its key characteristics:
MySQL has long lacked an analytical query engine. While InnoDB is naturally designed for OLTP and excels in TP scenarios, its query efficiency is very low for analytical workloads. This integration enables:
AliSQL integrates DuckDB as a native AP engine, empowering users with high-performance, lightweight analytical capabilities while maintaining a seamless, MySQL-compatible experience.
MySQL's pluggable storage engine architecture allows it to extend its capabilities through different storage engines:
The architecture consists of four main layers:
DuckDB analytical read-only instances use a read-write separation architecture:
Compatibility:
AliSQL allows DuckDB nodes to serve as replicas via Binlog synchronization. By re-engineering the transaction commit and replay processes, AliSQL overcomes the lack of 2PC support in DuckDB, ensuring full data and metadata consistency even after abnormal crashes.
Idempotent Replay:
DML Replay Optimization:
Test Environment:
| Query ID | DuckDB | InnoDB | ClickHouse |
|---|---|---|---|
| q1 | 0.92 | 1134.25 | 3.47 |
| q2 | 0.15 | 1800 | 1.52 |
| q3 | 0.53 | 802.94 | 3.65 |
| q4 | 0.46 | 1000.45 | 2.77 |
| q5 | 0.5 | 1800 | 5.38 |
| q6 | 0.22 | 566.73 | 0.73 |
| q7 | 0.59 | 1800 | 6.06 |
| q8 | 0.68 | 1800 | 6.99 |
| q9 | 1.44 | 1800 | 13.29 |
| q10 | 0.91 | 894.35 | 3.22 |
| q11 | 0.11 | 79.63 | 1.1 |
| q12 | 0.44 | 734.35 | 1.69 |
| q13 | 1.59 | 454.15 | 5.85 |
| q14 | 0.38 | 574.07 | 0.83 |
| q15 | 0.31 | 568.43 | 1.53 |
| q16 | 0.32 | 63.56 | 0.52 |
| q17 | 0.89 | 1800 | 7.96 |
| q18 | 1.59 | 1800 | 3.11 |
| q19 | 0.8 | 1800 | 2.96 |
| q20 | 0.51 | 1800 | 3.38 |
| q21 | 1.64 | 1800 | OOM |
| q22 | 0.33 | 361.4 | 4 |
| total | 15.31 | 25234.31 | 80.01 |
DuckDB demonstrates significant performance advantages over InnoDB in analytical query scenarios, with up to 200x improvement.
You can experience RDS MySQL with DuckDB engine on Alibaba Cloud:
https://help.aliyun.com/zh/rds/apsaradb-rds-for-mysql/duckdb-based-analytical-instance/