PostgreSQL 18 New Features
PostgreSQL 18 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 — Add system catalogs and views
- Table 5 — System catalogs/views with additional columns
- Table 6 — System catalogs/views with removed columns
- Table 7 — Views in the information_schema schema with modified content
- Table 8 — System catalogs/views with modified output
- Table 9 — Pg_aios view column structure
- Table 10 — Pg_shmem_allocations_numa view column structure
- Table 11 — Reason for conflict output
- Table 12 — Parameter io_method setting value
- Table 13 — Added connect string
- Table 14 — Added API functions
- Table 15 — Added Access Method Element
- Table 16 — Added APIs
- Table 17 — Values that can be specified in the INCLUDING / EXCLUDING clause
- Table 18 — Column name and description of the return value of the pg_ls_summariesdir function
- Table 19 — Column name and description of the return value of the pg_stat_get_backend_wal function
- Table 20 — Added parameters
- Table 21 — Modified Parameters
- Table 22 — Setting value of parameter log_connections
- Table 23 — Parameters with default values changed
- Table 24 — Added options
- Table 25 — Added options
- Table 26 — Added metacommands
- Table 27 — Added metacommand
- Table 28 — Added variables
- Table 29 — Added options
- Table 30 — Column structure of the pg_buffercache_numa view
- Table 31 — Added functions
- Table 32 — Added columns
- Table 33 — Added return column
- Table 34 — Added modules
Examples
- Example 1 — MD5 Password Warning
- Example 2 — Checksum enabled by default
- Example 3 — Prohibition of COPY FREEZE statement for external tables
- Example 4 — Contents of CSV file data1.csv
- Example 5 — PostgreSQL 17 behavior
- Example 6 — PostgreSQL 17 behavior
- Example 7 — Change default value when creating SUBSCRIPTION
- Example 8 — Error creating UNLOGGED partition table
- Example 9 — PostgreSQL 17 behavior
- Example 10 — PostgreSQL 18 behavior
- Example 11 — Remove RULE privileges
- Example 12 — PostgreSQL 17 psql command output
- Example 13 — PostgreSQL 18 psql command output (without SSL)
- Example 14 — PostgreSQL 17 pg_backend_memory_contexts view
- Example 15 — PostgreSQL 18 pg_backend_memory_contexts view
- Example 16 — Retrieving the pg_shmem_allocations_numa view
- Example 17 — Cataloging NOT NULL Constraints
- Example 18 — Cumulative VACUUM / ANALYZE execution time
- Example 19 — Error log when executing INSERT statement
- Example 20 — Propagation settings for generated columns (PUBLICATION side)
- Example 21 — Confirmation of propagation of generated sequence (SUBSCRIPTION side)
- Example 22 — Execute pg_restore_relation_stats function
- Example 23 — Execute pg_clear_relation_stats function
- Example 24 — Execute pg_restore_attribute_stats function
- Example 25 — Execute pg_clear_attribute_stats function
- Example 26 — Confirmation of I/O worker process
- Example 27 — Database cluster creation with PG_UNICODE_FAST locale specified
- Example 28 — Database creation with PG_UNICODE_FAST locale specified
- Example 29 — Deforms during hash join
- Example 30 — Execute pg_numa_available function
- Example 31 — Default privileges for LARGE OBJECT
- Example 32 — Modify the two_phase option
- Example 33 — Specifying the SET INHERIT clause
- Example 34 — Specifying the NOT VALID clause
- Example 35 — Specifying the ONLY clause
- Example 36 — Specifying the ONLY clause
- Example 37 — Output of the ANALYZE VERBOSE statement
- Example 38 — Output of the ANALYZE VERBOSE statement
- Example 39 — Output of the ANALYZE VERBOSE statement
- Example 40 — COPY TO statement for materialized view
- Example 41 — Specifying the REJECT_LIMIT option
- Example 42 — Specifying the LIKE Clause for External Tables
- Example 43 — WITHOUT OVERLAPS clause in the primary key
- Example 44 — CHECK constraints that do not operate
- Example 45 — NOT VALID clause for foreign keys in partition tables
- Example 46 — GENERATED ALWAYS VIRTUAL clause
- Example 47 — Behavior in case of overflow
- Example 48 — Using user-defined functions
- Example 49 — Disabling Nodes (PostgreSQL 18)
- Example 50 — Disabling Nodes (PostgreSQL 17)
- Example 51 — src/backend/optimizer/path/costsize.c(PostgreSQL 17)
- Example 52 — Windows Aggregation temporary storage information
- Example 53 — CTE Scan Temporary Storage Information
- Example 54 — Parallel Bitmap Heap Scan Detailed Information
- Example 55 — Loop processing line count output
- Example 56 — Index Search Count
- Example 57 — Window function output
- Example 58 — Output of old and new data in RETURNING clause
- Example 59 — Execute the VACUUM ONLY statement
- Example 60 — Execute the VACUUM VERBOSE statement
- Example 61 — Execute the VACUUM VERBOSE statement
- Example 62 — Setting the vacuum_truncate parameter
- Example 63 — Bytea and integer type casts
- Example 64 — Execution of the array_reverse function
- Example 65 — If the database collation is PG_C_UTF8
- Example 66 — If the database collation is PG_UNICODE_FAST
- Example 67 — Execution of the crc32 and crc32c functions
- Example 68 — Execution of the extract function
- Example 69 — Execution of the gamma / lgamma function
- Example 70 — Execution of the has_largeobject_privilege function
- Example 71 — Execution of the json_strip_nulls function
- Example 72 — Execution of the max / min function for bytea type
- Example 73 — Execution of the reverse function
- Example 74 — Execution of the pg_get_acl function
- Example 75 — Execution of the pg_get_sequence_data function
- Example 76 — Execution of the pg_ls_summariesdir function
- Example 77 — Execution of the pg_stat_get_backend_wal function
- Example 78 — Argument name of the regexp_count function
- Example 79 — Specify Roman numerals in the to_number function
- Example 80 — Execution of the uuidv7 function and the uuidv4 function
- Example 81 — Named cursor parameter specification
- Example 82 — Execution Plan of PostgreSQL 17
- Example 83 — Execution Plan of PostgreSQL 18
- Example 84 — Execution Plan of PostgreSQL 17
- Example 85 — Execution Plan of PostgreSQL 18
- Example 86 — Execution Plan of PostgreSQL 17
- Example 87 — Execution Plan of PostgreSQL 18
- Example 88 — Adoption of Right Semi Join
- Example 89 — Execution Plan of PostgreSQL 17
- Example 90 — Execution Plan of PostgreSQL 18
- Example 91 — Execution Plan of PostgreSQL 17
- Example 92 — Execution Plan of PostgreSQL 18
- Example 93 — Execution Plan of PostgreSQL 17
- Example 94 — Execution Plan of PostgreSQL 18
- Example 95 — Execution Plan of PostgreSQL 17
- Example 96 — Execution Plan of PostgreSQL 18
- Example 97 — Execution Plan of PostgreSQL 17
- Example 98 — Execution Plan of PostgreSQL 18
- Example 99 — Automatic VACUUM worker limit
- Example 100 — Log output by setting log_connections parameter
- Example 101 — Specifying the --no-data-checksums option
- Example 102 — Verifying Options
- Example 103 — Specifying the --sequence-data option
- Example 104 — Output statistics by pg_dump command
- Example 105 — Execute pg_verifybackup command for tar format backup
- Example 106 — Output of --help option
- Example 107 — Operation of Prepared statement
- Example 108 — Output of the \dP+ metacommand
- Example 109 — Output of the \dAo+ metacommand
- Example 110 — Pipeline Execution
- Example 111 — Extended table format mode output
- Example 112 — Output service name
- Example 113 — Title according to object type
- Example 114 — Output of the \dx metacommand
- Example 115 — Output of the \conninfo metacommand (with SSL)
- Example 116 — Specifying the --missing-stats-only option
- Example 117 — Checking the GIN index
- Example 118 — Bloom Index Usage
- Example 119 — Pass-through of SCRAM authentication credentials
- Example 120 — Additional options for file_fdw module (option on_error = 'ignore')
- Example 121 — Additional options for file_fdw module (option log_verbosity = ‘verbose’)
- Example 122 — Minimum password length setting
- Example 123 — Execution of the fips_mode function
- Example 124 — Disable built-in functions
- Example 125 — Added CFB mode
- Example 126 — SHA-256 / SHA-512 hashing and encryption
- Example 127 — Execution of the pg_buffercache_evict_relation function
- Example 128 — Execution of the pg_get_logical_snapshot_meta function
- Example 129 — Execution of the pg_get_logical_snapshot_info function
- Example 130 — Execution of the EXPLAIN (DEBUG) statement
- Example 131 — Capture internal SQL statements
- Example 132 — SET statement constant
- Example 133 — Verify additional columns (parallel query information)
- Example 134 — SQL statements to execute
- Example 135 — PostgreSQL 17 behavior
- Example 136 — PostgreSQL 18 behavior
- Example 137 — Pageinspect module
- Example 138 — Pgstattuple module
- Example 139 — Pass-through settings for SCRAM authentication
- Example 140 — Execution of the postgres_fdw_get_connections function
- Example 141 — Execution of the postgres_fdw_get_connections function
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 18 (18.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 differences between PostgreSQL 17 (17.5) and PostgreSQL 18 (18.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.
PDF page 6
| Software | Version |
|---|---|
| PostgreSQL | PostgreSQL 17.5 (for comparison) PostgreSQL 18 (18.0) (2025/09/22 20:15) |
| Operating System | Red Hat Enterprise Linux 9 Update 5 (x86-64) |
| Configure options | –with-ssl=openssl –with-lz4 –with-zstd –with-llvm –with-libxml –enable-injection-points –with-libnuma –with-liburing –with-libcurl |
1.5 The Question, Comment, and Responsibility
The contents of this document are not an official opinion of PostgreSQL Global Development Group. 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@gmail.com).
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 used by PostgreSQL users with the SUPERUSER attribute. |
| postgres=> | The psql command prompt used by PostgreSQL users without the SUPERUSER attribute. |
| Underline | Important output items. |
| «PASSWORD» | Replaced by password string. |
| … | Indicates that it is omitted. |
The syntax is described in the following rules:
PDF page 7
| 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 8
More than 200 new features have been added to PostgreSQL 18. 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:
Creating Virtual Columns
Allows the creation of virtual columns without data storage as columns of a table.
VACUUM / ANALYZE statements for partitioned tables
The VACUUM and ANALYZE statements can now specify an ONLY clause that does not recursively process partitions.
2.2 Improved reliability
PostgreSQL 18 implements the following enhancements to improve reliability.
Tar format support for pg_verifybackup command
The pg_verifybackup command can now be executed for tar format backups
2.3 Improved maintainability
The following features that can improve operability have been added.
Statistics Migration
Optimizer statistics can now be included in dump files for the pg_dump and pg_dumpall commands. Functions have also been added to set and remove optimizer statistics for tables and columns.
OAUTH SASL
Supports authentication by OAUTHBearer/SASL.
PDF page 9
EXPLAIN statement
Many options have been added to the EXPLAIN statement.
2.4 Improvements in Programming
The following functions have been added to SQL statements.
Access to Before Update Data
The RETURNING clause of the update DML can now specify an identifier that indicates the data before (OLD) and after (NEW) the update.
UUID v7 function
A function is provided that returns a UUID v7 value with a fixed leading portion.
2.5 Preparing for future new features
PostgreSQL 18 is now ready for features that will be provided in future versions.
Asynchronous I/O Infrastructure-
The infrastructure for using asynchronous I/O has been implemented. The parameter io_method specifies the asynchronous I/O method to be used.
NUMA support
Functions and views to use the basic NUMA environment have been added.
PDF page 10
2.6 Incompatibility
In PostgreSQL 18, the following specifications have been changed from PostgreSQL 17.
2.6.1 Support Information
PostgreSQL 18 changes the supported versions for the following platforms and tools The following platforms and tools are no longer supported. [edadeb0, 972c2cd, 6c66b74, 45363fc]
PA-RISC processor
LLVM 13 and below
OpenSSL 1.1.0 and below
Python 3.2 The changes in component support versions required to build PostgreSQL 18 are as follows. [a70e01d, 6c66b74]
OpenSSL 1.1.1 or higher required
Python 3.6.8 or higher required The following components are now supported in PostgreSQL 18.
Tcl 9 support added [32a2aa7]
2.6.2 MD5 Password
MD5 passwords are now deprecated. Generating an MD5 password will output a warning by default. This warning can be suppressed by setting the parameter md5_password_warnings to ‘off’. [db6a4a98]
PDF page 11
2.6.3 Configure command
The configure command has been changed as follows.
Option –disable-spin-locks
This option has been removed. [e256266]
Option –disable-atomics
This option has been removed. [8138526]
Command flex
2.6.4 Initdb command
The data checksum feature is enabled by default. To disable checksums, specify the –no-datachecksums option. [04bec89]
PDF page 12
2.6.5 COPY statement
The following changes have been implemented for the COPY statement.
Prohibition of the COPY FREEZE statement for external tables
The COPY FREEZE statement for external tables is now explicitly prohibited. [401a695]
CSV mode specification change
When executing the COPY statement in CSV mode and reading data from a source other than STDIN, ‘.’ is no longer considered data completion. [7702337]
PDF page 13
2.6.6 CREATE OPERATOR CLASS statement
The RECHECK clause in the CREATE OPERATOR CLASS and ALTER OPERATOR FAMILY statements is no longer accepted. The RECHECK clause in these statements was valid prior to PostgreSQL 8.4 and did not cause an error if specified until PostgreSQL 17. [7da1bdc]
PDF page 14
2.6.7 CREATE SUBSCRIPTION statement
The default value of the ‘streaming’ option when creating SUBSCRIPTION has been changed from ‘off’ to ‘parallel’. [1bf1140]
2.6.8 CREATE TABLE statement
Partition tables can no longer be created as UNLOGGED tables. Partitions can be created as UNLOGGED tables. [e2bab2d]
2.6.9 EXPLAIN statement
The BUFFERS clause is now enabled by default. [c2a4078]
PDF page 15
2.6.10 GRANT statement
The RULE privilege on objects has been removed since PostgreSQL 8.2, but the GRANT statement did not raise an error. The RULE privilege has been completely removed from this version. [fefa76f]
PDF page 16
2.6.11 Psql
The output format of the \conninfo metacommand has been changed. [bba2fbc]
2.6.12 Pg_backend_memory_contexts view
The starting number of the level column in the pg_backend_memory_contexts view has been changed from zero to one. The same change has been implemented for the output of the pg_log_backend_memory_contexts function. [d9e0386]
PDF page 17
PDF page 18
3 Architecture
PDF page 18
Describes the improved architecture and features in PostgreSQL 18.
3.1.1 Modified System catalogs
The following catalogs and views have been changed. [12227a1, 32d3ed8, f0d1127, 559efce, 17cc5f6, 7054186, e7a9496, 02a8d0c, a0f1fce, ca87c41, f92c854, 30a6ed0, 75eb976, a051e71, 83ea6c5, bb8dff9, ac0e331, 2421e9a, 99f8f3f, 60f566b, 89f908a, 73eba50, 8cc139b, 0d6c477]
| View name | Description |
|---|---|
| pg_aios | The pg_aios view lists all asynchronous I/O handles. |
| pg_shmem_allocations_numa | Shows how shared memory allocations in the server’s main shared memory segment are distributed across NUMA nodes. |
| View name | Add column | Data type | Description |
|---|---|---|---|
| pg_backend_memory_contexts | type | text | Context type |
| path | integer[] | Array showing context hierarchy | |
| pg_class | relallfrozen | integer | Number of pages marked as all frozen |
| pg_constraint | conenforced | boolean | Is the constraint specified as ENFORCED? |
| conperiod | boolean | Specify WITHOUT OVERLAPS or PERIOD | |
| pg_publication | pubgencols | char | Replicate the values of the generated columns? |
| pg_replication_slots | two_phase_at | pg_lsn | Address from which the decoding of prepared transactions is enabled |
| pg_stat_{all|user|sys}_tables | total_vacuum_ti | double | Total time for VACUUM execution |
| me | precision | ||
| total_autovacuu | double | Total time for automatic VACUUM | |
| m_time | precision | execution | |
| total_analyze_ti | double | Total time of ANALYZE execution | |
| me | precision | ||
| total_autoanalyze | double | Total time for automatic ANALYZE | |
| _time | precision | execution | |
| pg_stat_checkpointer | num_done | bigint | Number of checkpoints completed |
| slru_written | bigint | Number of SLRU buffers written during checkpoint | |
| pg_stat_database | parallel_workers_to_launch | bigint | Number of parallel workers attempted to be activated |
| parallel_workerslaunched_ | bigint | Number of parallel workers activated | |
| pg_stat_io | read_bytes | numeric | Number of bytes read |
| write_bytes | numeric | Number of bytes write | |
| extend_bytes | numeric | Number of extended bytes | |
| pg_stat_progress_analyze | delay_time | double precision | Sleep time due to cost-based delay |
| pg_stat_progress_vacuum | delay_time | double precision | Sleep time due to cost-based delay |
| pg_stat_subscription_stats | confl_update_origin_differs | bigint | Number of tuples modified by other sources during execution of the UPDATE statement |
| confl_update_exists | bigint | Number of tuples that violated the unique constraint during execution of the UPDATE statement | |
| confl_update_missing | bigint | Number of tuples not found to be changed during execution of the UPDATE statement | |
| confl_delete_origin_differs | bigint | Number of tuples modified by other sources during execution of the DELETE statement | |
| confl_delete_missing | bigint | Number of tuples not found for deletion during execution of the DELETE statement | |
| confl_multiple_unique_conflicts | bigint | Number of tuples that violated the unique constraint when executing a multi-tuple INSERT statement | |
| confl_insert_exists | bigint | Number of tuples that violated the unique constraint when the INSERT statement was executed |
PDF page 19
PDF page 20
| View name | Remove column | Description |
|---|---|---|
| pg_backend_memory_contexts | parent | Due to the addition of the PATH column, it is no longer needed. |
| pg_attribute | attcacheoff | No longer needed due to changes in cache structure |
| pg_stat_wal | wal_write | For integration into pg_stat_io view |
| wal_sync | For integration into pg_stat_io view | |
| wal_write_time | For integration into pg_stat_io view | |
| wal_sync_time | For integration into pg_stat_io view | |
| pg_stat_io | op_bytes | Because it was a fixed value |
| View name | Column name | Description |
|---|---|---|
| table_constraints | enforced | Outputs YES or NO depending on column setting (previously only YES) |
| View name | Description |
|---|---|
| pg_aggregate | Includes max/min functions for user-defined types |
| pg_attribute | Outputs ‘v’ indicating virtual column in attgenerated column |
| pg_class | Outputs information on TOAST table in pg_index catalog |
| pg_constraint | Includes information on NOT NULL constraints for columns |
| pg_default_acl | L (Large Object) output in defaclobjtype column |
| pg_proc | Includes max/min functions for user-defined types |
| pg_replication_slots | Outputs idle_timeout in invalidation_reason column |
| pg_stat_io | WAL information added |
PDF page 21
Pg_aios view
The pg_aios view outputs the status of the currently used asynchronous I/O handle. [60f566b]
| Column name | Data type | Description |
|---|---|---|
| pid | integer | Server process ID performing I/O |
| io_id | integer | I/O handle ID |
| io_generation | bigint | I/O handle generation |
| state | text | I/O handle status |
| operation | text | I/O handle operations |
| off | bigint | I/O operation offset |
| length | bigint | I/O operation length |
| target | text | I/O execution target |
| handle_data_len | smallint | I/O operation data length |
| raw_result | integer | Low-level I/O results |
| result | text | High-level I/O results |
| target_desc | text | I/O target description |
| f_sync | boolean | I/O execution flags |
| f_localmem | boolean | Local memory flag |
| f_buffered | boolean | Flag indicating buffer I/O |
Pg_shmem_allocations_numa view
This view shows how shared memory segments are distributed among NUMA nodes. [8cc139b]
| Column name | Data type | Description |
|---|---|---|
| name | text | Memory area name |
| numa_node | integer | NUMA node number |
| size | bigint | Memory size |
PDF page 22
NOT NULL constraint
NOT NULL constraints on a table columns are now included in the pg_constraint catalog. The constraint name is automatically generated from the table and column names. The value of the contype column of the NOT NULL constraint is specified as ’n’. [14e87ff]
PDF page 23
Pg_stat_{all|user|sys}_tables view
VACUUM and ANALYZE execution times have been added to the pg_stat_{all|user|sys}_tables view. The manually executed and automatically executed cases are cumulated, respectively. [30a6ed0]
3.1.2 Logical Replication Enhancements
The following new features have been implemented for logical replication
Log output when conflicts occur
Information about conflicts that occur when updating against the standby database are now output to the log. The reason for the conflict is output in the format “conflict={reason}”. The parameter track_commit_timestamp must be set to ‘on’ on the subscriber side (default value ‘off’) to detect the conflict reasons update_differ and delete_differ. [9758174, 73eba50]
PDF page 24
| Output text | Description (DETAIL log) | Replication |
|---|---|---|
| insert_exists | INSERT statement was executed but a tuple with the same key already exists (Key already exists in unique index) | Stop |
| update_differ | UPDATE statement target tuple was updated by another origin (Updating the row that was modified locally) | Continue |
| update_exists | UPDATE statement was executed but a tuple with the same key exists (Key already exists in unique index) | Stop |
| update_missing | UPDATE statement was executed but the target tuple does not exist (Could not find the row to be updated) | Continue |
| delete_differ | DELETE statement was executed but the target tuple was updated by another origin (Updating the row that was modified locally) | Continue |
| delete_missing | DELETE statement executed but target tuple does not exist (Could not find the row to be deleted) | Continue |
| multiple_unique_conflicts | Multiple tuples violate unique constraints (Key already exists in unique index) | Stop |
PDF page 25
Propagation of Generated Columns
The option PUBLISH_GENERATED_COLUMNS has been added to the CREATE PUBLICATION statement to determine whether the values of generated columns (GENERATED ALWAYS AS STORED specified columns) are to be replicated. The default value for this option is ‘none’, which means that the values of the generated columns will not be propagated. To propagate generated columns, specify ‘stored’ for this option. The value of the specified option is stored in the pubgencols_type column of the pg_publication catalog. [7054186, 745217a, 7054186, e65dbc9, 117f9f3]
PDF page 26
3.1.3 Optimizer Statistics Management
Functions to set and clear optimizer statistics for tables and columns are now provided. Options have been added to the pg_dump, pg_dumpall, and pg_upgrade commands to use this function to migrate statistics. See “3.4 Utilities” for additional command options.
Pg_restore_relation_stats function
The pg_restore_relation_stats function sets the optimizer statistics for a table. It returns false in case of minor errors. [d32d146]
Syntax 1 - Pg_restore_relatoin_stats function
Pg_clear_relation_stats function
The function pg_clear_relation_stats clears the optimizer statistics for the specified table. Executing this function resets the corresponding column in the pg_class catalog. [e839c8e, 650ab8a]
Syntax 2 - Pg_clear_relation_stats function
PDF page 27
Pg_restore_attribute_stats function
The function pg_restore_attribute_stats sets the column optimizer statistics. It returns false in case of minor errors. [d32d146]
Syntax 3 - Pg_restore_attribute_stats function
PDF page 28
Pg_clear_attribute_stats function
The function pg_clear_attribute_stats clears the optimizer statistics for the specified column. Executing this function resets the corresponding column in the pg_stats catalog. [ce207d2, 650ab8a]
Syntax 4 - Pg_clear_attribute_stats function
3.1.4 Roles and Permissions
The role pg_signal_autovacuum_worker has been added as a predefined role. This role allows signaling to the Autovacuum worker process. [ccd3802]
3.1.5 I/O Processing
PostgreSQL 18 adds large enhancements to the Storage I/O.
Streaming I/O coverage enhancement
Streaming I/O, introduced in PostgreSQL 17, is now more widely applicable. Streaming I/O is used in the following cases
VACUUM statement for a table [9256822, c3e775e, 9256822, c3e775e]
CREATE DATABASE STRATEGY=WAL_LOG statement [8720a15]
VACUUM for B-Tree index [c5c239e]
VACUUM for GiST index [69273b8]
VACUUM for SP-GiST index [e215166]
Amcheck module [043799f]
Autoprewarm module [d9c7911]
PDF page 29
Providing Asynchronous I/O
The infrastructure for using asynchronous I/O is now in place. The parameter io_method has been added to specify the method used for asynchronous I/O. The default value of this parameter is ‘worker’, which performs asynchronous I/O by an I/O worker process; the number of I/O worker processes started is determined by the parameter io_workers (default value 3). If using Linux’s io_uring, specify io_uring for this parameter. [da72269, 55b454d, 247ce06, c325a76]
| Value | Description | Note |
|---|---|---|
| worker | Asynchronous I/O is executed by the io worker process. | Default |
| sync | Synchronous I/O is executed. This is the same behavior as in the previous version. | |
| io_uring | Use io_uring for asynchronous I/O. |
Prefetch support
Prefetching is now possible with PostgreSQL running on macOS. [6654bb9]
3.1.6 Locale Provider
The locale PG_UNICODE_FAST has been added to the builtin locale provider. This locale uses code point sort order and conforms to Unicode’s full case mapping. However, conversions may cause changes in the number of characters, such as “ß” being lowercased to “ss”. [d3d0983, 286a365]
PDF page 30
3.1.7 OAUTH SASL
OAUTHBearer/SASL can now be used for database user authentication. To use OAUTHBearer/SASL authentication, specify ‘oauth’ in the pg_hba.conf authentication method. To use this authentication, the client module uses the libcurl library, so a binary with –with-libcurl to the ‘configure’ command is required. The parameter oauth_validator_libraries specifies the validator libraries. If this parameter is not specified, authentication by the oauth authentication method will be failed. [b3f0be7]
3.1.8 Faster hash joins
Deform processing during hash join execution has been optimized. [adf97c1]
PDF page 31
3.1.9 Libpq
The following APIs have been added and enhanced.
Connection string
The minimum / maximum protocol version and SSL connection log file name have been added to the connection string. Corresponding environment variables have also been added. [285613c, 2da74d8]
| Connect string | Environment variables | Description |
|---|---|---|
| max_protocol_version | PGMAXPROTOCOLVERSION | Maximum version |
| min_protocol_version | PGMINPROTOCOLVERSION | Minimum version |
| sslkeylogfile | - | SSL key log file |
PDF page 32
Other API
| API Name | Description |
|---|---|
| PQfullProtocolVersion | Return protocol version including minor version |
3.1.10 Access Method
The following enhancements have been added to the index access methods. [56fead4, af4002b, ce62f2f, af4002b]
| Element name | Description |
|---|---|
| amgettreeheight | Calculates the height of the index tree |
| amconsistentequality | Consistent equivalence semantics. Split old version of amcancrosscompare. Has consistent ordering semantics. Split out old version of amcancrosscompare. |
| amcanhash | Support hashing |
3.1.11 NUMA
The basic NUMA environment-aware API, SQL functions and pg_shmem_allocations_numa view have been added. The –with-libnuma option to the ‘configure’ command is required to enable this feature. [65c298f, 8cc139b]
| API names | Description |
|---|---|
| pg_numa_init | Initialize NUMA environment |
| pg_numa_get_max_node | Get maximum number of nodes |
| pg_numa_query_pages | Identify NUMA nodes in individual memory pages |
PDF page 33
3.1.12 Accelerated numerical calculations
Acceleration of the following basic calculations and CRC32C functions are implemented.
3.1.13 Scope of Use of Unique Key Constraints
Previously, only B-Tree indexes could be used for foreign keys, materialized views, and partition keys, but now other index access methods can be used to create indexes as long as they are unique. [bfe21b7, 9d6db8b, f278e1f]
3.1.14 Hook
The following hooks for the EXPLAIN statement have been added. [fd02bf7, 50ba65e]
Hook explore_per_plan_hook for EXPLAIN statement
Hook explain_per_node_hook for per-node execution
Hook for option validation, explore_validate_options_hook
4 SQL Statements
PDF page 34
This section explains new features related to SQL statements.
3.2.1 ALTER DEFAULT PRIVILEGE
Default permissions can now be set for large objects. The defaclobjtype column in the pg_default_acl catalog will output the L indicating a large object. [0d6c477]
3.2.2 ALTER SUBSCRIPTION
The two_phase option can now be altered in the ALTER SUBSCRIPTION statement; the SUBSCRIPTION object must be disabled once in order to alter the two_phase option. [1462aad]
PDF page 35
3.2.3 ALTER TABLE
The following syntax has been added to the ALTER TABLE statement.
ALTER TABLE ALTER CONSTRAINT
The SET INHERIT clause (or SET NO INHERIT clause) can be specified in the ALTER CONSTRAINT clause. [f4e53e1]
ALTER TABLE NOT NULL NOT VALID
The NOT VALID clause can be specified for NOT NULL constraints in an ALTER TABLE statement. [a379061]
PDF page 36
ALTER TABLE ONLY DROP CONSTRAINT
ALTER TABLE DROP CONSTRAINT statements with ONLY clause for partitioned tables can now be executed. In previous versions, this would have resulted in an error. [4dea33c]
3.2.4 ANALYZE
The following new features have been implemented for the ANALYZE statement.
ONLY clause
In previous versions, executing an ANALYZE statement on a partition table would recursively collect statistics for the partition. By specifying the ONLY clause, statistics can be collected only for partition tables. [62ddf7e]
PDF page 37
Output of I/O statistics and WAL statistics
The output of the ANALYZE VERBOSE statement now includes I/O and WAL statistics. The I/O statistics output is similar to the logs for the parameter log_autovacuum_min_duration setting. [4c1b4cd, bb77752]
Output of delay time
If the parameter track_cost_delay_timing is set to ‘on’, the ANALYZE VERBOSE statement will now output “delay time”. The same information is also output in the log of automatic VACUUM. [7720082]
PDF page 38
Output of WAL buffer full
The WAL buffer full count is now output when the ANALYZE VERBOSE statement is executed. [6a8a7ce]
3.2.5 COPY
The following features have been added to the COPY statement
COPY TO statement from a materialized view
The COPY TO statement can now specify the materialized view. [534874f]
Addition of the reject_limit option
The COPY FROM statement now has a reject_limit option. This option allows the maximum number of errors to be specified when errors are ignored (on_error=ignore). If the number of errors exceeds the specified value, the COPY statement will fail. [4ac2a9b, a39297e]
PDF page 39
Added value for log_verbosity option
The log_verbosity option can now be ‘silent’ in the COPY statement. Specifying this value suppresses log output. [e7834a1
3.2.6 CREATE FOREIGN TABLE
The LIKE clause now allows copying column definitions from other tables (or foreign tables). [302cf157]
PDF page 40
| Clause | CREATE TABLE statement | CREATE FOREIGN TABLE statement |
|---|---|---|
| COMMENTS | Yes | Yes |
| COMPRESSION | Yes | No |
| CONSTRAINTS | Yes | Yes |
| DEFAULTS | Yes | Yes |
| GENERATED | Yes | Yes |
| IDENTITY | Yes | No |
| INDEXES | Yes | No |
| STATISTICS | Yes | Yes |
| STORAGE | Yes | No |
| ALL | Yes | Yes |
3.2.7 CREATE INDEX
Creation of GIN indexes is now processed in parallel with B-Tree and BRIN indexes. [8492feb] 8492feb
3.2.8 CREATE TABLE
The following enhancements have been implemented for the CREATE TABLE statement
WITHOUT OVERLAPS clause
It is now possible to specify a WITHOUT OVERLAPS clause that does not allow duplicate ranges for primary key constraints (PRIMARY KEY), unique constraints (UNIQUE) and foreign key constraints (FOREIGN KEY). At least two columns are required when specifying this clause for a primary key constraint. It can also be specified when adding a primary key in an ALTER TABLE statement. The column CONPERIOD has been added to the pg_constraint catalog to represent the
Syntax 5 - PRIMARY KEY clause
PDF page 41
ENFORCED clause
Allows the ENFORCED or NOT ENFORCED clause to be specified for CHECK constraints and foreign key constraints. If nothing is specified or the ENFORCED clause is specified, PostgreSQL will behave as before, with CHECK constraints operating at the appropriate time. If the NOT ENFORCED clause is specified, the CHECK constraint will not work. The column CONFORCED has been added to the pg_constraint catalog to indicate this specification. [ca87c41, eec0040]
PDF page 42
NOT VALID clause
Allows the NOT VALID clause to be specified as a foreign key for partition tables. [b663b94]
PDF page 43
GENERATED ALWAYS VIRTUAL clause
Allows the creation of auto-generated columns that do not hold the data. Specify a GENERATED ALWAYS VIRTUAL clause in the column definition. Previously, only GENERATED ALWAYS STORED clauses that retained actual data were supported. The VIRTUAL clause can be confirmed by the output of ‘v’ in the attgenerated column of the pg_attribute column. Indexes cannot be created on generated columns with VIRTUAL clause specified. [83ea6c5]
PDF page 44
3.2.9 EXPLAIN
The following features have been added to the EXPLAIN statement.
Disabled Nodes Output
The output of the EXPLAIN statement now includes information on the number of disabled nodes (Disabled Nodes:). For example, disabling some execution plans by setting the parameter enable_seqscan to ‘false’, which was previously handled by increasing the cost, is now clearly recognized as a disabled node in PostgreSQL 18. [e222534, c01743a, 161320b]
PDF page 45
Storage Clause Output
Temporary storage information used during Window Aggregation and CTE Scan runs is now output as a Storage clause. [95d6e9a, 40708ac]
PDF page 46
Parallel Bitmap Heap Scan Statistics
Statistics for Parallel Bitmap Heap Scan execution are now output for each worker node. [5a1e6df]
PDF page 47
Record Count Output Format
Record counts (actual rows) are now output to two decimal places. [ddb17e3, 95dbd827]
PDF page 48
Index Searches
The “Index Searches” item indicating the number of index searches is now output. [0fbceae]
Window Function Output
The “Window:” clause is now output in the execution plan when using Window functions. [8b1b342]
PDF page 49
3.2.10 INSERT / UPDATE / DELETE / MERGE
The RETURNING clause of the update DML statement can now specify an OLD clause for preupdate information and a NEW clause for post-update information. The pre-update data (OLD) in the INSERT statement and the post-update data (NEW) in the DELETE statement will be NULL. [80feb72]
Syntax 6 - RETURNING Clause
3.2.11 VACUUM
The following new features have been added to the VACUUM statement.
ONLY clause
ONLY clause can now be specified for partitioned tables. No VACUUM processing is performed. [62ddf7e]
PDF page 50
VERBOSE / Log output
When ‘on’ is specified for the parameter track_cost_delay_timing, ‘delay time’ is now output in the ANALYZE VERBOSE statement. The same information is also output to the log of automatic VACUUM. [7720082]
Output WAL buffer full
The WAL buffer full count is now output when the VACUUM VERBOSE statement is executed. [6a8a7ce]
PDF page 51
Release of end-of-table free block
The parameter vacuum_truncate has been added. This parameter determines the behavior when the
[0164a0f]
3.2.12 Data Types
The following enhancements have been implemented for PostgreSQL 18 data types.
PDF page 52
Bytea and integer type casts
Bytea and integer type (int2, int4, int8) data can now be cast to each other. [6da469b]
3.2.13 Functions
The following functions have been added/enhanced.
Array_reverse function
The function array_reverse has been added, which returns an array with the first dimension of the array inverted. [49d6c7d]
Syntax 7 - Array_reverse function
PDF page 53
Casefold function
The casefold function is almost identical to the lower function, but it performs lower case conversion according to collation. Its main purpose is to facilitate case-insensitive string comparisons. It can only be used when the database encoding is UTF-8. Some characters may change the character length. If the locale PG_UNICODE_FAST is used, ß (U+00DF) will be converted to ‘ss’. [bfc5992]
Crc32 function
The functions crc32 to calculate CRC-32 and crc32c to calculate CRC-32C have been added. [760162f]
PDF page 54
Syntax 8 - Crc32 / Crc32c functions
Extract function
The WEEK clause can now be specified for INTERVAL types. [6be39d7]
Gamma / lgamma function
The functions gamma and lgamma have been added to calculate gamma and log gamma values. [a3b6dfd]
Syntax 9 - Gamma / Lgamma functions
PDF page 55
Has_largeobject_privilege function
The has_largeobject_privilege function has been added to check for the existence of privileges on large objects. [4eada20]
Syntax 10 - Has_largeobject_privilege function
Json[b]_strip_nulls function
The json[b]_strip_nulls function now has a parameter strip_in_arrays to remove NULL values from an array. The default value is FALSE. [4603903]
Syntax 11 - Json_strip_nulls / Jsonb_strip_nulls functions
PDF page 56
Max / min function
Max and min functions can now be used for values of type bytea. [2d24fd9]
Syntax 12 - Max / min functions
Reverse function
The version corresponding to bytea type has been added. [0697b23]
Syntax 13 - Reverse function
PDF page 57
Pg_get_acl function
The function pg_get_acl has been added to retrieve the ACL settings of a database object. [4564f1c, d898665]
Syntax 14 - Pg_get_acl function
Pg_get_sequence_data function
The function pg_get_sequence_data, which returns a tuple of sequences, has been added. This function returns a NULL value if a sequence with no SELECT privilege is specified. This function is intended primarily for use in optimizing pg_dump commands. [c8b06bb, bd15b7d, a83a944]
PDF page 58
Syntax 15 - Pg_get_sequence_data function
Pg_ls_summariesdir function
The function pg_ls_summariesdir has been added to PostgreSQL 18. This function provides a list of WAL summary files. The function can be executed by a user with the SUPERUSER attribute or a user authorized by the pg_maintain role. If the WAL summarize feature is disabled, no records are returned. [4e1fad3]
Syntax 16 - Pg_ls_summariesdir function
| Column name | Data type | Description |
|---|---|---|
| name | text | WAL Summary File Name |
| size | bigint | Bytes in file |
| modification | timestamp with time zone | Last Modified |
PDF page 59
Pg_stat_get_backend_wal function
The function pg_stat_get_backend_wal has been added to retrieve WAL output information for a specified backend process. The result of executing this function is similar to the pg_stat_wal view, but on a per-backend-process basis. [76def4c]
Syntax 17 - Pg_stats_get_backend_wal function
| Column name | Data type | Description |
|---|---|---|
| wal_records | bigint | Number of WAL records |
| wal_fpi | bigint | Number of WAL full page images |
| wal_bytes | numeric | Number of WAL bytes |
| wal_buffers_full | bigint | Number of storage outputs due to WAL buffer full |
| stats_reset | timestamp with time zone | Data reset time |
PDF page 60
Regular Expression Function
Argument names have been added to the regular expression function (regexp*). [580f872]
To_number function and to_char function
The to_number function and to_char function now accept an RN indicating a Roman numeral as the format specification character. The case of the input string and the format specification character is ignored. [172e6b3]
Uuidv7/uuidv4 functions
Uuidv7 function supporting UUID v7 and uuidv4 function supporting UUID v4 are added. uuidv7 is expected to suppress randomization of index storage pages by specifying the timestamp of function execution in the first part of uuidv7. The uuidv7 function is expected to suppress randomization of index storage pages by specifying a timestamp at the beginning of the function. [78c5e14]
Syntax 18 - UUIDv4 / UUIDv7 function
PDF page 61
3.2.14 PL/pgSQL
The operator “=>” can now be used to specify parameters for named cursors. Previously, the operator “:=” was used. [246dedc]
PDF page 62
3.2.15 Optimizer
Faster execution plans are now selected.
ANY conversion of OR conditions
OR conditions for indexed columns are now automatically converted to ANY clauses. [d4378c0, ae45691]
ANY Conversion of Join OR Conditions
When an OR is used in a join condition, it can now be converted to an ANY clause. [627d634]
PDF page 63
PDF page 64
IN (VALUES) Clause Converted to ANY Clause
The WHERE clause with IN (VALUES) is converted to an ANY clause. [c0962a1]
Right Semi Join
Right Semi Join is now available as the execution plan. It may be adopted for hash joins or merge joins. [aa86129e]
PDF page 65
UNIQUE Constraints and GROUP BY
When a column specified by a NOT NULL constraint and a UNIQUE index is included in a GROUP BY clause, non-target columns are now excluded from GROUP BY. The following example shows a col1 column with UNIQUE and NOT NULL constraints specified. [bd10ec5]
PDF page 66
Optimization of the DISTINCT clause
Since the order of columns specified in the DISTINCT clause is not meaningful, optimization has been implemented to reorder them as needed. A new parameter, enable_distinct_reordering, has been added to change this behavior. The default value of this parameter is ‘on’, which causes the optimization to occur; to revert to PostgreSQL 17 behavior, set this parameter to ‘off’. In the example below, column col1 is modified in the execution plan because it is a primary key, and the processing of column col2 is disabled. [a8ccf4e]
PDF page 67
Self-join optimization
The optimization of replacing self-join operations with unjoin scans when the execution result is unaffected has been implemented. This behavior is controlled by the parameter enable_self_join_elimination. The default value is ‘on’ and the optimization is executed. In the following example, column col1 of table data1 is the primary key. [fc069a3]
PDF page 68
Index Skip Scan
For an index consisting of multiple columns, if a match condition other than the first column is specified, the execution plan that uses the corresponding index is now created. In the following example, a composite index is created for columns col3 and col2, in that order.
Transformation of HAVING clauses into WHERE clauses
The optimization of transforming some HAVING clauses used in GROUPING SETS clauses into WHERE clauses has been implemented. [67a54b9]
PDF page 69
5 Configuration Parameters
PDF page 70
In PostgreSQL 18, the following parameters have been changed.
3.3.1 Added parameters
The following parameters have been added. [0dcaea5, db6a4a9, c758119, a8ccf4e, 306dc52, 052026c, bb8dff9, 45188c2, 3d1ef3a, fc069a3, ac0e331, b3f0be7, 6c349d8, 6d376c3, 0284401, 4f7f7b0, 10f6646, 0164a0f, 247ce06, 55b454d, 62d712e, 9fbd53d, f78ca6f, 73bdcfa, 05dedf4]
| Parameter name | Description (context) | Default value |
|---|---|---|
| autovacuum_worker_slots | Maximum number of autovacuum max workers settings__ (postmaster) | 16 |
| autovacuum_vacuum_max_threshold | Maximum number of tuples required to trigger VACUUM on a table (sighup) | 100000000 |
| enable_distinct_reordering | Whether to use column reordering optimization specified in the DISTINCT clause (user) | on |
| enable_self_join_elimination | Enable self-join optimization feature (user) | on |
| extension_control_path | Extended control file path (superuser) | $system |
| file_copy_method | Specify how files are copied (user) | copy |
| idle_replication_slot_timeout | Number of idle seconds to disable replication slots (sighup) | 0 |
| io_max_combine_limit | Maximum value for io_combine_limit (postmaster) | 16 |
| io_max_concurrency | Maximum number of simultaneous I/Os a single process can perform (postmaster) | 64 |
| io_method | Asynchronous I/O execution method (postmaster) | worker |
| io_workers | Number of IO worker processes (sighup) | 3 |
| log_lock_failures | (sighup) Log output when lock fails (superuser) | off |
| max_active_replication_origins | Maximum number of replication origins | 10 |
| Maximum number of replication origins | 10 | |
| md5_password_warnings | Output warning when generating MD5 passwords (user) | on |
| num_os_semaphores | Number of semaphores required to run the server (internal) | 計算値 |
| oauth_validator_libraries | Library used to validate OAuth connection tokens (sighup) | '' |
| ssl_groups | Curve name used for EDCH key exchange | X25519:prime2 |
| (sighup) | 56v1 | |
| ssl_tls13_ciphers | List of cipher suites that can be used for connections with TLS version 1.3 (sighup) | '' |
| track_cost_delay_timing | Cost-based VACUUM delay tracking (superuser) | off |
| vacuum_max_eager_freeze_failure_rate | Percentage of pages where VACUUM disables EAGER scans (user) | 0.03 |
| vacuum_truncate | Enables vacuum to truncate empty pages at the end of the table (user) | on |
PDF page 71
Maximum number of autovacuum worker processes
The autovacuum_max_workers parameter can now be changed dynamically by executing the pg_reload_conf function. The parameter autovacuum_worker_slots (default 16) has been added to indicate the upper limit for dynamic changes. autovacuum_max_workers parameter setting can be larger than autovacuum_worker_slots, but the autovacuum_max_workers parameter setting will not be changed. but it will not launch more worker processes than autovacuum_worker_slots. [c758119, 6d01541]
PDF page 72
3.3.2 Modified Parameters
The following parameters have been changed in terms of setting range and choices. [d0c2860, e48b19c, 7c3fb50, c758119, d4c3a6b, 9219093, 3516ea7]
| Parameter name | Change |
|---|---|
| autovacuum_max_workers | Changed to dynamically updatable (context=sighup) |
| log_rotation_size | Upper limit changed to 2,147,483,647 |
| log_connections | Changed to string type from boolean type |
| log_line_prefix | Escape %L indicating local IP address can be used |
| max_files_per_process | Exclude the number of files inherited by the backend |
| ssl_groups | Changed name from ssl_ecdh_curve |
Parameter log_connections is changed
The parameter log_connections has been changed from a boolean type to a text type, allowing multiple settings of log output to be comma-separated. [9219093, 18cd15e]
| Setting value | Output contents |
|---|---|
| '' | No logging (default value) |
| receipt | Log when a connection is received |
| authentication | Log the ID that identifies the user |
| authorization | Log the completion of authentication |
| setup_durations | Log the time between when the connection is made and when the first query is ready to be executed |
| all | Same as receipt,authentication,authorization,setup_durations |
PDF page 73
3.3.3 Parameters with default values changed
The following parameters have changed default values. [98f320e, 9219093, ff79b5b, cc6be07, daa02c6]
PDF page 74
| Parameter name | PostgreSQL 17 | PostgreSQL 18 | Note |
|---|---|---|---|
| server_version | 17.5 | 18.0 | |
| server_version_numdata_checksums | 170005 | 180000 | |
| off | on | ||
| log_connections | off | '' | |
| effective_io_concurrency | 1 | 16 | |
| maintenance_io_concurrencyssl_groups | 10 | 16 | |
| prime256v1 | X25519:prime256v1 Parameter | X25519:prime256v1 Parameter name change |
6 Utilities
PDF page 75
Describes the major enhancements of utility commands.
3.4.1 Configure
The following new features have been added to the configure command.
Adding the –with-liburing option
The option –with-liburing has been added to use io_uring for asynchronous I/O on Linux. Enabling this option allows specifying io_uring for the parameter io_method. [c325a76]
Addition of –with-libcurl option
The option –with-libcurl option has been added for OAUTHBeare/SASL functionality. [b3f0be7]
Addition of –with-libnuma option
The option –with-libnuma has been added to detect NUMA environments. [65c298f]
3.4.2 Initdb
The following options have been added to the initdb command.
Option –no-data-checksums
Generation of page checksums is now enabled by default in the initdb command. With this specification, the option –no-data-checksums, which does not generate page checksums, has been added. If used at the same time as the –data-checksums option, which generates checksums, the option specified later will take effect. [983a588]
PDF page 76
Option –no-sync-data-files
Added new option –no-sync-data-files. This option skips synchronization of directories and files in the database cluster. Unless the –no-sync option is specified, directories such as pg_wal and pg_xact will be written synchronously as in the previous version. [cf131fa]
3.4.3 Pg_combinebackup
The option –link (short form -k) has been added. This option composites backup data using hard links instead of file copies. [99aeb84]
3.4.4 Pg_createsubscriber
The following options have been added to the pg_createsubscriber command.
Option –all
The –all option (short form -a) specifies that subscriptions should be created for all databases on the publisher’s side to which it connects. [fb2ea12]
PDF page 77
Option –enable-two-phase
The option –enable-two_phase has been added to enable the two_phase option for the subscriptions being created (short form -T). [e117cfb]
Option –clean
The –clean option specifies the type of object to be removed from the subscriber. Currently, only ‘publications’ are supported. [e5aeed4, 60dda7b]
3.4.5 Pg_dump
The following options have been added to the pg_dump command. [9c49f0e, bde2fb7, 34eb2a8]
| Option name | Description | Note |
|---|---|---|
| –sequence-data | Output sequence data | |
| –with-statistics | Dump statistics data | |
| –no-statistics | Do not dump statistics | default |
PDF page 78
3.4.6 pg_dumpall
The following options have been added to the pg_dumpall command.
Option –sequence-data
Added –sequence-data option to dump sequence information. Sequence information is dumped by default, but when used with the –no-data option, the latest sequence values are set. [cea3fc4]
Options for optimizer statistics
Options for dumping statistics have been added. The –statistics option and -statistics-only option dump statistics, the –no-statistics option is the default behavior and does not dump statistics. [34eb2a8]
3.4.7 Pg_dump / pg_dumpall / pg_restore command
The pg_dump, pg_restore, and pg_dumpall commands now have an option to migrate statistics. The following options have been added. [1fd1bd8, cd3c451, acea3fc, 34eb2a8, 6a46089, 71ea0d6]
PDF page 79
| Option name | Description | pg_dump / pg_dumpall | pg_restore |
|---|---|---|---|
| –no-data | Contains no data | Yes | Yes |
| –no-policies | Contains no Row Level Security settings | Yes | Yes |
| –no-schema | Contains no schema | Yes | Yes |
| –no-statistics | Contains no statistics | Yes | Yes |
| –restrict-key=KEY | Restrict meta commands | Yes | Yes |
| –sequence-data | Contains sequence data | Yes | No |
| –statistics | Contains optimizer statistics data | Yes | No |
| –statistics-only | Contains only statistics | Yes | No |
PDF page 80
3.4.8 Pg_recvlogical
The following features have been implemented to the pg_recvlogical command.
Option –enable-failover
The option –enable-failover has been added. Specifying this option adds a ‘failover’ option to the replication slot. This option is specified at the same time as the –create-slot option. [cf2655a]
Option –enable-two-phase
The option name –two-phase has been changed to –enable-two-phase. The previous option remains available. [6d12d5a]
Option –drop-slot
In previous versions, the –dbname option was required when using the –drop-slot option. In PostgreSQL 18, the –dbname option is no longer required. [c68100a]
3.4.9 Pg_resetwal
The option –char-signedness has been added to the pg_resetwal command. This option changes the sign setting of the char type in the control file. This option is expected to be specified within the pg_upgrade command and is not intended to be specified manually. [30666d1]
3.4.10 Pg_rewind
The –write-recovery-conf option of pg_rewind has been extended to include the database name (dbname) in the primary_conninfo value generated when specified with the –source-server option. This change allows rewound servers to connect to the primary server without having to manually modify the configuration file when sync_replication_slots is enabled. [4ecdd41]
3.4.11 Pg_upgrade
The following new features have been added to the pg_upgrade command.
Option –set-char-signedness
The option –char-signedness has been added to the pg_upgrade command. This option changes the signedness setting of the char type in the control file. [1aab680]
PDF page 81
Statistics migration
The statistics are now migrated in the default configuration. Specify the –no-statistics option to not migrate statistics. [1fd1bd8]
Internally executed command processing
Internally executed pg_dump and pg_dumpall commands are executed with the option –no-sync. Internally executed CREATE DATABASE statement executed with STORATEGY=FILE_COPY clause. [64f34eb, 6e16b1e]
3.4.12 Pg_verifybackup
The pg_verifybackup command can now also verify backups in tar format. The format of the backup target is specified with the –format option (short form -F). When using this option, the –no-parse-wal option must also be specified at the same time. [8dfd312]
3.4.13 Psql
The following new features have been implemented in the psql command.
Option –help=variables
The xheader_width description has been added to the output destination of the command option -help=variables. [768dfd8]
PDF page 82
Prepared statement definition
The following metacommands have been added to manipulate the definition of Prepared statements [d55322b]
| Metacommand | Description | Note |
|---|---|---|
| \parse | Create a Prepared statement | |
| \bind_named | Bind a value to a parameter | |
| \close | Close a Prepared statement |
Metacommand \dP+
The name of the access method (Access method) for the partition table is now printed. [978f38c]
PDF page 83
Metacommands \df+, \do+, \dAo+, \dC+
The output of each command now includes a “Leakproof?” column indicating whether it is leakproof. [2355e51]
Pipeline
The following metacommands have been added to support the pipeline. [41625ab, 3ce3575, 17caf66]
PDF page 84
| Metacommand | Description | Note |
|---|---|---|
| \startpipeline | Start pipeline | |
| \sendpipeline | Send extended query | |
| \syncpipeline | Synchronize pipeline | |
| \endpipeling | End pipeline | |
| \flushrequest | Request flush | |
| \flush | Send unsent data | |
| \getresults | Get execution results | Allow specifying number of fetches |
The following variables are available to show the results of executing the above commands.
| Variable name | Description | Note |
|---|---|---|
| PIPELINE_SYNC_COUNT | Number of pipes synchronized | |
| PIPELINE_COMMAND_COUNT | Number of commands piped | |
| PIPELINE_RESULT_COUNT | Number of results executed |
PDF page 85
Output in extended table format mode
By specifying x for some metacommands, the execution results are output in extended table format mode. In addition to the \d* metacommand, it can also be specified with \l, \z, or \lo. [00f4c29]
PDF page 86
Variable SERVICE
The variable SERVICE is now available to indicate the name of the service used for the connection. Specify %s to include the service name in the prompt string. [477728b]
Title by object type
The titles of object list metacommands such as \dt and \di now change according to object type. In the previous version, they were all “List of relations”. [a14707d]
PDF page 87
Metacommand \dx
The output of the \dx metacommand now includes the “Default version” entry for the extension. [d696406]
PDF page 88
Metacommand \conninfo
The output of the conninfo metacommand has been substantially changed. [bba2fbc, be37ac2, 6d64800]
3.4.14 Vacuumdb
The vacuumdb command now has a –missing-stats-only option to analyze only columns and indexes with missing object statistics. This option must be specified in conjunction with the –analyze-only or –analyze-in-stages option. [edba754]
PDF page 89
7 Contrib Modules
PDF page 90
Describes new features related to the Contrib modules.
3.5.1 Amcheck
The function gin_index_check, which checks the GIN index, has been added. [14ffaec]
3.5.2 Bloom
Bloom index usage is now stored in the pg_stat_*_index view. [93063e2]
PDF page 91
3.5.3 Dblink
The option use_scram_passthrough has been added to the foreign data wrapper dblink_fdw to pass through SCRAM authentication. [3642df2]
PDF page 92
3.5.4 File_fdw
The following options have been added. These options can have the same values as the options in the COPY statement. [a1c4c8a, 6c8f670]
| Option name | Description |
|---|---|
| on_error | Determines the action to be taken when a minor error occurs. The possible values are as follows • default: Stop execution (default value) • ignore: Continue execution of the process |
| log_verbosity | This parameter determines the level of log output. The following values can be specified • default: Output the number of errors (default value) • verbose: Output more detailed logs • silent: No log output |
| reject_limit | Specifies the number of data type conversion error records to allow, with the on_error=ignore option |
PDF page 93
PDF page 94
3.5.5 Injection_points
The following new features have been added to the injection_points module
Additional custom parameter
The parameter injection_points.stats has been added. This parameter determines whether cumulative statistics are enabled in the module. By default, statistics are disabled (off). [2e35c67]
Add callbacks
The callback to initialize the shared memory of the module specified in the shared_preload_libraries parameter has been added. [b2b023a]
3.5.6 Isn
The isn.weak parameter has been added to the isn module. Previous versions used the isn_weak function, which has been retained for compatibility but is now set to VOLATILE. [4489044]
3.5.7 Passwordcheck
The parameter passwordcheck.min_password_length, which indicates the minimum password length, has been added to the passwordcheck module. The default value for this parameter is 8. [f7e1b38]
PDF page 95
3.5.8 Pgcrypto
The following enhancements have been added to the pgcrypto module
Addition of the fips_mode function
The fips_mode function has been added to indicate whether OpenSSL has FIPS enabled. [924d89a]
Syntax 19 - Fips_mode function
Control of built-in crypto functions
When OpenSSL is used in FIPS mode, cryptographic implementations that are not FIPS certified should not be used. The parameter pgcrypto.built-in_crypto_enabled has been added to disable builtin functions for this purpose. Only SUPERUSER can change this parameter. [035f99c]
CFB Mode Added to AES Encryption Functions
CFB (Cipher-FeedBack mode) has been added to the AES encryption mode. [9ad1b3d]
PDF page 96
SHA-2-based hashing and encryption
PDF page 97
3.5.9 Pg_buffercacahe
The following new features have been added to the pg_buffercache module
Added the pg_buffercache_numa view
New view pg_buffercache_numa with the following columns has been added. [ba2a3c2]
| Column name | Data type | Description |
|---|---|---|
| bufferid | integer | Buffer ID |
| os_page_num | bigint | OS page number |
| numa_node | integer | NUMA node number |
Added functions
The following functions have been added. [dcf7e16]
PDF page 98
| Function name | Description |
|---|---|
| pg_buffercache_evict_relation | Remove specific table information from buffer cache |
| pg_buffercache_evict_all | Remove all information from buffer cache |
3.5.10 Pg_logicalinspect
The pg_logicalinspect module has been added to PostgreSQL 18. This contrib module provides functions to inspect logical decoding components. The added function specifies a snapshot file of the logical decoding. [7cdfeee]
Syntax 20 - Pg_get_logical_snapshot / Pg_get_logical_snapshot_info functions
PDF page 99
3.5.11 Pg_overexplain
The pg_overexplain module has been added to PostgreSQL 18. When loaded, this module allows the addition of the DEBUG option to the EXPLAIN statement, which can be used to debug the output of an EXPLAIN statement. [8d5ceb1, 9f0c36a]
PDF page 100
3.5.12 Pg_stat_statements
The following features have been added to the pg_stat_statements module.
Retrieving Internal SQL
The query ID can now also be calculated for internal SQL statements used for CREATE TABLE AS and DECLARE CURSOR statements. This allows the execution time of internal SQL to be retrieved in environments where the pg_stat_statements.track option is set to ‘all’. [6b652e6]
PDF page 101
SET Statements as Constants
The SET statement settings are stored as constants with parameter symbols in the pg_stat_statements table. Previously, statements with different specified values were stored separately. If the constants DEFAULT or FROM CURRENT are used, they are not subject to constant conversion. [dc68515]
PDF page 102
Additional Columns
The following columns have been added to the pg_stat_statements view. The columns added are parallel query execution information and the number of times the WAL buffer was full. [cf54a2c, ce5bcc4]
| Column name | Data type | Description |
|---|---|---|
| parallel_workers_to_launch | bigint | Number of parallel workers scheduled to execute |
| parallel_workers_launched | bigint | Number of parallel workers executed |
| wal_buffers_full | bigint | Number of times the WAL buffer has been full |
Compression of Constant Lists
When the number of IN lists in a WHERE clause is variable, previous versions allocated separate Query IDs. PostgreSQL 18 compresses the constant list and assigns a single Query ID. [62d712e, 9fbd53d] For example, execute the following SQL statement and check it in the pg_stat_statements view.
PDF page 103
3.5.13 Pgstattuple / pageinspect
Each function in the Contrib module now also supports sequences. [05036a3]
PDF page 104
3.5.14 Postgres_fdw
The following features have been added to the postgres_fdw module.
SCRAM Authentication Pass-through
The option USE_SCRAM_PASSThrough has been added to perform authentication by automatically sending SCRAM authentication information. This option can be specified as an attribute of SERVER or USER MAPPING. [761c795]
PDF page 105
Enhancements to the postgres_fdw_get_connections function
The used_in_xact and closed columns have been added to the return value of the postgres_fdw_get_connections function. Also, a check_conn parameter (default false) has been added to the function’s parameters to check for connections. [c297a47, 857df3c, 4f08ab5]
| Column name | Data type | Description |
|---|---|---|
| user_name | text | Connection mapping username (or public) |
| used_in_xact | boolean | Is a transaction in progress? |
| closed | boolean | Is the session closed? |
Function postgres_fdw_get_connections
The remote_backend_pid column (type int4), which indicates the backend process ID of the remote server, has been added to the return value of the postgres_fdw_get_connections function. [fe186bd]
PDF page 106
3.5.15 Miscellaneous
In addition to those described above, the following test extension modules have been added under the src/test/modules directory. [93bc3d7, b3f0be7, b85a9d0]
| Module name | Description |
|---|---|
| oauth_validator | OAUTHBeare/SASL Validator |
| test_aio | Asynchronous I/O Testing |
| typecache | Type cache Testing |
8 URL List
The links in this chapter are preserved from the source PDF’s URL list.
PDF page 107
9 Change History
This chapter preserves the source document’s revision history and publication credits.
PDF page 108
Change history
| Version | Date | Author | Description |
|---|---|---|---|
| 0.1 | 2025/05/06 | Noriyoshi Shinoda | Create an internal review version. Reviewers: Tomoo Takahashi Akiko Takeshima (Hewlett Packard Enterprise Japan) |
| 1.0 | 2025/05/26 | Noriyoshi Shinoda | Verification completed in PostgreSQL 18 Beta 1 environment. |
| 1.1 | 2025/9/26 | Noriyoshi Shinoda | Modified for PostgreSQL 18 GA |
| 1.1.1 | 2026/2/19 | Noriyoshi Shinoda | Corrected the description of the parameter log_connections |