duckdb / duckdb-web

DuckDB website and documentation
https://duckdb.org
MIT License
144 stars 278 forks source link

Temporary Directory docs #2468

Closed Tishj closed 4 months ago

Tishj commented 4 months ago

There's very little to be found in the documentation about the temporary directory

One little nugget of behavior that just stumped me while working on https://github.com/duckdb/duckdb/pull/10978 is this https://github.com/duckdb/duckdb/pull/437 In in-memory mode, the temp directory defaults to ".tmp"

And even on a persistent database, we set the temp directory to a default, always

    if (config_ptr->options.temporary_directory.empty() && database_path) {
        // no directory specified: use default temp path
        config_ptr->options.temporary_directory = string(database_path) + ".tmp";

        // special treatment for in-memory mode
        if (strcmp(database_path, IN_MEMORY_PATH) == 0) {
            config_ptr->options.temporary_directory = ".tmp";
        }
    }
Tishj commented 4 months ago

Maybe we should start here https://duckdb.org/docs/configuration/overview The default value says it's left empty, but this is not true

szarnyasg commented 4 months ago

This is generated from code:

FROM duckdb_settings() WHERE name = 'temp_directory';
┌────────────────┬─────────┬────────────────────────────────────────────────┬────────────┐
│      name      │  value  │                  description                   │ input_type │
│    varchar     │ varchar │                    varchar                     │  varchar   │
├────────────────┼─────────┼────────────────────────────────────────────────┼────────────┤
│ temp_directory │         │ Set the directory to which to write temp files │ VARCHAR    │
└────────────────┴─────────┴────────────────────────────────────────────────┴────────────┘
Tishj commented 4 months ago

Hmm fair enough, yea at initialization of the db it's set