Configuring EDB Postgres Tuner
To run EDB Postgres Tuner, you need to add it to the shared_preload_libraries and create the extension in the database. EDB Postgres Tuner can then gather metrics to make tuning recommendations.
In the
postgresql.conffile, addedb_pg_tunerto theshared_preload_librariesparameter:shared_preload_libraries = 'edb_pg_tuner'
Note
If
shared_preload_librarieshas other extensions, then you can addedb_pg_tunerto the list. The order doesn't matter.Restart Postgres.
Create the EDB Postgres Tuner extension in your database:
CREATE EXTENSION edb_pg_tuner;
Parameters
The following custom GUCs control the EDB Postgres Tuner extension behavior. If you modify these parameters, then reload Postgres to apply the changes.
edb_pg_tuner.autotune— Applies tuning recommendations. The default isfalse.edb_pg_tuner.naptime— Sets the interval between each check in seconds. The default is 600 seconds (10 minutes).edb_pg_tuner.max_wal_size_limit— Sets the maximum value for themax_wal_sizerecommendation. The default is0, which sets no limit.
The following custom GUCs control the EDB Postgres Tuner work_mem tuning behavior for Postgres 14 and later.
edb_pg_tuner.tune_work_mem— Dynamically increases the work mem for queries with disk spill to improve performance. The default istrue.edb_pg_tuner.work_mem_pool— Maximum additional work_mem reserve that's allocated to queries with disk spill. The default is 2GB.edb_pg_tuner.log_min_duration— Execution time threshold in ms for statistics logging. The default is 0, which logs everything. The value -1 turns off logging.edb_pg_tuner.buffer_size— Maximum query count for tracking statistics. The default is 5000.edb_pg_tuner.container_memory_limit_file_path— Specifies the path to the file that contains the memory limit set by the container runtime, such as Docker or Kubernetes. This file is read byedb_pg_tunerto determine the maximum amount of memory available to the database process when running inside a container. Based on this limit, the tuner can generate optimized PostgreSQL configuration recommendations that are container aware. The file is at/sys/fs/cgroup/memory/memory.limit_in_bytesby default.
Recommended GUCs
EDB Postgres Tuner can recommend the following GUCs. The static category provides fixed recommendation settings. The dynamic category uses specific algorithms to suggest a better setting according to your workload or hardware resources.
| GUC | Category | Recommendation | Version |
|---|---|---|---|
| autovacuum | static | on | |
| checkpoint_completion_target | static | 0.9 | |
| effective_cache_size | dynamic | based on resources | |
| enable_async_append | static | on | |
| enable_bitmapscan | static | on | |
| enable_gathermerge | static | on | |
| enable_group_by_reordering | static | on | |
| enable_hashagg | static | on | |
| enable_hashjoin | static | on | |
| enable_incremental_sort | static | on | 13+ |
| enable_indexonlyscan | static | on | |
| enable_indexscan | static | on | |
| enable_material | static | on | |
| enable_memoize | static | on | 14+ |
| enable_mergejoin | static | on | |
| enable_nestloop | static | on | |
| enable_parallel_append | static | on | 11+ |
| enable_parallel_hash | static | on | 11+ |
| enable_partition_pruning | static | on | 11+ |
| enable_partitionwise_aggregate | static | on | |
| enable_partitionwise_join | static | on | |
| enable_seqscan | static | on | |
| enable_sort | static | on | |
| enable_tidscan | static | on | |
| fsync | static | on | |
| full_page_writes | static | on | |
| log_checkpoints | static | on | |
| max_wal_size | dynamic | based on workload | |
| maintenance_work_mem | dynamic | based on resources | |
| parallel_leader_participation | static | on | |
| seq_page_cost | static | 1.0 | |
| shared_buffers | dynamic | based on resources | |
| track_activities | static | on | |
| track_counts | static | on | |
| zero_damaged_pages | static | on |
Note
For EDB Postgres Advanced Server, if edb_pg_tuner.autotune is enabled, a service restart may be required:
- Version 15 or later: Any GUC that requires a restart is set when the service starts, therefore you don't need to restart the service to apply the recommendations.
- Version 14 and earlier: You need to restart the service.
- On this page
- Parameters
- Recommended GUCs
Could this page be better? Report a problem or suggest an addition!