Introduction
A .duckdb file is a database made by DuckDB,
an analytical SQL database that, like SQLite, runs
inside the program that uses it and keeps a whole database in one file. Where SQLite is
built for many small reads and writes, DuckDB is built for queries over large tables,
and stores its data by column.
DuckDB was first released in 2019 by researchers at CWI in Amsterdam. Its storage
format changed between early releases; since version 1.0 in 2024 newer releases can
read files written by older ones. Files are also given .db or
.ddb.
Structure
The file is made of fixed-size blocks. It starts with a main header, whose bytes 8 to
11 are the text DUCK, followed by the storage version number. Two database
headers come next; DuckDB writes them in turn, so one of them always points to the last
complete checkpoint.
The rest of the file holds the catalogue of schemas and tables and the table data.
Each table is split into row groups, and each column of a row group is stored and
compressed on its own. While a database is open, recent changes are kept in a
write-ahead log beside it, with .wal added to the file name.
Links
Software
Developers
- DuckDB client APIs for Python, R, Java, Node.js, Rust, Go and others
Reference
- Storage, the DuckDB documentation on the file format and its versions