Skip to main content
By default, TimescaleDB uses the default server configuration settings. However, in some cases, these settings are not appropriate, especially if you have larger servers that use more hardware resources such as CPU, memory, and storage. This section explains the settings you are most likely to need to adjust. Some of these settings are settings, and some are TimescaleDB-specific settings. For most changes, you can use the tuning tool to adjust your configuration. For more advanced configuration settings, or to change settings that aren’t included in the timescaledb-tune tool, you can manually adjust the postgresql.conf configuration file.

Manual configuration

If you prefer to tune settings yourself, or for settings not covered by timescaledb-tune, you can manually configure your installation using the configuration file. For more information about the configuration page, see the documentation.

Edit the configuration file

The location of the configuration file depends on your operating system and installation.
  1. Find the location of the config file for your instance Connect to your database:
    Retrieve the database file location from the database internal configuration:
    returns the path to your configuration file. For example:
  2. Open the config file, then edit your configuration
  3. Save your updated configuration When you save the changes you make to the configuration file, the new configuration is not applied immediately. The configuration file is automatically reloaded when the server receives a SIGHUP signal. To manually reload the file, use the pg_ctl command.

Set 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:

Memory settings

You can adjust these settings to match your machine’s available memory:
  • shared_buffers
  • effective_cache_size
  • work_mem
  • maintenance_work_mem
  • max_connections
To make it easier, you can use the PgTune site to work out what settings to use. Enter your machine details, and select the data warehouse DB type to see the suggested parameters.
You can adjust these settings with timescaledb-tune.

Worker settings

uses worker pools to provide workers for live queries and background s. If you do not configure these settings, your queries and background s could run more slowly. Configure these worker settings:
  • timescaledb.max_background_workers
  • max_parallel_workers
  • max_worker_processes

Background workers

TimescaleDB background workers are configured with timescaledb.max_background_workers. Each database needs a background worker allocated to schedule s. Additional workers run background s as required. This setting should be the sum of the total number of databases and the total number of concurrent background workers you want running at any one time. By default, timescaledb-tune sets timescaledb.max_background_workers to 16. You can change this setting directly, use the --max-bg-workers flag, or adjust the TS_TUNE_MAX_BG_WORKERS Docker environment variable.

Parallel workers

TimescaleDB parallel workers are configured with max_parallel_workers. For larger queries, automatically uses parallel workers if they are available. Increasing this setting can improve query performance for large queries that trigger the use of parallel workers. By default, this setting corresponds to the number of CPUs available. You can change this parameter directly, by adjusting the --cpus flag, or by using the TS_TUNE_NUM_CPUS Docker environment variable.

Worker processes

The max_worker_processes setting defines the total pool of workers available to both background and parallel workers, as well a small number of built-in workers. It should be at least the sum of timescaledb.max_background_workers and max_parallel_workers.
You can adjust these settings with timescaledb-tune.

Disk write settings

By default, disk writes are performed synchronously, so each transaction must be completed and a success message sent, before the next transaction can begin. You can change this to asynchronous to increase write throughput by setting synchronous_commit = 'off'. Note that disabling synchronous commits could result in some committed transactions being lost. To help reduce the risk, do not also change fsync setting. For more information about asynchronous commits and disk write speed, see the documentation.
You can adjust these settings in the postgresql.conf configuration file.

Transaction lock settings

TimescaleDB relies on table partitioning to scale time-series workloads. A needs to acquire locks on many s during queries, which can exhaust the default limits for the number of allowed locks held. In some cases, you might see a warning like this:
To avoid this issue, increase the max_locks_per_transaction setting from the default value, which is usually 64. This parameter limits the average number of object locks used by each transaction. Individual transactions can lock more objects as long as the locks of all transactions fit in the lock table. For most workloads, choose a number equal to double the maximum number of s you expect to have in a divided by max_connections. This takes into account that the number of locks used by a query is roughly equal to the number of s in the if you need to access all s in a query, or double that number if the query uses an index. You can see how many s you currently have using the timescaledb_information.hypertables view. Changing this parameter requires a database restart, so make sure you pick a larger number to allow for some growth. For more information about lock management, see the documentation.
You can adjust these settings in the postgresql.conf configuration file.

TimescaleDB configuration settings

Just as you can tune settings in , provides a number of configuration settings that may be useful to your specific installation and performance needs. You can set these within the postgresql.conf file or as command-line parameters when starting .

Query planning and execution

timescaledb.enable_chunkwise_aggregation (bool)
If enabled, aggregations are converted into partial aggregations during query planning. The first part of the aggregation is executed on a per- basis. Then, these partial results are combined and finalized. Splitting aggregations decreases the size of the created hash tables and increases data locality, which speeds up queries.
timescaledb.vectorized_aggregation (bool)
Enables or disables the vectorized optimizations in the query executor. For example, the sum() aggregation function on compressed s can be optimized in this way.
timescaledb.enable_merge_on_cagg_refresh (bool)
Set to ON to dramatically decrease the amount of data written on a in the presence of a small number of changes, reduce the I/O cost of refreshing a , and generate fewer Write-Ahead Logs (WAL). Only works for s that don’t have compression enabled.

Policies

timescaledb.max_background_workers (int)
Maximum background worker processes allocated to . Set to at least 1 + the number of databases loaded with the extension in a instance. Default value is 16.

tuning

timescaledb.disable_load (bool)
Disables the loading of the actual extension.

Administration

timescaledb.restoring (bool)
Sets TimescaleDB in restoring mode. Disabled by default.
timescaledb.license (string)
Changes access to features based on the TimescaleDB license in use. For example, setting timescaledb.license to apache limits TimescaleDB to features that are implemented under the Apache 2 license. The default value is timescale, which allows access to all features.
timescaledb.telemetry_level (enum)
Telemetry settings level. Level used to determine which telemetry to send. Can be set to off or basic. Defaults to basic.
timescaledb.last_tuned (string)
Records last time timescaledb-tune ran.
timescaledb.last_tuned_version (string)
Version of timescaledb-tune used to tune when it runs.

Complete list of GUC parameters

For a complete list, see the Grand Unified Configuration (GUC) parameters reference.