ALTER SYSTEM

|           ALTER SYSTEM           |                       |            |                  |                            |
|:--------------------------------:|-----------------------|------------|------------------|----------------------------|
|[Prev](sql-altersubscription.html)|[Up](sql-commands.html)|SQL Commands|[Home](index.html)| [Next](sql-altertable.html)|

---

[]()

## ALTER SYSTEM

ALTER SYSTEM — change a server configuration parameter

## Synopsis

```
ALTER SYSTEM SET configuration_parameter { TO | = } { value | 'value' | DEFAULT }

ALTER SYSTEM RESET configuration_parameter
ALTER SYSTEM RESET ALL

```

## Description

`ALTER SYSTEM` is used for changing server configuration parameters across the entire database cluster. It can be more convenient than the traditional method of manually editing the `postgresql.conf` file. `ALTER SYSTEM` writes the given parameter setting to the `postgresql.auto.conf` file, which is read in addition to `postgresql.conf`. Setting a parameter to `DEFAULT`, or using the `RESET` variant, removes that configuration entry from the `postgresql.auto.conf` file. Use `RESET ALL` to remove all such configuration entries.

 Values set with `ALTER SYSTEM` will be effective after the next server configuration reload, or after the next server restart in the case of parameters that can only be changed at server start. A server configuration reload can be commanded by calling the SQL function `pg_reload_conf()`, running `pg_ctl reload`, or sending a SIGHUP signal to the main server process.

 Only superusers can use `ALTER SYSTEM`. Also, since this command acts directly on the file system and cannot be rolled back, it is not allowed inside a transaction block or function.

## Parameters

*`configuration_parameter`*

 Name of a settable configuration parameter. Available parameters are documented in [Chapter 20](runtime-config.html).

*`value`*

 New value of the parameter. Values can be specified as string constants, identifiers, numbers, or comma-separated lists of these, as appropriate for the particular parameter. `DEFAULT` can be written to specify removing the parameter and its value from `postgresql.auto.conf`.

## Notes

 This command can't be used to set [data\_directory](runtime-config-file-locations.html#GUC-DATA-DIRECTORY), nor parameters that are not allowed in `postgresql.conf` (e.g., [preset options](runtime-config-preset.html)).

 See [Section 20.1](config-setting.html) for other ways to set the parameters.

## Examples

 Set the `wal_level`:

```
ALTER SYSTEM SET wal_level = replica;

```

 Undo that, restoring whatever setting was effective in `postgresql.conf`:

```
ALTER SYSTEM RESET wal_level;

```

## Compatibility

 The `ALTER SYSTEM` statement is a PostgreSQL extension.

## See Also

[SET](sql-set.html), [SHOW](sql-show.html)

---

|[Prev](sql-altersubscription.html)|[Up](sql-commands.html)| [Next](sql-altertable.html)|
|:---------------------------------|:---------------------:|---------------------------:|
|        ALTER SUBSCRIPTION        |  [Home](index.html)   |         ALTER TABLE        |

 // \<![CDATA[ \<-- For SVG support if ('WebSocket' in window) { (function() { function refreshCSS() { var sheets = [].slice.call(document.getElementsByTagName("link")); var head = document.getElementsByTagName("head")[0]; for (var i = 0; i \< sheets.length; ++i) { var elem = sheets[i]; head.removeChild(elem); var rel = elem.rel; if (elem.href && typeof rel != "string" || rel.length == 0 || rel.toLowerCase() == "stylesheet") { var url = elem.href.replace(/(&|\\?)\_cacheOverride=\\d+/, ''); elem.href = url + (url.indexOf('?') \>= 0 ? '&' : '?') + '\_cacheOverride=' + (new Date().valueOf()); } head.appendChild(elem); } } var protocol = window.location.protocol === 'http:' ? 'ws://' : 'wss://'; var address = protocol + window.location.host + window.location.pathname + '/ws'; var socket = new WebSocket(address); socket.onmessage = function(msg) { if (msg.data == 'reload') window.location.reload(); else if (msg.data == 'refreshcss') refreshCSS(); }; console.log('Live reload enabled.'); })(); } // ]]\>