Movatterモバイル変換


[0]ホーム

URL:



Facebook
Postgres Pro
Facebook
Downloads
pgpro_tune
Prev UpPostgres Pro Server ApplicationsHome Next

pgpro_tune

pgpro_tune — a command-line tool for automatic tuning

Synopsis

pgpro_tune [option...] [-D |--pgdata ] directory preset_name

Description

Thepgpro_tune utility is a command-line tool for automatic tuning. Optimal values for different configuration parameters ofPostgres Pro depend on the hardware configuration. Thepgpro_tune utility collects information about the system and transforms it into a set of parameters written into the configuration file.

Usage

The use ofpgpro_tune is enabled ininitdb by default. There are twoinitdb options for this tool:--no-tune disables its usage,--tune=OPTIONS allows passing additional options for thepgpro_tune run.

Firstpgpro_tune runs the default preset. Additional presets may be provided by using-P or--preset=NAME option, or specifying the preset name as the last command-line argument. To disable the default preset, use the--no-default option.

Additional options may be passed via-O or--options=OPTIONS parameter for any preset, but for the default preset--default-options=OPTIONS should be used.

Additional environment variables can be set for presets with the--set NAME=VALUE parameter. These values will be the same both for the default preset and all custom presets.

By default, the presets are placed in theshare directory, but you can specify their location manually in the--preset-dir=NAME parameter.

By default,pgpro_tune works with thepostgresql.conf configuration file located in the data directory. The data directory can be specified with-D or--pgdata=DATADIR, or provided with environment variablePGDATA. When runingpgpro_tune frominitdb, the tool will use the data directory ofinitdb.

Configuration file can also be specified with--config-file=FILENAME.

Thepgpro_tune tool writes its changes into a separate block at the end of the configuration file, which is commented as added bypgpro_tune. For details, seethe example of the preset.

Options

--config-file=filename

Specifies the main configuration file name.

-Ddatadir
--pgdata=datadir

Specifies the directory where the database cluster should be stored.

--default-options=options

Specifies parameters for the default preset.

--no-default

Disables the default preset. Note that in this case another preset must be specified anyway either with the-P option or as the last parameter with the preset name.

-Opreset-options
--options=preset-options

Specifies options to be passed directly to the preset that was previously specified in the-P parameter or to the preset indicated as the last command-line parameter, if-P was not used.

-Pname
--preset=name

Specifies the preset name. If several names are indicated, presets are executed in turn, taking into account the output of the previous preset.

Note

The preset name may be specified either with this option or as the last parameter. Using both will cause an error.

--preset-dir=name

Specifies the directory containing presets. By default, presets are located in theshare directory.

--setname=value

Sets the environment variable for presets.

--show

Shows all available presets from the directory specified in the--preset-dir option, if it is set, or from the default directory otherwise.

-V
--version

Print thepgpro_tune version and exit.

-?
--help

Show help aboutpgpro_tune command line arguments, and exit.

Environment variables

pgpro_tune sets the following environment variables before running presets.

  • EDITION — thePostgres Pro edition.

  • ENABLE_CRASH_INFO — if set,Postgres Pro was built with the--enable-crash-info option.

  • ENABLE_NLS — if set,Postgres Pro was built with the--enable-nls option.

  • ENABLE_PGPRO_TUNE — if set,Postgres Pro was built with the--enable-pgpro-tune option.

  • MEMMB — the RAM size in megabytes.

  • MVERPostgres Pro major version.

  • NCPU — the number of CPUs.

  • USE_BONJOUR — if set,Postgres Pro was built with the--with-bonjour option.

  • USE_BSD_AUTH — if set,Postgres Pro was built with the--with-bsd-auth option.

  • USE_ICU — if set,Postgres Pro was built the--with-icu option.

  • USE_LDAP — if set,Postgres Pro was built with the--with-ldap option.

  • USE_LIBUNWIND — if set,Postgres Pro was built with the--with-libunwind option.

  • USE_LIBXML — if set,Postgres Pro was built with the--with-libxml option.

  • USE_LIBXSLT — if set,Postgres Pro was built with the--with-libxslt option.

  • USE_LLVM — if set,Postgres Pro was built with the--with-llvm option.

  • USE_LZ4 — if set,Postgres Pro was built with the--with-lz4 option.

  • USE_OPENSSL — if set,Postgres Pro was built with the--with-openssl option.

  • USE_PAM — if set,Postgres Pro was built with the--with-pam option.

  • USE_SYSTEMD — if set,Postgres Pro was built with the--with-systemd option.

  • USE_ZSTD — if set,Postgres Pro was built with the--with-zstd option.

Writing presets

A preset is an executable, usually a shell script, that transforms the information passed through environment variables into the set of configuration parameters.

The expected output of the preset is the set of specifically formatted lines. The first non-whitespace character is the indicator of the line content interpretation forpgpro_tune. The indicator should be one of the following:

  • # for the comment action, the rest of the output line will be written into the configuration file after '#'.

  • = for the replace action, the rest of the output line should contain a pair of parametersNAME andVALUE (bothNAME=VALUE andNAMEVALUE are acceptable). LineNAME = VALUE will be written into the configuration file. The text afterVALUE will be added as a comment.

  • =+ or+= for the add action, the rest of the output line should contain a pair of parametersNAME andVALUE.VALUE will be added to the previous effective value of the parameterNAME at the back (=+) or at the front (+=). If there is no effective value, theADD action works like the replace action. The text afterVALUE will be added as a comment.

  • -= for the withdraw action, the rest of the output line should contain a pair of parametersNAME andVALUE. If theNAME parameter has the effective value containingVALUE, it will be removed and the rest of the effective value will remain the same. The text afterVALUE will be added as a comment. If there is no effective value, nothing happens.

Example of the preset

Suppose you have the following configuration file calledtest.conf:

work_mem = 4MB # Default valueshared_preload_libraries = 'plantuner'search_path = '"$user",wrong_schema,public'

And the following preset calledtest.tune:

echo "# Adding new configuration parameters."#Replace configuration parameter value by a new oneecho "work_mem = 8MB"#Append to the start of existing valueecho "shared_preload_libraries += pg_stat_statements"#Append to the end of existing valueecho "shared_preload_libraries =+ pg_prewarm"#Withdraw from existing valueecho "search_path -= 'wrong_schema'"

Run the following command to use this preset:

pgpro_tune --config-file=/path/to/test.conf -P/path/to/test.tune --no-default

This command will result in the following changes of the configuration file:

#------------------------------------------------------------------------------# The following settings were added by pgpro_tune.# pgpro_tune was run with the following options:# --no-default --config-file=/path/to/test/conf -P/path/to/test/tune --no-default# At YYYY-MM-DD HH:MM:SS#------------------------------------------------------------------------------# Adding new configuration parameters.work_mem = 8MBshared_preload_libraries = 'pg_stat_statements, plantuner'shared_preload_libraries = 'pg_stat_statements, plantuner, pg_prewarm'search_path = '"$user", public'#------------------------------------------------------------------------------# End of settings added by pgpro_tune at YYYY-MM-DD HH-MM-SS#------------------------------------------------------------------------------

Prev Up Next
pg_ctl Home pg_resetwal
pdfepub
Go to Postgres Pro Standard 15
By continuing to browse this website, you agree to the use of cookies. Go toPrivacy Policy.

[8]ページ先頭

©2009-2025 Movatter.jp