# Full example
The example below its used by the UI
:
$ curl 'https://api.pgconfig.org/v1/tuning/get-config?environment_name=WEB&format=alter_system&include_pgbadger=true&log_format=stderr&max_connections=100&pg_version=9.6&total_ram=2GB'
1
# How the values are calculated?
Default values are set in the pkg/category
package (opens new window). Take by example the Checkpoint Configuration category (opens new window):
// ...
return &CheckpointCfg{
MinWALSize: config.Byte(2 * config.GB),
MaxWALSize: config.Byte(3 * config.GB),
CheckpointCompletionTarget: 0.5,
WALBuffers: -1, // -1 means automatic tuning
CheckpointSegments: 16,
}
1
2
3
4
5
6
7
8
2
3
4
5
6
7
8
Once the default values are set, they are computed based in the input, set in the pkg/rules
package (opens new window). Take by example the storage rules (opens new window):
// ...
func computeStorage(in *config.Input, cfg *category.ExportCfg) (*category.ExportCfg, error) {
switch in.DiskType {
case "SSD":
cfg.Storage.EffectiveIOConcurrency = 200
case "SAN":
cfg.Storage.EffectiveIOConcurrency = 300
default:
cfg.Storage.EffectiveIOConcurrency = 2
}
if in.DiskType != "HDD" {
cfg.Storage.RandomPageCost = 1.1
}
return cfg, nil
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
The rules are computed in the following order (opens new window):
- Arch
- OS
- Profile
- Storage
- Postgres Version