TimescaleDB tuning tool
To help make configuring TimescaleDB a little easier, you can use the timescaledb-tune tool. This tool handles setting the most common parameters to good values based on your system. It accounts for memory, CPU, and PostgreSQL version. timescaledb-tune is packaged with the TimescaleDB binary releases as a dependency, so if you installed TimescaleDB from a binary release (including Docker), you should already have access to the tool. Alternatively, you can use the go install command to install it:
2. go install github.com/timescale/timescaledb-tune/cmd/[email protected]
The timescaledb-tune tool reads your system’s postgresql.conf file and offers interactive suggestions for your settings. Here is an example of the tool running:
2. Using postgresql.conf at this path:
4. /usr/local/var/postgres/postgresql.conf
6. Is this correct? [(y)es/(n)o]: y
8. Writing backup to:
10. /var/folders/cr/example/T/timescaledb_tune.backup202101071520
12. shared_preload_libraries needs to be updated
14. Current:
16. #shared_preload_libraries = 'timescaledb'
18. Recommended:
20. shared_preload_libraries = 'timescaledb'
22. Is this okay? [(y)es/(n)o]: y
24. success: shared_preload_libraries will be updated
26. Tune memory/parallelism/WAL and other settings? [(y)es/(n)o]: y
28. Recommendations based on 8.00 GB of available memory and 4 CPUs for PostgreSQL 12
30. Memory settings recommendations
32. Current:
34. shared_buffers = 128MB
36. #effective_cache_size = 4GB
38. #maintenance_work_mem = 64MB
40. #work_mem = 4MB
42. Recommended:
44. shared_buffers = 2GB
46. effective_cache_size = 6GB
48. maintenance_work_mem = 1GB
50. work_mem = 26214kB
52. Is this okay? [(y)es/(s)kip/(q)uit]:
When you have answered the questions, the changes are written to your postgresql.conf and take effect when you next restart.
If you are starting on a fresh instance and don’t want to approve each group of changes, you can automatically accept and append the suggestions to the end of your postgresql.conf by using some additional flags when you run the tool:
2. $ timescaledb-tune --quiet --yes --dry-run >> /path/to/postgresql.conf
