---
title: Configuration parameters | Tiger Data Docs
description: Configure your TimescaleDB instance including settings related to memory, workers, disk writes, and transactional locks
---

By default, TimescaleDB uses the default PostgreSQL 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 PostgreSQL settings, and some are TimescaleDB-specific settings. For most changes, you can use the [tuning tool](/docs/deploy/self-hosted/configuration/timescaledb-config/index.md) 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 PostgreSQL configuration

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 more information about the PostgreSQL configuration page, see the [PostgreSQL documentation](https://www.postgresql.org/docs/current/config-setting.html).

### Edit the PostgreSQL configuration file

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

1. **Find the location of the config file for your PostgreSQL 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)
   ```

2. **Open the config file, then [edit your PostgreSQL configuration](https://www.postgresql.org/docs/current/config-setting.html)**

   Terminal window

   ```
   vi /home/postgres/pgdata/data/postgresql.conf
   ```

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:

```
postgres -c log_connections=yes -c log_destination='syslog'
```

## 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](https://pgtune.leopard.in.ua/) site to work out what settings to use. Enter your machine details, and select the `data warehouse` DB type to see the suggested parameters.

Tips

You can adjust these settings with `timescaledb-tune`.

## Worker settings

PostgreSQL uses worker pools to provide workers for live queries and background jobs. If you do not configure these settings, your queries and background jobs 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 jobs. Additional workers run background jobs 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](/docs/deploy/self-hosted/configuration/docker-config/index.md).

### Parallel workers

TimescaleDB parallel workers are configured with `max_parallel_workers`. For larger queries, PostgreSQL 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](/docs/deploy/self-hosted/configuration/docker-config/index.md).

### 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 PostgreSQL workers. It should be at least the sum of `timescaledb.max_background_workers` and `max_parallel_workers`.

Tips

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 [PostgreSQL documentation](https://www.postgresql.org/docs/current/wal-async-commit.html).

Tips

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 hypertable needs to acquire locks on many chunks 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:

```
psql: FATAL:  out of shared memory
HINT:  You might need to increase max_locks_per_transaction.
```

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 chunks you expect to have in a hypertable divided by `max_connections`. This takes into account that the number of locks used by a hypertable query is roughly equal to the number of chunks in the hypertable if you need to access all chunks in a query, or double that number if the query uses an index.

You can see how many chunks you currently have using the [`timescaledb_information.hypertables`](/docs/reference/timescaledb/informational-views/hypertables/index.md) 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 [PostgreSQL documentation](https://www.postgresql.org/docs/current/runtime-config-locks.html).

Tips

You can adjust these settings in the `postgresql.conf` configuration file.

## TimescaleDB configuration settings

Just as you can tune settings in PostgreSQL, TimescaleDB 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 PostgreSQL.

### 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-chunk 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 chunks 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 continuous aggregate in the presence of a small number of changes, reduce the I/O cost of refreshing a [continuous aggregate](/docs/build/continuous-aggregates/create-a-continuous-aggregate/index.md), and generate fewer Write-Ahead Logs (WAL). Only works for continuous aggregates that don’t have compression enabled.

### Policies

##### `timescaledb.max_background_workers (int)`

Maximum background worker processes allocated to TimescaleDB. Set to at least 1 + the number of databases loaded with the TimescaleDB extension in a PostgreSQL instance. Default value is 16.

### Tiger Cloud service 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](/docs/reference/timescaledb/configuration/gucs/index.md) reference.
