Skip to content

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.

The location of the PostgreSQL configuration file depends on your operating system and installation.

  1. Find the location of the config file for your instance
    1. Connect to your database:

      Terminal window
      psql -d "postgres://<username>:<password>@<host>:<port>/<database-name>"
    2. 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)
  2. 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
  3. 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 SIGHUP signal. To send it, connect with psql as a superuser and run:

    SELECT pg_reload_conf();

    You can also run pg_ctl reload from a shell. On Debian and Ubuntu package installs, pg_ctl is not on the path; use pg_ctlcluster <VERSION> main reload instead.

    Settings that require a restart are not applied by a reload. To see which settings are waiting for a restart, query pg_settings for rows where pending_restart is true.

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'