--- layout: docu railroad: statements/set.js title: SET and RESET Statements --- The `SET` statement modifies the provided DuckDB [configuration option]({% link docs/preview/configuration/overview.md %}) at the specified scope. ## Examples Update the `memory_limit` configuration value: ```sql SET memory_limit = '10GB'; ``` Configure the system to use `1` thread: ```sql SET threads = 1; ``` Or use the `TO` keyword: ```sql SET threads TO 1; ``` Change configuration option to default value: ```sql RESET threads; ``` Retrieve configuration value: ```sql SELECT current_setting('threads'); ``` Set the default collation for the session: ```sql SET SESSION default_collation = 'nocase'; ``` ### Set a Global Variable Set the default sort order globally: ```sql SET GLOBAL sort_order = 'desc'; ``` Set the default threads globally: ```sql SET GLOBAL threads = 4; ``` ## Syntax
`SET` updates a DuckDB configuration option to the provided value. ## `RESET`
The `RESET` statement changes the given DuckDB configuration option to the default value. ## Scopes Configuration options can have different scopes: * `GLOBAL`: Configuration value is used (or reset) across the entire DuckDB instance. * `SESSION`: Configuration value is used (or reset) only for the current session attached to a DuckDB instance. * `LOCAL`: Not yet implemented. When not specified, the default scope for the configuration option is used. For most options this is `GLOBAL`. > `GLOBAL` settings apply to the current DuckDB instance. They are not written to the database file or persisted across DuckDB instances. If all connections to an instance are closed and a new instance is started, configuration options use their defaults unless they are set again. For example, the `TimeZone` option has a default scope of `GLOBAL`, so the following two statements are equivalent, and both change the time zone for every session connected to the instance: ```sql SET TimeZone = 'UTC'; SET GLOBAL TimeZone = 'UTC'; ``` To change the time zone for the current session only, without affecting other sessions on the same instance, use the `SESSION` scope explicitly: ```sql SET SESSION TimeZone = 'UTC'; ``` ## Configuration See the [Configuration]({% link docs/preview/configuration/overview.md %}) page for the full list of configuration options.