# TursoDB vs DuckDB

> TursoDB and DuckDB are complementary rather than direct substitutes. Choose DuckDB for in-process analytical scans, aggregations, and direct querying over Parquet, Arrow, or S3 data lakes; choose TursoDB for transactional OLTP state, frequent point lookups/updates, concurrent writes, and local-to-cloud sync.
> Canonical HTML: https://tursodb.cn/compare/turso-vs-duckdb/
> Language: en
> DuckDB Official Site: https://duckdb.org/

## Overview
Both TursoDB and DuckDB run embedded inside your application process with zero server daemon, which leads developers to compare them. Under the hood, they optimize for opposite access patterns: TursoDB is a row-oriented transactional SQLite-compatible engine, whereas DuckDB is a C++ vectorized columnar OLAP engine.

## Comparison Matrix
| Dimension | TursoDB | DuckDB |
| :--- | :--- | :--- |
| Core Engine | Row-oriented Rust B-trees — SQLite-compatible transactional storage with native async I/O | Vectorized columnar C++ — SIMD batch execution with columnar compression and late materialization |
| Deployment Model | Embedded + cloud sync — In-process library with optional sync and managed Turso Cloud | In-process analytics library — Python, R, Node, Rust, Go, C++, CLI, and WASM over files/S3 |
| Concurrency & Writes | High-frequency OLTP MVCC — Frequent point inserts/updates via BEGIN CONCURRENT concurrent writes | Bulk append optimized — Built for batch loads and scans, not high-frequency multi-writer OLTP |
| Sync & Edge Replication | Native bidirectional sync — Built-in local-to-cloud sync and embedded read replicas | No built-in OLTP sync — Cloud workflows use MotherDuck or shared Parquet on S3/Iceberg |
| Multi-Tenant Isolation | Per-tenant OLTP scale — Lightweight isolated databases locally and across Turso Cloud | Per-job analytical files — Single-writer file locking limits multi-process OLTP tenant workloads |
| Vector & AI Search | Built-in DiskANN vectors — Operational vector columns for RAG and AI agent memory | VSS / HNSW extension — Fixed-size arrays and HNSW aimed at analytical similarity workloads |
| SQL Dialect & Ecosystem | SQLite CRUD dialect — Standard application ORM and transactional query ecosystem | Analytical SQL + lake formats — Native Parquet, CSV, JSON, Arrow, Iceberg, and S3/HTTPFS readers |
| License | MIT permissive license — Open-source core with no copyleft restrictions | MIT permissive license — Open-source C++ core freely embeddable in commercial tools |

## Verified Real-Hardware Benchmarks
> Environment: Intel(R) Xeon(R) E-2288G CPU @ 3.70GHz (8c) · kvm · Linux 6.8.0-147-generic · io_uring=ENABLED · Turso 0.8.4 · Recorded 2026-12-05T19:14:15Z

### OLTP Single-Row Point Writes (Prepared · 5000 tx · bun 1.4.5) (higher is better)
| Engine / Series | Value | Notes |
| :--- | :--- | :--- |
| TursoDB Row OLTP (bun 1.4.5) | 2518.8 ops/s | - |
| DuckDB Columnar (Prepared) | 1173.9 ops/s | - |

### OLAP GROUP BY Aggregation (100,000 rows · median · bun 1.4.5) (lower is better)
| Engine / Series | Value | Notes |
| :--- | :--- | :--- |
| TursoDB OLAP GROUP BY (100,000 rows) | 33.17 ms | - |
| DuckDB Native Columnar (100,000 rows) | 3.8 ms | - |
| DuckDB ATTACH → TursoDB .db (zero-copy) | 20.24 ms | Verified 100,000 rows |

### Key Takeaways
- With hoisted prepared statements on BOTH engines, TursoDB outperformed DuckDB by 2.15× on 5,000 single-row OLTP commits (2,519 vs 1,174 ops/s on Bun; 2,324 vs 1,191 ops/s on Node.js), while DuckDB columnar led by 8.7× on 100k-row OLAP GROUP BY (3.80 ms vs 33.17 ms, 5-run median).
- Hybrid zero-ETL architecture verified: after WAL checkpoint, DuckDB directly ATTACHed the TursoDB .db file (100,000 rows verified) and completed the OLAP aggregation in 20.24 ms median—1.64× faster than row-store scan without copying data.

## When to Choose TursoDB
- Your app performs frequent point lookups, row updates, user sessions, or transactional writes (OLTP).
- You need local-to-cloud sync, embedded read replicas, or managed multi-tenant database orchestration.
- You are building AI agents or SaaS apps storing operational state and vector embeddings in one file.
- You want SQLite file-format compatibility with low memory overhead per open database.

## When to Choose DuckDB
- You need fast aggregations, window functions, and multi-million-row scans over wide analytical datasets.
- You want to query Parquet, CSV, Apache Arrow, Iceberg, or S3 buckets directly with zero ETL.
- You are building data-science pipelines, BI dashboards, or local ETL scripts in Python, R, or Node.
- Your workload is read-heavy or batch-append rather than high-frequency single-row mutations.

## Architecture Deep Dive
### Row-Oriented B-Trees vs. Vectorized Columnar Storage
TursoDB stores complete rows on B-tree pages so fetching or updating a single user record touches only a handful of kilobytes, keeping latency in the microsecond range. DuckDB compresses values column-by-column into row groups and processes thousands of values per CPU vector batch—delivering orders-of-magnitude faster GROUP BY and SUM queries while making tiny single-row updates expensive.

### Using Both Together in One Architecture
Because both engines are MIT-licensed and run in-process, many teams pair them cleanly instead of forcing one to do both jobs. TursoDB handles operational application state, per-tenant writes, and cloud sync, while DuckDB attaches directly to exported snapshots or Parquet logs to run heavy analytical reporting.

## FAQ
### Can DuckDB query SQLite or TursoDB files directly?
Yes. DuckDB ships a built-in SQLite scanner extension that can read standard SQLite-format .db files directly for ad-hoc analytical queries.

### Why shouldn’t I use DuckDB for a standard CRUD web backend?
DuckDB’s columnar row-group format and single-process write model are optimized for bulk scans and batch loads, not thousands of tiny concurrent INSERT/UPDATE transactions or multi-device cloud sync.

### Is TursoDB good for analytics over 100 GB Parquet files?
No. For multi-gigabyte analytical scans over Parquet or S3 object storage, DuckDB’s vectorized columnar engine is vastly faster and purpose-built for the task.
