PostgreSQL 16 New Features
PostgreSQL 16 New Features
WITH EXAMPLES · ENGLISH SOURCE EDITION
Explore the features, SQL examples, and compatibility changes documented by Noriyoshi Shinoda.
Contents
Reference indexes
The opening chapter includes the first numbered table, Table 1. The indexes below collect the book’s other native numbered components.
Tables
- Table 1 — Version
- Table 2 — Examples of notation
- Table 3 — Syntax rules
- Table 4 — WAL archive module API
- Table 5 — ASCII Conversion rule
- Table 6 — Modified options
- Table 7 — Add system catalogs and views
- Table 8 — System catalogs/views with additional columns
- Table 9 — System catalogs/views with modified output
- Table 10 — The pg_stat_io view
- Table 11 — The origin option setting
- Table 12 — Replication mode setting (PUBLISHER side)
- Table 13 — Replication mode setting (SUBSCRIBER side)
- Table 14 — Add syntaxes
- Table 15 — Add predefined roles
- Table 16 — Add Wait Events
- Table 17 — Renamed Wait Event
- Table 18 — Connection string require_auth
- Table 19 — Setting value
- Table 20 — Setting value
- Table 21 — Integer literal description
- Table 22 — Access privileges and the possible lock modes
- Table 23 — Added parameters
- Table 24 — Possible values
- Table 25 — Modified Parameters
- Table 26 — Parameters with default values changed
- Table 27 — Removed parameters
- Table 28 — Add/Remove options
- Table 29 — Add/Modify options
- Table 30 — Add/change options
- Table 31 — Compression level range
- Table 32 — File name explanation
- Table 33 — Command execution status
- Table 34 — Possible values
- Table 35 — Results of the pg_buffercache_summary function
- Table 36 — Return value of the pg_get_wal_block_info function
- Table 37 — Possible values for the analyze_sampling option
Examples
- Example 1 — Modify attributes of the bootstrap user
- Example 2 — Duplicate error in WAL archive settings
- Example 3 — Datetime expression that causes an error in PostgreSQL 16
- Example 4 — PostgreSQL 16 behavior
- Example 5 — Failure of the ALTER TABLE statement
- Example 6 — System column foreign key specification error
- Example 7 — Failure of the GRANT statement
- Example 8 — PostgreSQL 15 behavior
- Example 9 — PostgreSQL 16 behavior
- Example 10 — Failure of the RESET statement
- Example 11 — PostgreSQL 15 behavior
- Example 12 — PostgreSQL 16 behavior
- Example 13 — PostgreSQL 16 behavior
- Example 14 — PostgreSQL 16 behavior
- Example 15 — ECPG program with error
- Example 16 — Reference to the pg_ident_file_mapping view.
- Example 17 — Reset of the pg_stat_io view
- Example 18 — Setting for parallel apply
- Example 19 — The origin option setting
- Example 20 — Log of the COPY statements executed in initial data synchronization
- Example 21 — SUBSCRIPTION creation role
- Example 22 — Execute pg_log_standby_snapshot function (Primary instance)
- Example 23 — Parallel Hash Full Join execution plan
- Example 24 — Execute string_agg function
- Example 25 — Pg_hba.conf file with regular expressions
- Example 26 — Settings to include files
- Example 27 — Conversion of ICU locale 'C'
- Example 28 — Specifying custom rules
- Example 29 — Check custom rules
- Example 30 — Check UNICODE locale
- Example 31 — Checkpoint log
- Example 32 — Auto vacuum log
- Example 33 — Setting the required authentication method
- Example 34 — Random selection of connection destination
- Example 35 — Get PG_ROUTINE_OID
- Example 36 — The WAL sender process name
- Example 37 — Part of the test_ext_req_schema2--1.0.sql
- Example 38 — Part of the test_ext_req_schema3.control
- Example 39 — +Infinity notation
- Example 40 — Notation for integer literals
- Example 41 — Integer literal in the JSONPATH
- Example 42 — Hexadecimal notation of type NUMERIC
- Example 43 — Specifying underscores in the numeric literals
- Example 44 — Specify the DEFAULT option
- Example 45 — Specifying the DEFAULT option (file_fdw)
- Example 46 — User creation by the CREATEROLE attribute user
- Example 47 — SET ROLE statement for creation role
- Example 48 — Name abbreviation in the CREATE STATISTICS statement
- Example 49 — STORAGE clause of the CREATE TABLE statement
- Example 50 — STORAGE DEFAULT clause in the ALTER TABLE statement
- Example 51 — Setting the GENERIC_PLAN option
- Example 52 — WITH INHERIT clause
- Example 53 — WITH SET clause
- Example 54 — JSON Constructor
- Example 55 — IS JSON Clause
- Example 56 — Fractional seconds
- Example 57 — Omitting the database name
- Example 58 — Execute the VACUUM statement
- Example 59 — TOAST only VACUUM
- Example 60 — The BUFFER_USAGE_LIMIT option
- Example 61 — Subquery with the FROM clause
- Example 62 — PostgreSQL 16 behavior
- Example 63 — PostgreSQL 15 behavior
- Example 64 — SELECT statement for the example
- Example 65 — Execution plan in PostgreSQL 15
- Example 66 — Execution plan in PostgreSQL 16
- Example 67 — Execution plan in PostgreSQL 16
- Example 68 — Execution plan in PostgreSQL 15
- Example 69 — Execution plan in PostgreSQL 16
- Example 70 — Array_sample / array_shuffle function
- Example 71 — Any_value function
- Example 72 — Date_add / date_subtract function
- Example 73 — Erf / erfc functions
- Example 74 — Execution of generate_series function with specified interval
- Example 75 — Random_normal function
- Example 76 — Pg_read_file function
- Example 77 — Pg_split_walfile_name function
- Example 78 — Pg_stat_get_backend_subxact function
- Example 79 — Pg_input_is_valid function
- Example 80 — Pg_input_is_valid / pg_input_error_info function
- Example 81 — Pg_size_bytes function
- Example 82 — System_user function
- Example 83 — Specify the INDENT clause
- Example 84 — Execute the createuser command
- Example 85 — Execute initdb command with the --icu-rules option
- Example 86 — initdb command with the --set option
- Example 87 — Specifying the compression level to 'long'
- Example 88 — Execute the pg_bsd_indent command
- Example 89 — Execute the pg_dump command
- Example 90 — Help message of the pg_dump command
- Example 91 — Execute the pg_verifybackup command
- Example 92 — Execute the pg_waldump command with the --save-fullpage option
- Example 93 — Execute the pg_waldump command with the --timeline option
- Example 94 — Check command execution status
- Example 95 — External table partition information
- Example 96 — Binding variable settings
- Example 97 — Specifying the xheader_width option
- Example 98 — \watch metacommand with rerun count
- Example 99 — \drg metacommand
- Example 100 — vacuumdb command with specifying schema
- Example 101 — With the --no-process-main option
- Example 102 — The vacuumdb command with --buffer-usage-limit option
- Example 103 — Output of the query ID
- Example 104 — Execute the daitch_mokotoff function
- Example 105 — Execute the bt_multi_page_stats function
- Example 106 — Execute the pg_buffercache_summary function
- Example 107 — Execute the pg_buffercache_usage_counts function
- Example 108 — Select the pg_stat_statements view
- Example 109 — Execute the pg_get_wal_block_info function
- Example 110 — Execution log on the external table side
- Example 111 — Execute the ANALYZE statement
Figures
Source edition
The source chapter order, wording, examples, and publication credits are retained. PDF page markers link the reading edition to the original document. Source identity and coverage · About the collection
1 About This Document
PDF page 5
1.1 Purpose
The purpose of this document is to provide information about the major new features of open-source RDBMS PostgreSQL 16 (16.0).
1.2 Audience
This document is written for engineers who already know PostgreSQL, such as installation, basic management, etc.
1.3 Scope
This document describes the major difference between PostgreSQL 15 (15.4) and PostgreSQL 16 (16.0). As a general rule, this document examines the features of behavior change. This document does not describe and verify all new features. In particular, the following new features are not included.
Bugfix
Performance improvement by changing internal behavior
Improvement of regression test
Operability improvement by the psql command tab input
Improvement of the pgbench command
Improvement of documentation, modify typos in the source code
Refactoring without a change in behavior
1.4 Software Version
The contents of this document have been verified for the following versions and platforms.
| Software | Version |
|---|---|
| PostgreSQL | PostgreSQL 15.4 (for comparison) PostgreSQL 16 (16.0) GA (September 11, 2023 20:30:14) |
| Operating System | Red Hat Enterprise Linux 8 Update 5 (x86-64) |
| Configure options | –with-ssl=openssl –with-python –with-lz4 –with-zstd –with-llvm –withicu –with-libxml |
PDF page 6
1.5 The Question, comment, and Responsibility
The contents of this document are not an official opinion of Hewlett Packard Enterprise Japan, G.K. The author and affiliation company do not take any responsibility for the problem caused by the mistake of contents. If you have any comments for this document, please contact Noriyoshi Shinoda (noriyoshi.shinoda@hpe.com), Hewlett Packard Enterprise Japan, G.K.
1.6 Notation
This document contains examples of the execution of the command or SQL statement. Execution examples are described according to the following rules:
| Notation | Description |
|---|---|
| # | Shell prompt for Linux root user. |
| $ | Shell prompt for Linux general user. |
| Bold | The user input string. |
| postgres=# | The psql command prompt for PostgreSQL administrator. |
| postgres=> | The psql command prompt for PostgreSQL general user. |
| Underline | Important output items. |
| Underline «PASSWORD» | Important output items. Replaced by password string. |
| … | Indicates that it is omitted. |
The syntax is described in the following rules:
| Notation | Description |
|---|---|
| Italic | Replaced by the name of the object which users use, or the other syntax. |
| [ ] | Indicate that it can be omitted. |
| { A | B } | Indicate that it is possible to select A or B. |
| … | General syntax. It is the same as the previous version. |
2 New Features Summary
PDF page 7
More than 200 new features have been added to PostgreSQL 16. This chapter provides an overview of typical new features and benefits. Details of the new features will be explained in “3. New Feature Detail”.
2.1 Improvements to adapt to large scale environments
The following features have been added that can be applied to large scale environments:
Parallel Query Improvements
Parallel query is now available for execution of FULL OUTER JOIN syntax, RIGHT OUTER JOIN syntax, string_agg function and array_agg function.
Extended Statistics
Add the pg_stat_io view to get detailed I/O statistics. In addition, the pg_stat_all_tables view and the pg_stat_all_indexes view have added a column that shows the last access time for an object.
Improved batch processing performance
It is now possible to batch insert multiple records with the COPY statement for a foreign table using the postgres_fdw module.
2.2 Improved reliability
PostgreSQL 16 implements the following enhancements to improve reliability.
Improvements in logical Replication
Logical replication is one of the major enhancements in this version. Improved apply performance for long-running transactions, limited bi-directional replication, roles that allow SUBSCRIPTION creation, improved initial data transfer performance, logical decoding on standby instances, and much more.
Backup compression
LZ4 compression and Zstandard compression are now available for the output of the pg_dump command.
PDF page 8
2.3 Improved maintainability
The following features that can improve operability have been added.
Extension of the parameter file
Regular expressions can now be used for some setting items in the pg_hba.conf file and pg_ident.conf file. Also, the pg_hba.conf and pg_ident.conf files can now include external files, just like postgresql.conf.
Security
GSSAPI/Kerberos credential delegation is now supported. Add pg_use_reserved_connections to reserve reserved sessions for general users.
2.4 Improvements in Programming
The following functions have been added to SQL statements.
JSON-related
A function conforming to the SQL standard has been added to generate SQL/JSON. Add IS JSON clause that can check JSON syntax.
Subquery
The alias name is now optional if the FROM clause contains a subquery.
Literals
Numeric literals can now also contain binary, octal, and hexadecimal numbers. Underscores in numeric strings are supported.
2.5 Preparing for future new features
PostgreSQL 16 is now ready for features that will be provided in future versions.
Extension of ICU locales
Adding original rules to the ICU locale is supported, and the UNICODE locale has been added.
PDF page 9
Standby instance
Logical decoding is now possible on the standby instance.
2.6 Incompatibility
In PostgreSQL 16, the following specifications have been changed from PostgreSQL 15.
2.6.1 End of support
PostgreSQL 16 changed the supported versions for the following platforms and tools. [9db300c, 495ed0e, 6203583, 8efefa7, 8b878bf, b086a47, 4c15327, 8efefa7, e692727] Platforms and tools that are no longer supported are listed below.
HP-UX
HP/Intel Itanium processor
M68K, M88K, M32R and SuperH processors
Microsoft Windows prior to Windows 10
Microsoft Visual Studio 2013 Changes in supported versions of components required to build PostgreSQL 16 are as follows.
Bison 2.3 or later
Flex 2.5.35 or later
Perl 5.14 or later
GNU make 3.81 or later
2.6.2 Promotion
Standby database promotion by trigger file creation is no longer supported. The parameter promote_trigger_file has been removed accordingly. Use the pg_ctl promote command or pg_promote function to execute promotion. [cd4329d]
2.6.3 Bootstrap user attribute
The SUPERUSER attribute can no longer be removed from the bootstrap user. [e530be2]
PDF page 10
2.6.4 WAL Archive
The WAL archive of PostgreSQL 16 has the following incompatibilities: [d627ce3, 35739b8]
Parameter settings
The archive_command parameters and the archive_library can no longer be set at the same time. In PostgreSQL 15 archive_library was preferred. If set at the same time, the following error will be output to the log and the WAL archive will not be output.
Specification change of the WAL archive module
The specification of the callback function of the shared library specified in the parameter archive_module has been changed. An address of type ArchiveModuleState has been added to the parameters of each callback.
PDF page 11
| Initialize | Add | (*ArchiveStartupCB) (ArchiveModuleState *state) |
|---|---|---|
| Check | Modify | (*ArchiveCheckConfiguredCB) (ArchiveModuleState *state) |
| WAL archive | Modify | (*ArchiveFileCB) (ArchiveModuleState *state, const char *file, const char *path) |
| Shutdown | Modify | (*ArchiveShutdownCB) (ArchiveModuleState *state) |
Callback Modify Call definition in PostgreSQL 16
2.6.5 Extension
Execution of the CREATE OR REPLACE statement on an existing object that does not belong to an extension script is prohibited. Previously, an extension script would execute the CREATE OR REPLACE statement, overwriting an existing object if one existed that did not belong to the extension. [b9b21ac]
2.6.6 Datetime string format
Date-time strings combining “epoch” and “infinity” with other date-time fields are prohibited in PostgreSQL 16. Also, ISO 8601 will be strictly enforced for string formatting. [bcc704b, 5b3c595]
PDF page 12
2.6.7 ASCII string conversion
Changed the conversion rules when non-ASCII characters are specified for ASCII-only strings such as parameters application_name and cluster_name. Previously, it was converted in byte units with a question mark (?), but in PostgreSQL 16, it is converted to a hexadecimal string. [45b1a67]
| Before (UTF-8) | PostgreSQL 15 | PostgreSQL 16 | Note |
|---|---|---|---|
| Abc漢字 | Abc?????? | Abc\xe6\xbc\xa2\xe5\xad\x97 |
2.6.8 ALTER DEFAULT PRIVILEGES statement
Execution of ALTER DEFAULT PRIVILEGES requires explicit privileges, not membership in a role. The ALTER DEFAULT PRIVILEGES statement included in the following example will succeed in PostgreSQL 15. [48a257d]
2.6.9 ALTER TABLE statement
The unique indexes with the NULLS NOT DISTINCT clause can no longer be specified as primary keys for tables. [d959523]
PDF page 13
2.6.10 CREATE RULE statement
In previous versions, it was possible to create an ON SELECT rule for a table and convert it to a view, but PostgreSQL 16 prohibits it. [b23cd18]
2.6.11 CREATE TABLE statement
System columns can no longer be used as FOREIGN KEYs. This change will be backported to the previous version. [f0d65c0]
2.6.12 CREATEROLE attribute
In PostgreSQL 16, it is no longer possible to grant roles without the WITH ADMIN option to other users, even if they have the CREATEROLE attribute. In previous versions, users with the CREATEROLE attribute could perform most changes to other users. The first GRANT statement in the example below succeeds in PostgreSQL 15. [cf5eb37]
PDF page 14
2.6.13 POWER function
In PostgreSQL 16, the accuracy when specifying an integer to the POWER function is improved, and the effective accuracy matches when specifying a non-integer. This fix will not be backported to previous versions. [40c7fcb]
PDF page 15
2.6.14 RESET statement
The RESET statement for the parameters below will fail. [3853664]
transaction_read_only
transaction_deferrable
seed
transaction_isolation
2.6.15 Pg_stat_get_backend_idset function
The pg_stat_get_backend_idset function now returns the ID of the backend process. Until the previous version, it returned the order starting from 1. [d7e39d7]
PDF page 16
2.6.16 Pg_walinspect extension
Pg_get_wal_records_info function, pg_get_wal_stats function, and pg_get_wal_block_info function of pg_walinspect extension no longer generate an error even if the end LSN specified is higher than the current LSN. The pg_get_wal_records_info_till_end_of_wal and pg_get_wal_stats_till_end_of_wal functions, which are no longer needed due to this change, have been removed. [5c1b662]
PDF page 17
2.6.17 Postmaster
The -T option may send a SIGABRT signal instead of a SIGSTOP signal by setting the send_abort_for_crash parameter. Also, the -n option has been removed. Symbolic links pointing to the postmaster are no longer created. [51b5834, 37e2673]
2.6.18 Psql
The following specifications of the psql command have been changed. [3dfae91, 00beecf]
The \df+ meta-command
The \df+ meta-command output column name “Source code” changed to “Internal name”.
The \watch meta-command
Negative numbers and strings specified in the \watch meta command will result in an error. Previous versions assumed 1 second. If 0 is specified, the command will be re-executed without an interval.
PDF page 18
2.6.19 Libpq
Removed authorization code with SCM credentials. The backend code was removed in PostgreSQL 9.1, but the libpq code remained. [98ae2c8]
2.6.20 PL/Python
The {installation destination}/lib/pgxs/src/pl/plpython directory is no longer created. [7d5852c]
2.6.21 ECPG
The SQL keywords used in EXEC SQL commands can no longer be declared as typedefs. The following example will result in a syntax error. [83f1c7b]
2.6.22 configure
The options of the configure command have been changed as follows. [20c105c, fcb21b3]
PDF page 19
| Option name | Modify | Description | Note |
|---|---|---|---|
| –with-gnu-ld | Removed Use GNU ld as compiler | Removed Use GNU ld as compiler | |
| –with-icu | Removed Link the ICU library | Removed Link the ICU library | |
| –without-icu | Added | Do not link the ICU library |
PDF page 20
3 Architecture
PDF page 20
3.1.1 Modified System catalogs
The following catalogs have been changed. [d540a02, 84ad713, c037471, 3662839, 6566133, e3ce2de, c591300, ae4fdde, 90189ee, 216a784, e0b0142, e056c55, 0c67946, a4b4cc1]
| View name | Description |
|---|---|
| pg_stat_io | Provides detailed I/O statistics for database clusters. |
| View name | Add column | Data type | Description |
|---|---|---|---|
| pg_auth_members | oid | oid | Object ID |
| inherit_option | boolean | Allow inheritance | |
| set_option | boolean | Allow SET ROLE Statement | |
| pg_collation | collicurules | text | ICU custom rule |
| pg_database | daticurules | text | ICU custom rule |
| pg_hba_file_rules | rule_number | integer | Rule number |
| file_name | text | Configuration file name | |
| pg_ident_file_mappings | map_number | integer | Mapping number |
| file_name | text | Configuration file name | |
| pg_prepared_statements | result_types | regtype[] | Types of columns returned by the statement |
| pg_replication_slots | conflicting | boolean | Conflict with recovery |
| pg_stat_database_conflicts | confl_active_logicalslot | bigint | Number of logical slot uses that have been canceled |
| pg_stat_gssapi | credentials_delegated | boolean | Is it a GSSAPI delegated session? |
| pg_stat_subscription | leader_pid | integer | The ID of the parallel apply reader process |
| pg_stat_*_indexes | last_idx_scan | timestamp with time zone | Index access last time |
| pg_stat_*_tables | last_seq_scan | timestamp with time zone | Sequential access last time |
| last_idx_scan | timestamp with time zone | Index access last time | |
| n_tup_newpage_upd | bigint | Number of rows that successor versions have moved to new heap pages | |
| pg_subscription | suborigin | text | Type of request to send data to PUBLICATION |
| subpasswordrequir ed | boolean | Password required for authentication | |
| subrunasowner | boolean | Execution by SUBSCRIPTION owner |
PDF page 21
| View name | Description |
|---|---|
| pg_attribute | The data type of attndims, attstattarget, attinhcount columns changed from integer to smallint. Also, the order of the columns has changed. |
| pg_constraint | The data type of the coninhcount column has changed from integer to smallint. |
| pg_database | -2 (invalid) is now output in the datconnlimit column. |
| pg_locks | ‘applytransaction’ is now output in the locktype column. |
| pg_stat_activity | Now standalone backends are output in the backend_type column. |
| pg_stat_subscription | A tuple is created immediately after the SUBSCRIPTION is created. In previous versions, it was created when the first stat was received. |
| pg_subscription | Substream column changed from bool type to char type. ‘p’ is output when applying in parallel. |
Details about the add the pg_stat_io views are described below. [a9c70b4, 8aaa04b, ac8d53d, ac8d53d, 0ecb87e, 093e5c5]
PDF page 22
| Column name | Data type | Description |
|---|---|---|
| reuses | bigint | Number of times an I/O operation reused an existing ring buffer outside of shared buffers |
| fsyncs | bigint | Number of fsync system calls executed |
| fsync_time | double precision | fsync system call execution time |
| stats_reset | timestamp with time zone | view reset time |
Column name Data type Description backend_type text Type of backend process. The following values are output background worker client backend walsender standalone backend autovacuum worker autovacuum launcher background writer startup checkpointer etc. object text Type of target relation (relation, temp relation) context text Type of I/O operation (normal, vacuum, bulkread, bulkwrite) reads bigint Number of reads of the size indicated by the io_bytes column read_time double Total loading time precision writes bigint Number of writes of the size indicated in the io_bytes column write_time double Total write time precision writebacks bigint Number of units of size op_bytes which the process requested the kernel write out to storage. writeback_time double Total writeback time precision extend_time double Total Extended Time precision op_bytes bigint Number of bytes for one I/O processing hits bigint Number of cache hits evictions bigint Number of times written out from shared or local buffers so that they can be used for other purposes
PDF page 23
PDF page 24
3.1.2 Logical Replication Enhancements
The following features have been added to Logical Replication. [216a784, 3662839, 4826759, 1e10d49, ecb6965, c3afe8c, 89e46da, 0fdab27, 5de94a0, 9f2213a, 2666975, c9f7f92]
Parallel apply
In previous versions, the large transactions were applied after being saved to a temporary file. PostgreSQL 16 now allows transaction deltas to be applied directly by multiple worker processes. To enable this feature, specify ‘parallel’ for the option streaming in the CREATE SUBSCRIPTION statement. Along with this, the substream column of the pg_subscription catalog is changed from bool type to char type, and ‘p’ is output when ‘parallel’ is specified for the stream option of the CREATE SUBSCRIPTION statement. The maximum number of worker processes a subscription uses is determined by the parameter max_parallel_apply_workers_per_subscription.
Origin option for SUBSCRIPTION
The CREATE /ALTER SUBSCRIPTION statements now accept the ‘origin’ option. This parameter specifies the type of change to request to PUBLICATION. A suborigin column has been added to the pg_subscription catalog to store this option information.
| Value | Description | Note |
|---|---|---|
| none | SUBSCRIPTION requests only non-origin related changes to PUBLICATION | |
| any | PUBLICATION will send all changes to SUBSCRIPTION regardless of origin | Default value |
PDF page 25
Setting the origin option to ’none’ allows bi-directional replication for the same table with some restrictions.
Run_as_owner option for SUBSCRIPTION
In previous versions of logical replication, SUBSCRIPTION updated the table with the privileges of the SUBSCRIPTION owner. By default, in PostgreSQL 16, apply is done with the privileges of the table owner. Setting the run_as_owner option to ’true’ allows the same behavior as in previous versions. The subrunasowner column has been added to the pg_subscription catalog to store the information of this option.
BINARY transfer for initial data synchronization
When both PUBLICATION / SUBSCRIPTION are PostgreSQL 16 or higher and binary option of the SUBSCRIPTION is enabled, initial data is now transferred in binary format. The following example is the COPY statement log executed for initial data synchronization on the PUBLICATION side.
Index with REPLICA IDENTITY FULL
Even in an environment where REPLICA IDENTITY and primary keys cannot be used at the publisher, the subscriber can use indexes other than primary keys and REPLICA IDENTITY. The
PDF page 26
indexes that can be used are B-tree indexes, not partial indexes, and require at least one column reference.
SUBSCRIPTION creation role
General users who are granted the pg_create_subscription role will be able to create SUBSCRIPTIONs. However, the password is required in the CONNECTION clause. Only users with the SUPERUSER attribute can turn off the password_required attribute. The subpasswordrequired column has been added to the pg_subscription catalog with this option.
Logical decoding on standby instance
Logical decoding can now be executed on the standby instance. The pg_create_logical_replication_slot function can be executed on the standby instance. To speed up the creation of logical replication slots on the standby instance, the pg_log_standby_snapshot function can be executed on the primary instance.
PDF page 27
Replication mode
Added the parameter debug_logical_replication_streaming that allows changing the transfer mode for logical decoding. The default value is ‘buffered’. This parameter can have the following values:
| buffered | changed data reaches |
|---|---|
| immediate | Streaming occurs if the ‘streaming’ option of the CREATE SUBSCRIPTION statement is enabled. |
Value Description
| Value | Description |
|---|---|
| buffered | If the ‘streaming’ option is set to ‘parallel’, send data to parallel workers through a shared memory queue. |
| immediate | Serializes all data to a file and notifies parallel workers to apply it at the end of the transaction. |
Conflict detection
Add confl_active_logicalslot column to the pg_stat_database_conflicts view to detect conflicts such as when WAL required for a subscriber is dropped on a standby instance. This column outputs the number of uses canceled in logical replication slots.
ALTER TABLE REPLICA IDENTITY statement
The ALTER TABLE REPLICA IDENTITY USING statement now succeeds even if the index is INVALID. This is a fix to avoid errors due to the order in which the pg_dump command outputs table definitions.
PDF page 28
3.1.3 Parallel Query Enhancements
There are more syntaxes and functions for parallel query execution. [11c2d6f, 16fd03e]
Parallel Hash Full Join
Parallel query is now supported for RIGHT OUTER JOIN and FULL OUTER JOIN syntax. This behavior can be controlled with the parameter enable_parallel_hash.
Functions
Aggregation processing can now be executed in parallel when executing the string_agg and array_agg functions. Partial Aggregate is output in the execution plan when the parallel query is executed.
PDF page 29
3.1.4 Configuration Files
Some configuration files have been written better. [8fea868, efb6f4a, a54b658, efb6f4a]
Regular expression for database name and username
The pg_hba.conf file now supports regular expressions for database names and user names. Usernames and database names starting with a slash (/) are considered regular expressions.
Include another file
The pg_hba.conf and the pg_ident.conf files can now include other files just as the postgresql.conf file can.
PDF page 30
| Syntax | Description |
|---|---|
| includefile_name | Include the file |
| include_if_existsfile_name | Include the file if it exists |
| include_dirdirectory_name | Include all files with extension .conf under the specified directory |
Pg_ident.conf file
The same setting as in the pg_hba.conf file is allowed for the PostgreSQL user name part as follows.
‘all’ for all database users
Member check using plus (+)
Database username regular expression
3.1.5 ICU Locale
Enhanced the ability to use the ICU locale. [f3a01af, fcb21b3, c1f1c1f, 5cd1a5a, c45dc7f, 30a53b7, cd42785, 0d21d4b]
Conversion of ICU local ‘C’
If “C” is specified for the ICU locale, it will be converted to “en-US-u-va-posix”.
PDF page 31
Link with locale provider
The ICU library is also by default when building from source code. The –with-icu option of the ‘configure’ command has been abolished, and the –without-icu option has been added to specify when not using ICU. However, if only –no-locale is specified in the initdb command, LIBC will be used as the locale provider as in previous versions.
Default encoding
The default encoding when using the ICU locale is UTF8.
Specify custom rules
Custom rules can now be specified for the ICU locales. Add RULES clause to the CREATE COLLATION statement and the ICU_RULES clause to the CREATE DATABASE statement to specify rules. See the URL below for the detailed syntax of the rules. https://unicode-org.github.io/icu/userguide/collation/customization/
PDF page 32
Syntax 1 - CREATE COLLATION / CREATE DATABASE statement
In the example below, a unique rule “&a < g” is added to the locale “en_US” when creating the database. The table to which the rule is applied is output in the order of apple, green, and bird when sorted.
PDF page 33
New ICU locale
Add UNICODE to the ICU locale.
PDF page 34
3.1.6 Predefined Roles
PostgreSQL 16 has been added the following predefined roles: [c3afe8c, 6e2775e]
| Role name | Description |
|---|---|
| pg_create_subscription | Allows creation of SUBSCRIPTION |
| pg_use_reserved_connections | Connections assigned to parameter reserved_connections can be used |
3.1.7 Wait Events
The following wait events have been added or changed. [7bae3bb, fce003c, 216a784, 5a3a953, d8cd0c6, 92daeca, 8fba928]
| Event name | Type | Description |
|---|---|---|
| DSMAllocate | IO | Waiting for dynamic shared memory allocation |
| LogicalApplySendData | IPC | Waiting to complete sending data to parallel apply workers |
| LogicalParallelApplyMain | Activity | Waiting for parallel application |
| LogicalParallelApplyStateChange | Activity | Waiting for Parallel Apply status change |
| LogicalRepLauncherDSA | LWLock | Waiting for access to the DSA memory allocator in the launcher process |
| LogicalRepLauncherHash | LWLock | Waiting for access to the shared hash table of the launcher process |
| RelationMapReplace | IO | Waiting for replacement of relation map file. Changed from RelationMapSync |
| SLRUFlushSync | IO | Waiting for SLRU data to reach storage during checkpoint or database shutdown. |
| SpinDelay | Timeout | pg_usleep execution wait time |
| Old name | New name | Note |
|---|---|---|
| HashGrowBatchesAllocate | HashGrowBatchesReallocate | |
| HashGrowBucketsAllocate | HashGrowBucketsReallocate |
PDF page 35
3.1.8 Triggers
The following enhancements have been implemented for triggers: [3b00a94, 93f2349]
TRUNCATE Trigger
The TRUNCATE triggers are now executed when the TRUNCATE statement is executed for a foreign table.
Event Trigger
Execution of the ALTER MATERIALIZED VIEW statement now executes event triggers.
3.1.9 Log files
Add information that is printed to the log in some cases. [62c46ee, d977ffd, 71cb84e]
Checkpoint
The LSN information is added to the log when the parameter log_checkpoints is set to ‘on’.
Auto vacuum
Add frozen table information to autovacuum logs.
PDF page 36
WAL
The LSN information is now outputted in error messages that occur while validating WAL headers.
3.1.10 Kerberos Credential Delegation
Supports GSSAPI/Kerberos authentication delegated by the client to the server. This allows users who authenticate to PostgreSQL with Kerberos credentials to delegate their credentials to PostgreSQL. The server will now be able to connect to other services using the delegated credentials. GSSAPI delegate acceptance is enabled by changing the parameter gss_accept_delegation to ‘on’. Sessions with delegated GSSAPI credentials can be seen in the credentials_delegated column of the pg_stat_gssapi view. This new feature adds the gssdeleg to the libpq connection string. The default setting value is ‘disable’. Specify ’enable’ in the connection string to enable GSS authentication delegation. The environment variable PGGSSDELEG can also be used instead of the connection string. This setting can also be used with the postgres_fdw module, the dblink module, etc. Add PQconnectionUsedGSSAPI as an API to check the authentication method. [6633cfb, 1f9f6aa]
Syntax 2 - PQconnectionUsedGSSAPI function
3.1.11 Libpq
The following extensions have been implemented in libpq, the API that using PostgreSQL. [3a465cc, 36f40ce, 7f5b198, 8eda731, 9fcdf2c, 419a8dd, 19d8e23]
PDF page 37
Connection string require_auth
Add a connection string require_auth that specifies the list of required authentication methods. For this parameter, specify the following connection methods separated by commas (,). If there are no authentication methods that the server can provide, the connection will fail. This connection string can also be specified with the environment variable PGREQUIREAUTH.
| Authentication method | Description |
|---|---|
| password | Password authentication |
| md5 | Authentication with MD5 password |
| gss | GSSAPI authentication |
| sspi | SSPI authentication |
| scram-sha-256 | SCRAM-SHA-256 authentication |
| none | No required authentication method |
Connection string sslcertmode
The connection string sslcertmode determines if the server will send the certificate from the client. This connection string can also be specified in the environment variable PGSSLCERTMODE.
PDF page 38
| Value | Description |
|---|---|
| allow | Client certificates will be sent if the server requests them. This behavior is the same as in previous versions and is the default value. |
| disable | Refuse to send even if a client certificate is available. |
| require | No client certificate is sent and the connection fails. It can be useful for troubleshooting. |
Connection string load_balance_hosts
The connection string load_balance_hosts automatically selects a specific instance from the destination list. This connection string can also be specified in the environment variable PGLOADBALANCEHOSTS. If the destination does not exist, another destination is automatically selected.
| Value | Description |
|---|---|
| random | Randomly selects a connection point from multiple specified hosts and ports. |
| disable | Disables random selection of destinations (default). |
Connection string sslrootcert
The connection string sslrootcert can now specify ‘system’ as its configuration value. This configuration value loads the system’s trusted CA root certificate for certificate validation.
PDF page 39
COPY statement callback
The CopySendEndOfRow API now supports a callback function. This feature helps the extensions execute the COPY TO statements. A similar callback function is already provided for the COPY FROM statements.
Hook
Add a hook to change the password specified in ldapbindpasswd in the pg_hba.conf file for LDAP authentication. Update the ldap_password_hook defined in the src/backend/libpq/auth.c file.
Index Access Method
Add “bool amsummarizing;” flag to IndexAmRoutine struct. This flag indicates whether the access method should summarize tuples.
3.1.12 PL/pgSQL
Add PG_ROUTINE_OID to get OID of self-procedure. [d3d53f9]
3.1.13 MATERIALIZED VIEW
Supports Predicate Lock to prevent serialization anomaly when executing the REFRESH MATERIALIZED VIEW CONCURRENTLY statement. [4335155]
PDF page 40
3.1.14 WAL sender process
The database name of the data provider (PUBLICATION side) is now output as the process name of the WAL sender process in the logical replication environment. [af20515]
3.1.15 GIN Index cost
CPU-based cost is now taken into account as part of the GIN index cost calculation. This increases the cost estimate for using GIN indexes. [cd9479a]
3.1.16 Meson
Meson (https://mesonbuild.com/) is now available as a build system. The meson.build file is located in each directory in the source code. [e692727]
3.1.17 UNICODE
The supported Unicode version has been changed from 14.0.0 to 15.0.0. [1091b48]
3.1.18 LLVM
Supports LLVM 15. This change will also be backported to previous versions. [c2ae01f]
3.1.19 Extension
Add the @extschema:{name}@ and no_relocate options to extensions. @extschema:{name}@ can extend the existing @extschema@ functionality and insert an extended schema name. The no_relocate option specifies a list of extension names that this extension depends on. [72a5b1f]
PDF page 41
3.1.20 Reduction of WAL output
Reduced amount of WAL output for FREEZE operations. [9e54059]
3.1.21 SIMD support
The following processes now support SIMD expansion and are faster. SIMD supported architectures are Intel Streaming SIMD Extensions (SSE2) and ARM Advanced SIMD (NEON). [b6ef167, 121d2d3, 56f2c7b, 82739d4, 37a6e5d]
ASCII string check
JSON string check
Snapshot processing and array search
4 SQL Statements
PDF page 42
This section explains new features related to SQL statements.
3.2.1 Data Types
The following extensions have been implemented for data types: [2ceea5a, 6fcda9a, 102a5c1, 6dfacbf, faff8f8, 096dd80]
+infinity notation
The +infinity value can now be specified for date, timestamp, and timestamp with time zone types. +infinity is considered the same as infinity.
Integer Literals
Integer literals can now be represented in hexadecimal, octal, and binary. Each is represented as follows. Specify a leading ‘0’ followed by a symbol indicating the base. The case is not sensitive. This change corresponds to the SQL:202x draft.
| Designation method | Example | Note |
|---|---|---|
| HexadecimalOctal | 0x42F 0o273 | |
| Binary number | 0b100101 |
PDF page 43
JSONPATH literal
Hexadecimal, octal, and binary representations can also be specified in JSONPATH.
PDF page 44
Numeric type
The numeric type supports hexadecimal, octal, and binary representations. However, it cannot be written below the decimal point.
Numeric literals and underscores
Underscores (_) can be specified in numeric literals. This change corresponds to the SQL:202x draft.
PDF page 45
3.2.2 COPY
The following features have been implemented for the COPY statement: [9f8377f, 97da482]
Insert default value
The option DEFAULT have been added to the COPY FROM statement. If the value specified for this option matches the input value, then the DEFAULT value for the column will be entered. If there is no DEFAULT specification for the column and there is data that matches the DEFAULT option of the COPY statement, an error will occur.
PDF page 46
Effective range of the batch_size option
The batch_size option of foreign server (FOREIGN SERVER) and foreign table (FOREIGN TABLE) can now be used when executing the COPY statement for a foreign table. Previously, it was valid only when executing the INSERT statement.
3.2.3 CREATE ROLE/USER
Roles/users with the CREATEROLE attribute will be able to grant other users only their own attributes and roles granted with the ADMIN OPTION. The CREATEDB attribute has the same behavior as in older versions. [f1358ca]
PDF page 47
3.2.4 CREATE STATISTICS
The name of the statistic is no longer mandatory. If the name is omitted, the statistic name is automatically generated from the original table name and column name. [624aa2a]
PDF page 48
3.2.5 CREATE TABLE
The following new features have been added to the CREATE TABLE statement. [784cedd, b9424d0]
Specification of the STORAGE clause
The STORAGE clause can now be specified in the CREATE TABLE statement. In previous versions, it had to be set with the ALTER TABLE statement.
PDF page 49
DEFAULT Storage
The STORGE clause of the CREATE TABLE and ALTER TABLE statements can be DEFAULT to indicate the default storage format.
3.2.6 EXPLAIN
Add GENERIC_PLAN option to show the execution plan for parameterized query strings. [3c05284]
PDF page 50
3.2.7 GRANT
The following features have been added to the GRANT statement. [e3ce2de, 3d14e17, ce6b672, c44f633]
LOCK TABLE statement
The execution privilege of the LOCK TABLE statement has been simplified. Table owners, superusers, and holders of the pg_maintain role can execute the LOCK TABLE statement in any mode. The table below shows the relationship between table access privileges and permitted lock modes.
| Tableaccessprivileges | Allowedlockmode |
|---|---|
| MAINTAIN, UPDATE, DELETE, TRUNCATE Any lock mode | Anylockmode |
| INSERT | ROW EXCLUSIVE MODE |
| SELECT | ACCESS SHARE MODE |
WITH INHERIT clause
It is now possible to specify the WITH INHERIT OPTION clause (or WITH INHERI TRUE) that inherits privileges and the WITH INHERIT FALSE clause that does not inherit privileges. The default is WITH INHERIT TRUE. The specified value can be checked in the inherit_option column of the pg_auth_members catalog.
PDF page 51
WITH SET clause
It is now possible to specify the WITH SET OPTION clause (or WITH SET OPTION), which allows the use of the SET ROLE statement, and the WITH SET FALSE clause, which disallows it. The default is WITH SET TRUE. The specified value can be confirmed in the set_option column of the pg_auth_members catalog.
3.2.8 JSON
Enhanced JSON related syntax. [7081ac4, 6ee3020]
JSON Constructor
JSON type constructors that are compliant with the SQL/JSON standard have been added. The following functions are available
PDF page 52
Syntax 3 - JSON Constructor
PDF page 53
IS JSON Syntax
Add IS JSON syntax to check conformance to JSON syntax. Multiple syntaxes are provided depending on the type of JSON format.
PDF page 54
Syntax 4 - IS JSON clause
Accept fractional seconds
Accept fractional seconds in jsonpath’s datetime method. This fix is backported to PostgreSQL 13 and later. [7398e27]
PDF page 55
3.2.9 REINDEX
The database name can now be omitted in the REINDEX SYSTEM and REINDEX DATABASE statements. If the database name is omitted, the command is executed for the current database. Also, in the REINDEX DATABASE statement, REINDEX processing for the system catalog will not be executed. [2cbc3c1]
3.2.10 VACUUM
The VACUUM statement has the following new features: [a46a701, d977ffd, 4211fbd, 1cbbee0, 1de58df]
Database Statistics
Add the SKIP_DATABASE_STATS option to the VACUUM statement to suppress updating database statistics. Setting this option to TRUE suppresses scans into the pg_class catalog, improving concurrency. The ONLY_DATABASE_STATS option is now available to retrieve database statistics only.
TOAST only VACUUM
By specifying the PROCESS_MAIN FALSE, only TOAST data can be VACUUMed. The PROCESS_MAIN option is TRUE by default.
PDF page 56
Shared buffer limit
Add the BUFFER_USAGE_LIMIT option to specify the shared buffer usage when executing VACAUUM and ANALYZE statements. The default value if this option is not specified is determined by the parameter vacuum_buffer_usage_limit (default value 256kB). The range of possible values for this option is 128 kB to 16 GB, but the range beyond 1/8 of the parameter shared_buffers is not used.
Page-level FREEZE
The FREEZE process, which used to be performed for each tuple, can now be performed for each page. This will perform WAL deduplication and reduce the amount of writes.
PDF page 57
3.2.11 Subquery
It is no longer necessary to specify an alias name for subqueries in the FROM clause. [bcedd8f]
3.2.12 Execution Plan
Faster execution plans are now chosen in the following cases: [3c6fc58, ed1a88d, 16dc270, 9bfd282]
SELECT DITINCT statement
Aggregate functions with ORDER BY or DISTINCT clauses can now run more efficiently. This behavior can be controlled with the parameter enable_presorted_aggregate parameter. Setting the value of this parameter to ‘off’ will make it behave the same as PostgreSQL 15.
PDF page 58
WINDOW functions
The execution plans can now be shared for OVER clauses that are similar, such as ROWS UNBOUNDED PRECEDING AND CURRENT ROW and RANGE UNBOUNDED PRECEDING AND CURRENT ROW.
PDF page 59
HASH Join / MERGE Join
Hash join and merge join are now supported for the RIGHT ANTI JOIN on non-NULL-valued inputs.
PDF page 60
PDF page 61
Memoize by UNION ALL
Memoize can now be used in the Append operation with the UNION ALL clause.
PDF page 62
Improve performance for partition lookups
LIST / RANGE partition table now caches partition information if the same partition is found 16 times. Faster searches on tables with many partitions. [a61b1f7, a61b1f7]
3.2.13 Functions
The following functions have been added/enhanced. [888f2ea, 2ddab01, 38d8176, d5d5741, 75bd846, 75bd846, 283129e, 0823d06, cca1863, 13e0d7a, 10ea0f9, 1939d26, 1939d26, bf03cfd, 483bdb2]
Array_sample / array_shuffle
Two new functions have been added: array_sample, which returns a specified number of random elements from an array, and array_shuffle, which shuffles the elements of an array.
Syntax 5 - Array_sample / array_shuffle function
PDF page 63
Any_value
Add aggregate function any_value. This function non-deterministically returns an arbitrary value from the input values of the aggregate. This function is part of the SQL:2023 standard.
Syntax 6 - Any_value function
PDF page 64
Date_add / date_subtract
Add functions for adding and subtracting dates and times. The date_add function adds time and the date_subtract function subtracts time. The timezone parameter is optional.
Syntax 7 - Date_add / date_subtract function
Date_trunc
The immutability of functions of the form date_trunc(unit, timestamptz, text) has been changed from stable to immutable.
Erf / erfc
Add erf and erfc functions to compute the error function and complementary error.
Syntax 8 - Erf / erfc functions
PDF page 65
Generate_series
Added generate_series function that allows timezone name to be specified.
Syntax 9 - Generate_series function
Random_normal
Add function random_normal to generate normally distributed random numbers. Specify the mean and standard deviation. The extension tablefunc already provided the normal_rand function, which has been modified and provided as a system function.
Syntax 10 - Random_normal function
PDF page 66
Pg_read_file / pg_read_binary_file
Add a version with a filename and the missing_ok parameter to indicate what to do if the file doesn’t exist.
Syntax 11 - Pg_read_file / Pg_read_binary_file functions
Pg_split_walfile_name
This function returns the sequence number and timeline id from the WAL file name.
Syntax 12 - Pg_split_walfile_name function
PDF page 67
Pg_stat_get_backend_subxact
This function retrieves sub transaction information in a particular backend’s cache.
Syntax 13 - Pg_stat_get_backend_subxact function
Pg_input_is_valid
The pg_input_is_valid function can check whether a given value matches a data type. Overflow digits and improper date strings can be checked in advanced. The input data and data type are specified as strings.
Syntax 14 - Pg_input_is_valid function
PDF page 68
Pg_input_error_info
The pg_input_error_info function can get the error message, hint string, and error code when the input data is not appropriate for the specified data type.
Syntax 15 - Pg_input_error_info function
Pg_size_bytes
This function now accepts B (bytes) as the unit.
PDF page 69
Pg_import_system_collations
Now available in Microsoft Windows environment.
System_user
The SYSTEM_USER function is a SQL standard reserved word and is a function that returns an authentication method and an authentication ID. Returns NULL for TRUST authentication.
Syntax 16 - System_user function
Xmlserialize
Add the INDENT option (and NO INDENT) to pretty (or not pretty) XML documents.
PDF page 70
5 Configuration Parameters
PDF page 71
In PostgreSQL 16, the following parameters have been changed.
3.3.1 Added parameters
The following parameters have been added. [6e2775e, e5b8a4c, 1671f99, 3226f47, 5de94a0, 216a784, b577743, 51b5834, 1e8b617, 3d4fa22, 6de31ce, 9c0a0e2]
| Parameter name | Description (context) | Default value |
|---|---|---|
| debug_io_direct | Determine where direct I/O is used (postmaster) | '' |
| debug_logical_replication_streaming | Setting the transfer method for logical replication (user) | buffered |
| createrole_self_grant | Options automatically specified in the GRANT statement (user) | '' |
| enable_presorted_aggregate | Use the sort processing optimization function (user) | on |
| gss_accept_delegation | Whether to accept GSSAPI authentication delegation from the client (sighup) | off |
| icu_validation_level | ICU locale check log output level (user) | error |
| max_parallel_apply_workers_per_subscription | Maximum number of workers per subscription (sighup) | 2 |
| reserved_connections | Number of connections reserved for general users (postmaster) | 0 |
| scram_iterations | SCRAM authentication iteration count (user) | 4096 |
| send_abort_for_crash | Send a SIGABRT signal when the backend crashes (sighup) | off |
| send_abort_for_kill | Send SIGABRT signal when child process is stuck (sighup) | off |
| vacuum_buffer_usage_limit | Default shared buffer size used by VACUUM (user) | 256kB |
PDF page 72
Debug_io_direct
Request the OS to use Direct I/O. Specify O_DIRECT on Linux/UNIX, F_NOCACHE on macOS, and FILE_FLAG_NO_BUFFERING on Windows when opening the file. For the parameter, specify multiple target areas separated by commas (,). [319bae9, d4e71df]
| Value | Description | Note |
|---|---|---|
| data | I/O to main data file | |
| wal | I/O to WAL files | |
| wal_init | I/O for WAL file initialization |
This parameter is currently for developers (Developer Option category).
Send_abort_for_crash / Send_abort_for_kill
The postmaster process first sends a SIGQUIT signal and then a SIGKILL signal when a child process crashes. Send_abort_for_crash and send_abort_for_kill change the signal to SIGABRT by setting each to ‘on’. [3226f47]
3.3.2 Modified Parameters
The following parameters have been changed in terms of setting range and choices. [9430fb4, 6c31ac0, 5352ca2, 0981846]
| Parameter name | Changes |
|---|---|
| archive_command | It can no longer be set at the same time as archive_library. |
| archive_library | It can no longer be set at the same time as archive_command. |
| wal_sync_method | It is now possible to specify fdatasync on NTFS in Windows environment. |
| shared_preload_libraries | Now also handled in single user mode (backported to PostgreSQL 15). |
| debug_parallel_query | Renamed from force_parallel_mode. |
PDF page 73
3.3.3 Parameters with default values changed
The following parameters have changed default values.
| Parameter name | PostgreSQL 15 | PostgreSQL 16 | Note |
|---|---|---|---|
| server_version | 15.4 | 16.0 | |
| server_version_num | 150004 | 160000 |
3.3.4 Removed parameter
The following parameter have been removed. [b0f6c43, cd4329d, 1118cd3]
| Parameter name | Reason |
|---|---|
| lc_collate | This was determined to be unnecessary, because the exact perdatabase value must be referenced in the pg_database view. |
| lc_ctype | This was determined to be unnecessary, because the exact perdatabase value must be referenced in the pg_database view. |
| promote_trigger_file | Removed because process startup every 5 seconds was deemed useless and trigger files are no longer supported. |
| vacuum_defer_cleanup_age | Removed due to difficulty in determining a reasonable setpoint and the availability of alternatives. |
6 Utilities
PDF page 74
Describes the major enhancements of utility commands.
3.4.1 Configure
The configure command has the following options changed. [9db49fc, d3b111e, fcb21b3]
| Option name | Modify | Description |
|---|---|---|
| –with-gnu-ld | Remove | Assume the C compiler uses GNU ld |
| –with-segsize-blocks | Add | Set table segment size in blocks |
| –with-icu | Remove | Build with ICU support |
| –without-icu | Add | Build without ICU support |
3.4.2 Createuser
Multiple options have been added to the createuser command. The –role option can still be used, but it is deprecated. [08951a7, 2dcd157, 381d19b]
| Option name | Short option | Description |
|---|---|---|
| –with-admin=ROLE | -a | ROLE will be a member of new role with admin option |
| –with-member=ROLE | -m | ROLE will be a member of new role |
| –valid-until=TIMESTAMP | -v | Password expiration |
| –bypassrls | - | Add Bypass RLS attribute |
| –no-bypassrls | - | Do not assign Bypass RLS attribute |
| –member-of=ROLE | -g | new role will be a member of ROLE (modified from –role option) |
PDF page 75
3.4.3 Initdb
The following enhancements have been implemented to the initdb command: [27b6237, 30a53b7, 3e51b27, af3abca]
–icu-rules option
The –icu-rules option has been added to add a custom rule to the ICU locale.
–set option
The –set option (shorthand option is -c) specifies the initial values of the parameters described in the postgresql.conf file. This option can be specified multiple times.
PDF page 76
Check locale command
The initdb command now exits successfully even if the ’locale’ command does not exist. In previous versions, the initdb command would fail if the locale -a command failed.
3.4.4 Pgindent
The following options have been added/extended to the pgindent command. [b90f0b5, a1c4cd6, 068a243, b16259b]
| Option name | Change | Description |
|---|---|---|
| –build | Remove | Building the pg_bsd_indent command |
| –code-base | Remove | Specifying base directory for source code |
| –commit=gitref | Add | Target files changed in the specified commit |
| –excludes=PATH | Change | Can be specified multiple times |
| –help | Add | Output usage |
| –show-diff | Add | View changes |
| –silent-diff | Add | Exit with return value 2 if there are any changes |
3.4.5 Pg_basebackup
It is now possible to specify ’long’ for the level of the Zstandard compression method. This option improves the compression ratio for large data, but increases resource usage. [2820adf]
PDF page 77
3.4.6 Pg_bsd_indent
The BSD-style indentation tool the pg_bsd_indent command, developed in a separate project, has been incorporated into the core repository. [4e831f4]
3.4.7 Pg_dump
The following enhancements have been implemented in the pg_dump command. [5e73a60, 0da243f, 84adc8e, 2820adf, 35ce24c, 2f80c95, a563c24, 5f53b42]
–compress option
The –compress option now accepts a compression method and compression level separated by a colon (:). The compression method can be none, gzip, lz4 or zstd. The value that can be specified for compression level differs depending on the compression method.
| Compression Method | Default level | Level Range | Note |
|---|---|---|---|
| none | - | - | |
| gzip | -1 | 1~9 | |
| lz4 | 0 | 1~12 | |
| zstd | 3 | -131072~22, long |
PDF page 78
–large-objects option
The –blob and –no-blob options from previous versions have been changed to –large-objects and - -no-large-objects. Legacy options are still available, but are deprecated.
–table-and-children option
Basically, the same as the –table option. Includes tables matching the pattern and their child tables and partitions.
PDF page 79
–exclude-table-and-children option
Basically, the same as the –exclude-table option. Exclude tables matching the pattern and their child tables and partitions.
–exclude-table-data-and-children option
Basically, the same as the –exclude-table-data option. Exclude data from tables matching the pattern and their child tables and partitions.
Lock acquisition
The pg_dump command executes a LOCK TABLE statement on the target table at startup. In PostgreSQL 16, multiple table names are described for one LOCK TABLE to reduce the amount of communication between the client and server.
3.4.8 Pg_receivewal / Pg_recvlogical
The SIGTERM signal has been added as a program exit condition in addition to the existing SIGINT signal. This change corresponds to the default value of the systemd exit signal (KillSignal). [8b60db7]
3.4.9 Pg_upgrade
Add the –copy option to the pg_upgrade command. This is the default behavior. Copies locale and encoding information from source to destination. [746915c, 9637bad]
3.4.10 Pg_verifybackup
Add the –progress option (shortened option -P). Report progress. [d07c294]
PDF page 80
3.4.11 Pg_waldump
The following new features have been added to the pg_waldump command. [d497093, 4c8044c , b381d96]
–save-fullpage option
Add the –save-fullpage option to specify the directory to save full page images. The specified directory must be empty. A full-page image is created with the following file name:
PDF page 81
| Notation | Description | Example |
|---|---|---|
| Timeline hexadecimal format | 00000000 | |
| LSN hexadecimal format | 05AD6E48 | |
| OID of the tablespace | 1663 | |
| OID of the database | 5 | |
| Relation filenode | 16388 | |
| Block number | 20 | |
| Fork name | main |
–timeline option
The –timeline option now accepts hexadecimal strings.
PDF page 82
3.4.12 Psql
The following enhancements have been implemented to the psql command: [b0d8f2d, 31ae2aa, bd95816, 5b66de3, a45388d, d913928, 6f9ee74, 31ae2aa]
Command execution status
The execution status of !, \g, \o, \w, and \copy metacommands can now be obtained with the following variables.
| Variable name | Description |
|---|---|
| SHELL_ERROR | ’true’ if command execution result is 0, ‘false’ if not 0 |
| SHELL_EXIT_CODE Command exit code | Commandexitcode |
\d+ metacommand
Executing the \d+ meta command on a partitioned table will output “FOREIGN” if the partition is an external table.
PDF page 83
\bind metacommand
Add \bind metacommand to set values for bind variables in SQL statements. A semicolon (;) is not considered a line terminator, so specify something like \g.
PDF page 84
\pset metacommand
Add the xheader_width option to \pset metacommand. This option can limit the width of the header when outputting in extended table format. The values that can be specified are as follows.
| Value | Description | Note |
|---|---|---|
| full | Widest line length (default) | |
| column | Truncate to Width of First Column | |
| page | Truncate to Terminal Page Width | |
| Numerical value | Truncate to Specified Number |
PDF page 85
\dpS metacommand
‘S’ can now be specified for \dp meta-command and \z meta-command. Along with this, the operation of the \dp or \z command has been changed from the previous version. Temporary objects were included in the list, and objects in the information_schema schema were excluded.
\watch metacommand
Add validation of entered values. Any non-numeric or negative value will result in an error. Specify zero (0) to rerun without an interval. Also, the number of reruns can now be specified. To limit the number of re-executions, specify the interval and the number of executions in the “i=interval c=number of times of execution” format.
PDF page 86
\drg metacommand
Added \drg meta command to output role grant information. [d65ddac]
3.4.13 Vacuumdb
The following options have been added to the vacuumdb command. [7781f4e, 4211fbd, ae78cae]
–schema option
Specify the name of the schema to which the table to be VACUUMed belongs. The shorthand option is -n. This option can be specified multiple times. This option cannot be used with the –excludeschema option.
–exclude-schema option
Specify the name of the schema to which the table that does not execute VACUUM belongs. The shorthand option is -N. This option cannot be used at the same time as the –schema option.
PDF page 87
–no-process-main option
Added the option –no-process-main for the VACUUM (PROCESS_MAIN FALSE) statement.
–buffer-usage-limit option
Add the –buffer-usage-limit option for VACUUM (BUFFER_USAGE_LIMIT) statement.
PDF page 88
7 Contrib Modules
PDF page 89
Describes new features related to the Contrib modules.
3.5.1 Auto_explain
The following features have been added to the auto_explain: [d4bfe41, 9d2d972]
Parameter log_parameter_max_length
Add the log_parameter_max_length parameter. This parameter limits the maximum log output width. The default value is -1, which imposes no limit. Specifying 0 for this parameter disables logging.
Output of the query ID
The query ID is output if the parameter auto_explain.log_verbose is set to ‘on’ and compute_query_id is set to ‘on’.
3.5.2 Fuzzystrmatch
The daitch_mokotoff function has been added to the fuzzystrmatch module. This function is superior to the SOUNDEX function for non-English languages. [a290378]
PDF page 90
3.5.3 Ltree
Hyphens (-) are now allowed in labels. Previously, only letters, numbers, and underlines (_) were permitted. The maximum label size has been increased from 255 to 1,000 characters. [b1665bf]
3.5.4 Pageinspect
The following features have been added to the pageinspect: [1fd3dd2, 3581cbd, 428c0ca]
Bt_multi_page_stats function
Add function bt_multi_page_stats to print B-Tree index page summaries. This function is the multipage version of the bt_page_stats function. Specify the first block number and number of pages.
Brin_page_items function
The “empty” column has been added to the output of the brin_page_items function to indicate free blocks.
3.5.5 Pg_buffercache
The following functions have been added to the pg_buffercache module. [f3fa313, f3fa313]
PDF page 91
Pg_buffercache_summary function
Add the pg_buffercache_summary function that can check buffer cache summary by SQL statement.
| Column name | Description | Note |
|---|---|---|
| buffers_usedbuffers_unusedbuffers_dirtybuffers_pinnedusagecount_avg | Total number of buffers used Number of free buffers Number of dirty buffers Number of pinned buffers Average amount of dirty buffers used |
Pg_buffercache_usage_counts function
Returns a summary of the state of all shared buffers. It is easier to check the information than by aggregating the pg_buffercache view.
PDF page 92
3.5.6 Pg_stat_statements
Updated how SQL statements are generalized. SET statements, CHECKPOINT statements, CREATE statements, etc. are collected as the same query ID regardless of case. [9ba37b2, daa8365]
3.5.7 Pg_walinspect
Add the pg_get_wal_block_info function. This function extracts a full-page image between specified LSNs. [c31cf1c, 9ecb134, 122376f]
Syntax 17 - Pg_get_wal_block_info function
PDF page 93
| Column name | Data type | Description | Note |
|---|---|---|---|
| start_lsn | pg_lsn | Start LSN | |
| end_lsn | pg_lsn | End LSN | |
| prev_lsn | pg_lsn | Previous LSN | |
| block_id | smallint | Block ID | |
| reltablespacereldatabase | oid | OID of the tablespace | |
| oid | OID of the database | ||
| relfilenoderelforknumber | oid | OID of the relation file node | |
| smallint | Relation fork number | ||
| relblocknumberxid | bigint | Block number of the table | |
| xid | Transaction ID | ||
| resource_managerrecord_type | text | Resource manager name | |
| text | WAL record type | ||
| record_lengthmain_data_length | integer | WAL record length | |
| integer | Main data length | ||
| block_data_lengthblock_fpi_length | integer | Block data length | |
| integer | Block FPI data length | ||
| block_fpi_infodescription | text[] | Block FPI information | |
| text | Description | ||
| block_datablock_fpi_data | bytea | Block data | |
| bytea | FPI data |
PDF page 94
3.5.8 Postgres_fdw
The following enhancements have been implemented in the postgres_fdw module. [97da482, 8ad51b5, 983ec23]
COPY FROM statement
The COPY FROM statement now uses the foreign table’s batch_size option. Below is the log using the log_statement parameter for the instance that owns the table. It can be confirmed that multiple records are inserted in batch.
Analyze_sampling option
The analyze_sampling option has been added to FOREIGN SERVER and FOREIGN TABLE. Previous versions fetched the entire foreign table record for statistics. The load on the remote database can be reduced by using the TABLESAMPLE clause when retrieving information from external tables. The default value is auto, which is assumed to be random for PostgreSQL < 9.5 and bernoulli for PostgreSQL 9.5 and higher. The values that can be set are as follows.
| auto | version (default value) |
|---|---|
| random | Sampling is done using the random function. |
| system | Sampling is done using the TABLESAMPLE SYSTEM clause. |
| bernoulli | Sampling is done using the TABLESAMPLE BERNOULLI clause. |
Value Description Off Do not sample.
PDF page 95
Parallel_abort option
Postgres_fdw aborts remote transactions one at a time if it aborts the local transaction. Setting the option parallel_abort to ’true’ aborts remote transactions in parallel, improving performance. The default value for this option is ‘false’.
8 URL List
The links in this chapter are preserved from the source PDF’s URL list.
PDF page 96
9 Change History
This chapter preserves the source document’s revision history and publication credits.
PDF page 97
Change history
| Version | Date | Author | Description |
|---|---|---|---|
| 0.1 | Apr 25, 2023 | Noriyoshi Shinoda | Create an internal review version. Reviewers: Tomoo Takahashi Akiko Takeshima (Hewlett Packard Enterprise Japan) |
| 1.0 | May 28, 2023 | Noriyoshi Shinoda | Verification completed in PostgreSQL 16 Beta 1 environment. |
| 1.1 | September 19, | Noriyoshi | Verification completed in PostgreSQL 16 GA |
| 2023 | Shinoda | environment. |