6 Utilities
PDF page 56
Describes the major enhancements of utility commands.
3.4.1 Configure
Added –with-zstd option to support Zstandard compression method. Zstandard 1.4.0 and above are supported.
3.4.2 Psql
The following enhancements have been implemented in the psql command.
Environment variable PSQL_WATCH_PAGER
The environment variable PSQL_WATCH_PAGER, which specifies the pager to be displayed when the \watch command is executed, is now available.
\Dconfig command
The \dconfig command can display the parameter settings of the instance. If no option is specified, a list of parameters that have changed from the default values is displayed. If a parameter name is specified, the specific parameter setting value can be checked. Wildcards can be used for parameter names. Syntax
PDF page 57
\Getenv command
Added the \getenv command to get environment variables. Specify the psql variable name and environment variable name to store the variable value. Specifying an environment variable name that does not exist does not cause an error. Syntax
PDF page 58
Comments in SQL statements
Comments with two hyphen (-) in SQL statements are now sent to the backend. Previously it was removed before sending to the backend.
Large Object output
Access privileges are now output to the \dl+ command and \lo_list+ command.
PDF page 59
Specifying a database name
When specifying a table name with the \d command, etc., use “database_name.schema_name.table_name” format is allowed. However, the “database_name” part is valid only for the currently connected database. If other database names are specified, an error message will be displayed.
Output of multiple SQL
PostgreSQL 15 displays all results if the server returns multiple result sets. This behavior can be changed with the “\set SHOW_ALL_RESULTS off” command.
3.4.3 Pg_amcheck
The –install-missing option has been added. If this option is specified, the amcheck extension will be installed automatically if it is not installed.
3.4.4 Pg_basebackup
The following options have been added / extended to the pg_basebackup command.
–Target option
The –target option to specify the output destination has been added. This option uses a new data transfer protocol (BASE_BACKUP TARGET). The following formats can be specified Specifying
PDF page 60
server as the output destination allows base backups to be output to a server running a PostgreSQL instance. Server-side backups can be performed by a user with the SUPERUSER or pg_write_server_files roles.
| blackhole | Nothing is output. Test options |
|---|---|
| server:/path | Output to the specified directory on the server. Currently, the output format is tar (output to /path in the example on the left). |
| shell[:DETAIL] | Execute a shell command. |
Target Description
The –wal-method option must be set to “fetch” or “none” to make this specification. When “shell” is specified in the –target option, it is necessary to set the Contrib module basebackup_to_shell.
–Compress option
The –compress option can now specify the compression method and compression level, whereas the previous version specified the compression level. The compression level is specified by specifying “level=number” after a colon (:); for Zstandard compression, the “workers=number” option for parallel processing can also be set. The same notation as in previous versions is also available for compatibility. If server-side compression (server-gzip) is specified for plain format (-Fp), only the transferred data will be compressed and decompressed and stored on the client side. This setting is useful when network bandwidth is small.
| Setting | Description | Note |
|---|---|---|
| none | Do not compress | |
| gzip | Gzip compression on the client if not targeted | |
| lz4 | LZ4 compression on the client if not targeted | |
| zstd | Zstandard compression on the client if not targeted | |
| client-gzip | Gzip compression on the client side | |
| server-gzip | Gzip compression on the server side | |
| client-lz4 | LZ4 compression on the client side | |
| server-lz4 | LZ4 compression on the server side | |
| client-zstd | Zstandard compression on the client side | |
| server-zstd | Zstandard compression on the server side |
PDF page 61
3.4.5 Pg_dump
The following enhancements have been implemented for the pg_dump command.
–No-table-access-method option
The –no-table-access-method option can now be specified to remove table access methods from the output DDL. This option is ignored if the dump file is output in non-text format. The same option can also be specified for the pg_dumpall and pg_restore commands.
Consideration of TOAST data volume
The pg_dump command takes into account the table size when running in parallel mode; PostgreSQL 15 now also takes into account the amount of TOAST data.
3.4.6 Pg_recvlogical
The –two-phase (or -t) option has been added to the pg_recvlogical command to support the addition of the TWO_PHASE option to the CREATE_REPILICATION_SLOT command for the replication protocol.
3.4.7 Pg_receivewal
The –compress option, which specifies how to compress the logs, has changed. Compression method, level, etc. can be specified.
PDF page 62
Syntax
Valid values for compression are gzip, lz4 or none. An optional compression level (level) can be specified. The range of compression levels is 1-9.
3.4.8 Pg_resetwal
The –oldest-transaction-id option (short form -u) has been added to specify the oldest transaction ID.
3.4.9 Pg_rewind
Added the –config-file option to specify the path to the server configuration file (postgresql.conf). This option is useful when the configuration file is outside the data directory.
3.4.10 Pg_upgrade
The following enhancements have been implemented for the pg_upgrade command
PDF page 63
–No-sync option
The –no-sync option (short form -N) has been added. When this option is specified, it does not wait for the completion of file writing. This is not to be used in a production environment.
Temporary Directories
Temporary files created during the upgrade will be created in the pg_upgrade_output.d directory of the new database cluster.
3.4.11 Pg_waldump
Options
The following options have been added Multiple –rmgr options can now be specified.
| Option name | Short option | Description |
|---|---|---|
| –block=N | -B | Show the block of relations specified by the –relation option |
| –fork=N | -F | Show only forks with matching numbers |
| –relation=tblspc/db/rel | -R | Show only information about the relevant relationship |
| –fullpage | -w | Show only Full page write information |
Signal
When the SIGINT signal is received and the process ends, summary information is output.
Addition of output information
The remote_apply information of transaction commit and the replication origin information of PREPARE TRANSACTION are added to the command output.
PDF page 64