Change Postgres parameters
Orchard sets Postgres defaults for you and sizes shared_buffers from the memory limit of the database. When a workload needs something different, such as a longer statement timeout or more connections, you can change a set of parameters yourself. Some parameters restart the database when you save them.
Prerequisites
Section titled “Prerequisites”- Edit access to the project: the Admin or Member project role.
- A dedicated database.
Change a parameter
Section titled “Change a parameter”- Open the database.
- Go to Settings > Parameters.
- Update the values.
- Select Save. If the change requires a restart, the page shows
Saving restarts the databasenext to the button.
To read the current values, run the following command:
orchard db settings get <id>To set a value, run the following command:
orchard db settings set <id> statement_timeout=30000To remove a value, leave it empty:
orchard db settings set <id> statement_timeout=Available parameters
Section titled “Available parameters”| Dashboard label | Parameter | Default | Range or values | Restart |
|---|---|---|---|---|
| Max connections | max_connections | 100 | 10 to 500 | Yes |
| Shared buffers | shared_buffers | Automatic | Memory value in kB, MB, or GB | Yes |
| Work memory | work_mem | 4MB | Memory value in kB, MB, or GB | No |
| Maintenance work memory | maintenance_work_mem | 64MB | Memory value in kB, MB, or GB | No |
| Effective cache size | effective_cache_size | 4GB | Memory value in kB, MB, or GB | No |
| Slow query log (ms) | log_min_duration_statement | -1 | -1 to 600000. -1 turns this off. | No |
| Statement timeout (ms) | statement_timeout | 0 | 0 to 3600000. 0 turns this off. | No |
| Idle-in-transaction timeout (ms) | idle_in_transaction_session_timeout | 0 | 0 to 3600000. 0 turns this off. | No |
| Synchronous commit | synchronous_commit | on | on, off, local, remote_write, remote_apply | No |
Shared buffers
Section titled “Shared buffers”By default, Orchard sizes shared_buffers from the database’s memory limit. When you change the memory limit, Orchard recalculates the value.
If you enter a value, Orchard uses that value exactly. If the value is large for the current memory limit, the page shows a warning. To return to automatic sizing, clear the field.
Values changed outside Orchard
Section titled “Values changed outside Orchard”If a running value differs from the saved value, the parameter row shows the running value and the text changed outside Orchard.
Related resources
Section titled “Related resources”- Use a connection pooler - Serve more clients without raising
max_connections. - Monitor a database - Find slow queries before you change timeouts or memory settings.
orchard db settingsreference - Review the settings commands.