Release date: 2023-09-14
PostgreSQL 16 contains many new features and enhancements, including:
Allow parallelization of
FULLand internal right
Allow logical replication from standby servers
Allow logical replication subscribers to apply large transactions in parallel
Allow monitoring of I/O statistics using the new
Add SQL/JSON constructors and identity functions
Improve performance of vacuum freezing
Add support for regular expression matching of user and database names in
pg_hba.conf, and user names in
The above items and other new features of PostgreSQL 16 are explained in more detail in the sections below.
A dump/restore using pg_dumpall or use of pg_upgrade or logical replication is required for those wishing to migrate data from any previous release. See Section 17.6 for general information on migrating to new major releases.
Version 16 contains a number of changes that may affect compatibility with previous releases. Observe the following incompatibilities:
Change assignment rules for PL/pgSQL bound cursor variables (Tom Lane)
Previously, the string value of such variables was set to match the variable name during cursor assignment; now it will be assigned during
OPEN, and will not match the variable name. To restore the previous behavior, assign the desired portal name to the cursor variable before
NULLS NOT DISTINCTindexes for primary keys (Daniel Gustafsson)
Processing such indexes is still possible using
GENERATEDexpression restrictions on inherited and partitioned tables (Amit Langote, Tom Lane)
Columns of parent/partitioned and child/partition tables must all have the same generation status, though now the actual generation expressions can be different.
Remove pg_walinspect functions
Rename server variable
Remove the ability to create views manually with
ON SELECTrules (Tom Lane)
Remove the server variable
Remove server variable
Role inheritance now controls the default inheritance status of member roles added during
The role's default inheritance behavior can be overridden with the new
GRANT ... WITH INHERITclause. This allows inheritance of some roles and not others because the members' inheritance status is set at
GRANTtime. Previously the inheritance status of member roles was controlled only by the role's inheritance status, and changes to a role's inheritance status affected all previous and future member roles.
Restrict the privileges of
CREATEROLEand its ability to modify other roles (Robert Haas)
Previously roles with
CREATEROLEprivileges could change many aspects of any non-superuser role. Such changes, including adding members, now require the role requesting the change to have
ADMIN OPTIONpermission. For example, they can now change the
BYPASSRLSproperties only if they also have those permissions.
Remove symbolic links for the postmaster binary (Peter Eisentraut)
Below you will find a detailed account of the changes between PostgreSQL 16 and the previous major release.
Allow incremental sorts in more cases, including
Add the ability for aggregates having
DISTINCTto use pre-sorted data (David Rowley)
The new server variable
enable_presorted_aggregatecan be used to disable this.
Allow memoize atop a
UNION ALL(Richard Guo)
Allow anti-joins to be performed with the non-nullable input as the inner relation (Richard Guo)
Allow parallelization of
FULLand internal right
OUTERhash joins (Melanie Plageman, Thomas Munro)
Improve the accuracy of
GINindex access optimizer costs (Ronan Dunklau)
Allow more efficient addition of heap and index pages (Andres Freund)
During non-freeze operations, perform page freezing where appropriate (Peter Geoghegan)
This makes full-table freeze vacuums less necessary.
Allow window functions to use the faster
ROWSmode internally when
RANGEmode is active but unnecessary (David Rowley)
Allow optimization of always-increasing window functions
Allow aggregate functions
array_agg()to be parallelized (David Rowley)
Improve performance by caching
LISTpartition lookups (Amit Langote, Hou Zhijie, David Rowley)
Allow control of the shared buffer usage by vacuum and analyze (Melanie Plageman)
BUFFER_USAGE_LIMIT, and the vacuumdb option is
--buffer-usage-limit. The default value is set by server variable
vacuum_buffer_usage_limit, which also controls autovacuum.
wal_sync_method=fdatasyncon Windows (Thomas Munro)
Allow HOT updates if only
BRIN-indexed columns are updated (Matthias van de Meent, Josef Simanek, Tomas Vondra)
Improve the speed of updating the process title (David Rowley)
subxidsearches and ASCII string detection to use vector operations (Nathan Bossart, John Naylor)
ASCII detection is particularly useful for
COPY FROM. Vector operations are also used for some C array searches.
Reduce overhead of memory allocations (Andres Freund, David Rowley)
Add system view
pg_stat_ioview to track I/O statistics (Melanie Plageman)
Record statistics on the last sequential and index scans on tables (Dave Page)
Record statistics on the occurrence of updated rows moving to new pages (Corey Huinker)
Add speculative lock information to the
pg_lockssystem view (Masahiko Sawada, Noriyoshi Shinoda)
The transaction id is displayed in the
transactionidcolumn and the speculative insertion token is displayed in the
Add the display of prepared statement result types to the
pg_prepared_statementsview (Dagfinn Ilmari Mannsåker)
Create subscription statistics entries at subscription creation time so
stats_resetis accurate (Andres Freund)
Previously entries were created only when the first statistics were reported.
Correct the I/O accounting for temp relation writes shown in
pg_stat_get_backend_subxact()to report on a session's subtransaction cache (Dilip Kumar)
pg_stat_get_backend_activity(), and related functions use the unchanging backend id (Nathan Bossart)
Previously the index values might change during the lifetime of the session.
Report stand-alone backends with a special backend type (Melanie Plageman)
Add wait event
SpinDelayto report spinlock sleep delays (Andres Freund)
Create new wait event
DSMAllocateto indicate waiting for dynamic shared memory allocation (Thomas Munro)
Previously this type of wait was reported as
DSMFillZeroWrite, which was also used by
Add the database name to the process title of logical WAL senders (Tatsuhiro Nakamori)
Physical WAL senders do not display a database name.
Add checkpoint and
REDO LSNinformation to
log_checkpointsmessages (Bharath Rupireddy, Kyotaro Horiguchi)
Provide additional details during client certificate failures (Jacob Champion)
Add predefined role
pg_create_subscriptionwith permission to create subscriptions (Robert Haas)
Allow subscriptions to not require passwords (Robert Haas)
This is accomplished with the option
Simplify permissions for
LOCK TABLE(Jeff Davis)
Previously a user's ability to perform
LOCK TABLEat various lock levels was limited to the lock levels required by the commands they had permission to execute on the table. For example, someone with
UPDATEpermission could perform all lock levels except
ACCESS SHARE, even though it was a lesser lock level. Now users can issue lesser lock levels if they already have permission for greater lock levels.
ALTER GROUP group_name ADD USER user_nameto be performed with
ADMIN OPTION(Robert Haas)
CREATEROLEpermission was required.
WITH ADMIN TRUE/
FALSEsyntax (Robert Haas)
Previously only the
WITH ADMIN OPTIONsyntax was supported.
Allow roles that create other roles to automatically inherit the new role's rights or the ability to
SET ROLEto the new role (Robert Haas, Shi Yu)
This is controlled by server variable
Prevent users from changing the default privileges of non-inherited roles (Robert Haas)
This is now only allowed for inherited roles.
When granting role membership, require the granted-by role to be a role that has appropriate permissions (Robert Haas)
This is a requirement even when a non-bootstrap superuser is granting role membership.
Allow non-superusers to grant permissions using a granted-by user that is not the current user (Robert Haas)
The current user still must have sufficient permissions given by the specified granted-by user.
This is controlled by a new
GRANT ... SEToption.
Add dependency tracking to roles which have granted privileges (Robert Haas)
For example, removing
ADMIN OPTIONwill fail if there are privileges using that option;
CASCADEmust be used to revoke dependent permissions.
Add dependency tracking of grantors for
GRANTrecords (Robert Haas)
This guarantees that
grantorvalues are always valid.
Allow multiple role membership records (Robert Haas)
Previously a new membership grant would remove a previous matching membership grant, even if other aspects of the grant did not match.
Prevent removal of superuser privileges for the bootstrap user (Robert Haas)
Restoring such users could lead to errors.
makeaclitem()to accept multiple privilege names (Robins Tharakan)
Previously only a single privilege name, like
SELECT, was accepted.
Add support for Kerberos credential delegation (Stephen Frost)
Allow the SCRAM iteration count to be set with server variable
Improve performance of server variable management (Tom Lane)
Tighten restrictions on which server variables can be reset (Masahiko Sawada)
postgresql.confitems into new categories (Shinya Kato)
This also affects the categories displayed in the
Prevent configuration file recursion beyond 10 levels (Julien Rouhaud)
Allow autovacuum to more frequently honor changes to delay settings (Melanie Plageman)
Rather than honor changes only at the start of each relation, honor them at the start of each block.
Remove restrictions that archive files be durably renamed (Nathan Bossart)
archive_commandcommand is now more likely to be called with already-archived files after a crash.
Allow the postmaster to terminate children with an abort signal (Tom Lane)
This allows collection of a core dump for a stuck child process. This is controlled by
send_abort_for_kill. The postmaster's
-Tswitch is now the same as setting
Remove the non-functional postmaster
-noption (Tom Lane)
Allow the server to reserve backend slots for roles with
pg_use_reserved_connectionsmembership (Nathan Bossart)
The number of reserved slots is set by server variable
Allow huge pages to work on newer versions of Windows 10 (Thomas Munro)
This adds the special handling required to enable huge pages on newer versions of Windows 10.
debug_io_directsetting for developer usage (Thomas Munro, Andres Freund, Bharath Rupireddy)
While primarily for developers,
open_datasynchas been modified to not use direct I/O with
wal_level=minimal; this is now enabled with
pg_split_walfile_name()to report the segment and timeline values of WAL file names (Bharath Rupireddy)
Add support for regular expression matching on database and role entries in
Regular expression patterns are prefixed with a slash. Database and role names that begin with slashes need to be double-quoted if referenced in
Improve user-column handling of
Specifically, add support for
all, role membership with
+, and regular expressions with a leading slash. Any user name that matches these patterns must be double-quoted.
Allow include files in
pg_hba.conftokens to be of unlimited length (Tom Lane)
Add rule and map numbers to the system view
Determine the default encoding from the locale when using ICU (Jeff Davis)
Previously the default was always
Previously they only controlled libc providers.
Add predefined collations
This only works if ICU support is enabled.
Allow custom ICU collation rules to be created (Peter Eisentraut)
Allow Windows to import system locales automatically (Juan José Santamaría Flecha)
Previously, only ICU locales could be imported on Windows.
Allow logical decoding on standbys (Bertrand Drouvot, Andres Freund, Amit Khandekar)
Snapshot WAL records are required for logical slot creation but cannot be created on standbys. To avoid delays, the new function
pg_log_standby_snapshot()allows creation of such records.
Add server variable to control how logical decoding publishers transfer changes and how subscribers apply them (Shi Yu)
The variable is
Allow logical replication initial table synchronization to copy rows in binary format (Melih Mutlu)
This is only possible for subscriptions marked as binary.
Allow parallel application of logical replication (Hou Zhijie, Wang Wei, Amit Kapila)
STREAMINGoption now supports
parallelto enable application of large transactions by parallel workers. The number of parallel workers is controlled by the new server variable
max_parallel_apply_workers_per_subscription. Wait events
LogicalApplySendDatawere also added. Column
leader_pidwas added to system view
pg_stat_subscriptionto track parallel activity.
Improve performance for logical replication apply without a primary key (Onder Kalaci, Amit Kapila)
REPLICA IDENTITY FULLcan now use btree indexes rather than sequentially scanning the table to find matches.
Allow logical replication subscribers to process only changes that have no origin (Vignesh C, Amit Kapila)
This can be used to avoid replication loops. This is controlled by the new
CREATE SUBSCRIPTION ... ORIGINoption.
Perform logical replication
SELECTand DML actions as the table owner (Robert Haas)
This improves security and now requires subscription owners to be either superusers or to have
SET ROLEpermission on all roles owning tables in the replication set. The previous behavior of performing all operations as the subscription owner can be enabled with the subscription
wal_retrieve_retry_intervaloperate on a per-subscription basis (Nathan Bossart)
Previously the retry time was applied globally. This also adds wait events >
GENERIC_PLANto display the generic plan for a parameterized query (Laurenz Albe)
COPY FROMvalue to map to a column's
DEFAULT(Israel Barth Rubio)
COPYinto foreign tables to add rows in batches (Andrey Lepikhov, Etsuro Fujita)
STORAGEtype to be specified by
CREATE TABLE(Teodor Sigaev, Aleksander Alekseev)
ALTER TABLEcould control this.
Allow truncate triggers on foreign tables (Yugo Nagata)
The options are
Previously the database name had to be specified.
CREATE STATISTICSto generate a statistics name if none is specified (Simon Riggs)
Allow non-decimal integer literals (Peter Eisentraut)
NUMERICto process hexadecimal, octal, and binary integers of any size (Dean Rasheed)
Previously only unquoted eight-byte integers were supported with these non-decimal bases.
Allow underscores in integer and numeric constants (Peter Eisentraut, Dean Rasheed)
This can improve readability for long strings of digits.
Accept the spelling
+infinityin datetime input (Vik Fearing)
Prevent the specification of
infinitytogether with other fields in datetime strings (Joseph Koshakow)
Remove undocumented support for date input in the form
pg_input_error_info()to check for type conversion errors (Tom Lane)
Allow subqueries in the
FROMclause to omit aliases (Dean Rasheed)
Add support for enhanced numeric literals in SQL/JSON paths (Peter Eisentraut)
For example, allow hexadecimal, octal, and binary integers and underscores between digits.
Add SQL/JSON constructors (Nikita Glukhov, Teodor Sigaev, Oleg Bartunov, Alexander Korotkov, Amit Langote)
Add SQL/JSON object checks (Nikita Glukhov, Teodor Sigaev, Oleg Bartunov, Alexander Korotkov, Amit Langote, Andrew Dunstan)
IS JSONchecks include checks for values, arrays, objects, scalars, and unique keys.
Allow JSON string parsing to use vector operations (John Naylor)
Improve the handling of full text highlighting function
NOTexpressions (Tom Lane)
Add functions to add, subtract, and generate
timestamptzvalues in a specified time zone (Przemyslaw Sztoch, Gurjeet Singh)
date_trunc(unit, timestamptz, time_zone)to be an immutable function (Przemyslaw Sztoch)
This allows the creation of expression indexes using this function.
Add server variable
This reports the authentication method and its authenticated user.
Add aggregate function
ANY_VALUE()which returns any value from a set (Vik Fearing)
random_normal()to supply normally-distributed random numbers (Paul Ramsey)
Add error function
erf()and its complement
Improve the accuracy of numeric
power()for integer exponents (Dean Rasheed)
INDENTto pretty-print its output (Jim Jones)
pg_collation_actual_version()to return a reasonable value for the default collation (Jeff Davis)
Previously it returned
pg_read_binary_file()to ignore missing files (Kyotaro Horiguchi)
Add byte specification (
to_reg* functions to accept numeric OIDs as input (Tom Lane)
Add the ability to get the current function's OID in PL/pgSQL (Pavel Stehule)
This is accomplished with
GET DIAGNOSTICS variable = PG_ROUTINE_OID.
Add libpq connection option
require_authto specify a list of acceptable authentication methods (Jacob Champion)
This can also be used to disallow certain authentication methods.
Allow multiple libpq-specified hosts to be randomly selected (Jelte Fennema)
This is enabled with
load_balance_hosts=randomand can be used for load balancing.
Add libpq option
sslcertmodeto control transmission of the client certificate (Jacob Champion)
The option values are
Allow libpq to use the system certificate pool for certificate verification (Jacob Champion, Thomas Habets)
ECPGvariable declarations to use typedef names that match unreserved SQL keywords (Tom Lane)
This change does prevent keywords which match C typedef names from being processed as keywords in later
Allow psql to control the maximum width of header lines in expanded format (Platon Pronko)
This is controlled by
Add psql command
\drgto show role membership details (Pavel Luzanov)
Member ofoutput column has been removed from
\dgbecause this new command displays this information in more detail.
Allow psql's access privilege commands to show system objects (Nathan Bossart)
FOREIGNdesignation to psql
\d+for foreign table children and partitions (Ian Lawrence Barwick)
\df+from showing function source code (Isaac Morland)
Function bodies are more easily viewed with
Allow psql to submit queries using the extended query protocol (Peter Eisentraut)
Passing arguments to such queries is done using the new psql
\watchto limit the number of executions (Andrey Borodin)
\watchoptions can now be named when specified.
Detect invalid values for psql
\watch, and allow zero to specify no delay (Andrey Borodin)
Allow psql scripts to obtain the exit status of shell commands and queries (Corey Huinker, Tom Lane)
Various psql tab completion improvements (Vignesh C, Aleksander Alekseev, Dagfinn Ilmari Mannsåker, Shi Yu, Michael Paquier, Ken Kato, Peter Smith)
Add pg_dump control of dumping child tables and partitions (Gilles Darold)
The new options are
Add LZ4 and Zstandard compression to pg_dump (Georgios Kokolatos, Justin Pryzby)
Allow pg_dump and pg_basebackup to use
longmode for compression (Justin Pryzby)
Improve pg_dump to accept a more consistent compression syntax (Georgios Kokolatos)
Add initdb option to set server variables for the duration of initdb and all future server starts (Tom Lane)
The option is
Add options to createuser to control more user options (Shinya Kato)
Specifically, the new options control the valid-until date, bypassing of row-level security, and role membership.
Deprecate createuser option
This option could be easily confused with new createuser role membership options, so option
--member-ofhas been added with the same functionality. The
--roleoption can still be used.
Allow control of vacuumdb schema processing (Gilles Darold)
These are controlled by options
Have pg_upgrade set the new cluster's locale and encoding (Jeff Davis)
This removes the requirement that the new cluster be created with the same locale and encoding settings.
Add pg_upgrade option to specify the default transfer mode (Peter Eisentraut)
The option is
Improve pg_basebackup to accept numeric compression options (Georgios Kokolatos, Michael Paquier)
--compress=server-5are now supported.
Fix pg_basebackup to handle tablespaces stored in the
PGDATAdirectory (Robert Haas)
Add pg_waldump option
--save-fullpageto dump full page images (David Christensen)
Allow pg_waldump options
--timelineto accept hexadecimal values (Peter Eisentraut)
Add support for progress reporting to pg_verifybackup (Masahiko Sawada)
Allow pg_rewind to properly track timeline changes (Heikki Linnakangas)
Previously if pg_rewind was run after a timeline switch but before a checkpoint was issued, it might incorrectly determine that a rewind was unnecessary.
This signal is often used by systemd.
Build ICU support by default (Jeff Davis)
This removes build flag
--with-icuand adds flag
Add support for SSE2 (Streaming SIMD Extensions 2) vector operations on x86-64 architectures (John Naylor)
Add support for Advanced SIMD (Single Instruction Multiple Data) (NEON) instructions on ARM architectures (Nathan Bossart)
Have Windows binaries built with MSVC use
RandomizedBaseAddress(ASLR) (Michael Paquier)
This was already enabled on MinGW builds.
Prevent extension libraries from exporting their symbols by default (Andres Freund, Tom Lane)
Functions that need to be called from the core backend or other extensions must now be explicitly marked
Require Windows 10 or newer versions (Michael Paquier, Juan José Santamaría Flecha)
Previously Windows Vista and Windows XP were supported.
Require Perl version 5.14 or later (John Naylor)
Require Bison version 2.3 or later (John Naylor)
Require Flex version 2.5.35 or later (John Naylor)
Require MIT Kerberos for GSSAPI support (Stephen Frost)
Remove support for Visual Studio 2013 (Michael Paquier)
Remove support for HP-UX (Thomas Munro)
Remove support for HP/Intel Itanium (Thomas Munro)
Remove support for M68K, M88K, M32R, and SuperH CPU architectures (Thomas Munro)
Remove libpq support for SCM credential authentication (Michael Paquier)
Backend support for this authentication method was removed in PostgresSQL 9.1.
Add meson build system (Andres Freund, Nazir Bilal Yavuz, Peter Eisentraut)
This eventually will replace the Autoconf and Windows-based MSVC build systems.
Allow control of the location of the openssl binary used by the build system (Peter Eisentraut)
Make finding openssl program a configure or meson option
Add build option to allow testing of small table segment sizes (Andres Freund)
The build options are
Add pgindent options (Andrew Dunstan)
The new options are
--help, and allow multiple
--excludeoptions. Also require the typedef file to be explicitly specified. Options
--buildwere also removed.
Add pg_bsd_indent source code to the main tree (Tom Lane)
Improve make_ctags and make_etags (Yugo Nagata)
pg_attributecolumns for efficiency (Peter Eisentraut)
Improve use of extension-based indexes on boolean columns (Zongliang Quan, Tom Lane)
Add support for Daitch-Mokotoff Soundex to fuzzystrmatch (Dag Lem)
Allow auto_explain to log values passed to parameterized statements (Dagfinn Ilmari Mannsåker)
This affects queries using server-side
EXECUTEand client-side parse/bind. Logging is controlled by
auto_explain.log_parameter_max_length; by default query parameters will be logged with no length restriction.
Previously even if
log_verbosewas not showing the query identifier.
Change the maximum length of ltree labels from 256 to 1000 and allow hyphens (Garen Torikian)
pg_stat_statementsnormalize constants used in utility commands (Michael Paquier)
Previously constants appeared instead of placeholders, e.g.,
Previously ending LSNs which represent nonexistent WAL locations would generate an error, while they will now be interpreted as the end of the WAL.
This is similar to
bt_page_stats()except it can report on a range of pages.
Redesign archive modules to be more flexible (Nathan Bossart)
Initialization changes will require modules written for older versions of Postgres to be updated.
Correct inaccurate pg_stat_statements row tracking extended query protocol statements (Sami Imseih)
Add pg_buffercache function
pg_buffercache_usage_counts()to report usage totals (Nathan Bossart)
Add pg_buffercache function
pg_buffercache_summary()to report summarized buffer statistics (Melih Mutlu)
Allow the schemas of required extensions to be referenced in extension scripts using the new syntax
Allow required extensions to be marked as non-relocatable using
@extschema:referenced_extension_name@to be treated as a constant for the lifetime of the extension.
Allow postgres_fdw to do aborts in parallel (Etsuro Fujita)
This is enabled with postgres_fdw option
ANALYZEon foreign postgres_fdw tables more efficient (Tomas Vondra)
The postgres_fdw option
analyze_samplingcontrols the sampling method.
Restrict shipment of
reg* type constants in postgres_fdw to those referencing built-in objects or extensions marked as shippable (Tom Lane)
Have postgres_fdw and dblink handle interrupts during connection establishment (Andres Freund)
The following individuals (in alphabetical order) have contributed to this release as patch authors, committers, reviewers, testers, or reporters of issues.
|Ankit Kumar Pandey|
|Bruno da Silva|
|Dagfinn Ilmari Mannsåker|
|David G. Johnston|
|Dong Wook Lee|
|Fabrízio de Royes Mello|
|Farias de Oliveira|
|Israel Barth Rubio|
|Jehan-Guillaume de Rorthais|
|Juan José Santamaría Flecha|
|Karl O. Pinc|
|Lakshmi Narayanan Sreethar|
|Martijn van Oosterhout|
|Matthias van de Meent|
|Matthijs van der Vleuten|
|Mehmet Emin Karakas|
|Myo Wai Thant|
|Nazir Bilal Yavuz|
|Thomas Mc Kay|
|Tor Erik Linnerud|