LinuxWindows

Where Does DuckDB Store Databases and Extensions?

DuckDB has no fixed database directory. A database file is created where the path given on the CLI or ATTACH points.

Last updated

Running duckdb with no argument opens an in memory database that is lost on exit. Running duckdb mydata.duckdb or ATTACH 'mydata.duckdb' creates a persistent file at that exact path with sidecar .wal and .tmp files during writes.

Extensions, CLI history, and CLI startup commands do have fixed home based locations. Extensions are versioned and platform qualified under a .duckdb folder in the user home.

Where DuckDB stores this, by platform

Linux
./my_database.duckdb

No default location. File is created in the current working directory if a bare name is given. Common extensions are .duckdb, .db, and .ddb. Temp spill defaults to .tmp next to the db file for on disk databases.

Linux
~/.duckdb/extensions/<version>/<platform>/

Example: ~/.duckdb/extensions/v1.3.2/linux_amd64/httpfs.duckdb_extension. Change with SET extension_directory='/path/to/dir'. CLI extras are ~/.duckdbrc (startup sql) and ~/.duckdb_history. Setting home_directory does not relocate extensions.

Windows
.\my_database.duckdb

Same semantics as Linux. Example: C:\Users\<user>\data\my_database.duckdb via duckdb C:\Users\<user>\data\my_database.duckdb. In memory is default when no path is supplied. Sidecar .wal appears next to the file on writes.

Windows
%USERPROFILE%\.duckdb\extensions\<version>\<platform>\

Example: C:\Users\<user>\.duckdb\extensions\v1.3.2\windows_amd64\. Same SET extension_directory override. CLI startup file and history resolve under %USERPROFILE% in the same .duckdb pattern.

Frequently asked questions

What file extension should a DuckDB database use?

Any extension works, but .duckdb is the clearest choice, with .db and .ddb also common. Pick one and keep it consistent so scripts and backup rules can match the file.

How do I install extensions to a custom folder?

Run SET extension_directory = '/path/to/dir' before INSTALL and LOAD (example: INSTALL httpfs). Verify with SELECT extension_name, installed_from FROM duckdb_extensions() and check the versioned subdirectory that DuckDB creates automatically.

Notice an outdated path? Let us know.