Manual PostgreSQL configuration and tuning
Manually configure your self-hosted database using the PostgreSQL configuration file
If you prefer to tune settings yourself, or for settings not covered by
timescaledb-tune, you can manually configure your installation using the
PostgreSQL configuration file.
For some common configuration settings you might want to adjust, see the about configuration page.
For more information about the PostgreSQL configuration page, see the PostgreSQL documentation.
Edit the PostgreSQL configuration file
Section titled “Edit the PostgreSQL configuration file”The location of the PostgreSQL configuration file depends on your operating system and installation.
- Find the location of the config file for your instance
-
Connect to your database:
Terminal window psql -d "postgres://<username>:<password>@<host>:<port>/<database-name>" -
Retrieve the database file location from the database internal configuration.
SHOW config_file;PostgreSQL returns the path to your configuration file. For example:
--------------------------------------------/home/postgres/pgdata/data/postgresql.conf(1 row)
-
- Open the config file, then edit your PostgreSQL configuration
See the PostgreSQL documentation for details on available settings.
Terminal window vi /home/postgres/pgdata/data/postgresql.conf - Save your updated configuration
When you have saved the changes you make to the configuration file, the new configuration is not applied immediately. PostgreSQL re-reads the file when the server receives a
SIGHUPsignal. To send it, connect withpsqlas a superuser and run:SELECT pg_reload_conf();You can also run
pg_ctl reloadfrom a shell. On Debian and Ubuntu package installs,pg_ctlis not on the path; usepg_ctlcluster <VERSION> main reloadinstead.Settings that require a restart are not applied by a reload. To see which settings are waiting for a restart, query
pg_settingsfor rows wherepending_restartistrue.
Setting parameters at the command prompt
Section titled “Setting parameters at the command prompt”If you don't want to open the configuration file to make changes, you can also
set parameters directly from the command prompt, using the postgres command.
For example:
postgres -c log_connections=yes -c log_destination='syslog'