3 Architecture
PDF page 14
3.1.1 Modified System catalogs
The following catalogs and views have been changed. [1e68e43, 007693f, 46ebdfe, 78806a9, 13aeaf0, 3ee2f25, b0e96f3, e64c733 ,e83d1b0, 96f0526, bc3c8db, 12915a5, 4f62250, 46a0cd4, c393308, 776621a, ddd5f4f, 030e10f, f696c0c, 012460e, 6ae701b, a11f330, 6d49c8d, 7294396, 667e65a, 74604a3, 74604a3, f1affb6]
| View name | Description |
|---|---|
| pg_wait_events | The name and description of the waiting event will be output |
| pg_stat_checkpointer | The execution statistics of checkpointer process is output |
| View name | Add column | Data type | Description | |
|---|---|---|---|---|
| Catalog/View name | Add column | Data type | Description | |
| pg_database | dathasloginevt | boolean | Defined login event triggers | |
| pg_replication_slots | failover | boolean | Logical slot enabled to be synced to the standbys | |
| synced | boolean | Logical slot that was synced from a primary server | ||
| invalidation_reason | text | The reason for the slot’s invalidation | ||
| inactive_since | timestamp time zone | with | The time since the slot has become inactive | |
| pg_stat_progress_copy | tuples_skipped | bigint | Number of tuples skipped | |
| pg_stat_progress_vacuum | indexes_total | bigint | Total number of indexes that will be vacuumed | |
| indexes_processed | bigint | Number of indexes processed | ||
| dead_tuple_bytes | bigint | Amount of dead tuple data | ||
| Catalog/View name | Add column | Data type | Description | |
| max_dead_tuple_bytes | bigint | Amount of dead tuple data based on maintenance_work_mem | ||
| num_dead_item_ids | bigint | Number of dead item identifiers collected | ||
| pg_stat_subscription | worker_type | text | Type of the subscription worker process | |
| pg_stats | range_length_histogram | anyarray | A histogram of the lengths of non-empty values | |
| range_empty_frac | real | Fraction of column entries whose values are empty ranges | ||
| range_bounds_histogram | anyarray | A histogram of lower and upper bounds of non-empty values | ||
| pg_subscription | subfailover | boolean | The associated replication slots are enabled to be synchronized to the standbys |
PDF page 15
| View name | Remove column | Description |
|---|---|---|
| pg_stat_bgwriter | buffers_backend | It duplicates the pg_stat_io view. |
| buffers_backend_fsync | It duplicates the pg_stat_io view. | |
| checkpoints_timed | Move to pg_stat_checkpointer | |
| checkpoint_req | Move to pg_stat_checkpointer | |
| checkpoint write time__ | Move to pg_stat_checkpointer | |
| checkpoint sync time__ | Move to pg_stat_checkpointer | |
| buffers_checkpoint | Move to pg_stat_checkpointer | |
| pg_stat_progress_vac | num_dead_tuples | Renamed to dead_tuple_bytes |
| uum | max_dead_tuples | Renamed to max_dead_tuple_bytes |
| View name | Before | After | Note |
|---|---|---|---|
| pg_database | daticulocale | Datlocale | |
| pg_collation | coliculocale | Collocate |
PDF page 16
| View name | Removed column | Description |
|---|---|---|
| element_types | domain_default | Due to defects in standard specifications |
| View name | Description |
|---|---|
| pg_attribute | The NOT NULL constraint on the attstattarget column was removed, and the value indicating the default statistics was changed from -1 to NULL. |
| pg_backend_memory_contexts | The “search_path processing cache” is now output. |
| pg_statistic_ext | The data type of the stxstattarget column was changed from integer to smallint. stxstattarget column NOT NULL constraints were removed. |
| pg_stat_wal | WAL information output by the bgwriter process is added. This change is backported to PostgreSQL 14 or later. |
Pg_wait_events view
The following is the detailed description of the pg_wait_events view added to PostgreSQL 17. The pg_wait_events view provides the names and descriptions of registered wait events. [1e68e43]
| Column name | Data type | Description | Note |
|---|---|---|---|
| type | text | Type of Wait Event | Activity, Lock, IO, etc. |
| name | text | Name of Wait Event | |
| description | text | Wait Event description |
PDF page 17
Pg_stat_checkpointer view
The following is the detail of the pg_stat_checkpointer view, which is new to PostgreSQL 17. [96f0526, 12915a5]
| Column name | Data type | Description | |
|---|---|---|---|
| num_timed | bigint | Number of scheduled checkpoints | |
| num_requested | bigint | Number of checkpoints requested | |
| restartpoints_timed | bigint | Number of restart points timed out or rescheduled | |
| restartpoints_req | bigint | Number of restart points requested | |
| restartpoints_donewrite_time | bigint | Number of restart points executed | |
| double precision | double precision | Total write time | |
| sync_timebuffers_writtenstats_reset | double precision bigint | double precision | Total synchronization time Number of buffers written |
| timestamp time zone | with | Reset timestamps |
PDF page 18
3.1.2 Logical Replication Enhancements
The following features have been added to Logical Replication.
Integration with Streaming Replication
The WAL Sender (walsender) process of logical replication can be configured to send any update data to the plugin after confirming that the replication slot in streaming replication has received the WAL. The primary server parameter synchronized_standby_slots specifies the name of the streaming replication slot that should confirm the transfer. To use this feature, the ‘failover’ attribute of the logical replication slot must be set as described below. If the replication slot specified in synchronized_standby_slots becomes inactive Logical replication transfers are also stopped and the following message is periodically output to the primary server log. [bf279dd]
Replication slot new attribute
The parameter ‘failover’ has been added to the pg_create_logical_replication_slot function. The default value of this parameter is ‘false’. Replication slots with this parameter set to ’true’ can synchronize LSN information to the standby instance of streaming replication. The ‘failover’ column has been added to the pg_replication_slots catalog to store the added attribute values. [c393308]
PDF page 19
Subscription new attribute
The new attribute FAILOVER can now be specified for subscriptions. To store this attribute, a subfailover column has been added to the pg_subscription catalog. If this attribute is set to TRUE for the subscription, replication slots created on the primary server will also have the FAILOVER attribute at the same time.
PDF page 20
Logical Replication Slot Synchronization
The information of logical replication slots created on the primary server can be periodically synchronized to the standby server in streaming replication. [93db6cb] The following conditions are required on the streaming replication standby server to use this feature.
Set the parameter sync_replication_slots to ‘on’ (default ‘off’)
Set the parameter wal_level to ’logical’ (default ‘replica’)
Use the replication slot with the ‘failover’ option specified
Setting of the parameter primary_slot_name
Parameter hot_standby_feedback set to ‘on’ (default ‘off’)
Include ‘dbname’ setting in parameter primary_conninfo If the above conditions are met, the “slotsync worker” process is launched on the streaming replication instance. If the conditions are not met, the following log is output.
Pg_sync_replication_slots function
PostgreSQL 17 adds the function pg_sync_replication_slots to synchronize logical replication slots on streaming replication standby servers. This function forces synchronization of replication slot information even in environments where the parameter sync_replication_slots is set to ‘off’. [ddd5f4f]
PDF page 21
Use hash the index on subscribers
The subscribers can now use not only Btree indexes but also Hash indexes for update processing. [edca342]
Pg_logical_emit_message function
Added parameter ‘flush’ to control WAL flush. The default value is ‘false’, which means no messages will be flushed. [173b56f]
Syntax 1 - Pg_logical_emit_message function
3.1.3 Streaming Replication Enhancements
Data to be transferred to the standby instance is now retrieved from the WAL buffer if possible. Previously, the data was reloaded from the WAL file after the writing was completed. [91f2cae]
3.1.4 Incremental Backup
The incremental backups are now available as a standard feature of PostgreSQL. [174c480, dc21234, ee1bfd1, d9ef650, f8ce4ed]
WAL summary
To use incremental backup, the WAL summarize feature must be enabled. The WAL summarize feature can be enabled by setting the parameter wal_level to ‘replica’ or ’logical’ and changing the parameter summarize_wal (default value ‘off’) to ‘on’. When this feature is enabled, a “walsummarizer” process is invoked in the instance and summary data of the WAL file is stored in the ${PGDATA}/pg_wal/summaries directory.
PDF page 22
| Function name | Description |
|---|---|
| pg_available_wal_summaries | Returns the starting LSN and ending LSN for each WAL summary file |
| pg_wal_summary_contents | Return update information between specified LSNs |
| pg_get_wal_summarizer_state | Returns status of WAL summary creation |
Syntax 2 - WAL summary retrieval functions
PDF page 23
Incremental Backup
The incremental backup is a feature that retrieves the difference the previous backup. The manifest file output during the previous backup is used to obtain an incremental backup. To execute the incremental backup, specify the manifest file of the previous backup in the –incremental option (abbreviated form -i) of the pg_basebackup command.
PDF page 24
Manifest file enhancements
The System Identifier is now output in the manifest file. The version of the manifest file has been changed to version 2. [2041bc4]
PDF page 25
3.1.5 Partition Table Enhancements
The following new features have been implemented for partition tables.
Enhancements to Partition Pruning
The IS UNKNOWN, IS NOT UNKNOWN clause for boolean columns now supports partition pruning. [07c36c1]
Allow exclude constraints
Previously, only unique constraints using Btree were allowed for partitions. PostgreSQL 17 now also allows EXCLUDE CONSTRAINT with the same restrictions. However, column comparisons must be performed for equality. In the second example below, an error occurs because the partition key does not include the constraint target column. [8c852ba]
PDF page 26
Support for IDENTITY column
The INSERT statements are now supported on partitions of partitioned tables with IDENTITY columns. The second INSERT statement in the example below will cause an error in PostgreSQL 16. [6995863]
PDF page 27
3.1.6 Roles and Privileges
Predefined roles and privileges that can be granted have been added.
MAINTAIN privilege
The MAINTAIN privilege can now be granted on tables and materialized views. A role granted this privilege can execute VACUUM, ANALYZE, REINDEX, REFRESH MATERIALIZED VIEW, CLUSTER, and LOCK TABLE statements on the target relation. The result of the \dp meta-command in the psql command will output ’m’. [ecb0fd3]
PDF page 28
Addition of pg_maintain role
The pg_maintain predefined role has been added. This role is able to grant MAINTAIN privilege on all relations.
Modification of pg_monitor role
The predefined role pg_monitor has been granted permission to execute the pg_current_logfile function. [8d8afd4]
3.1.7 Built-in Locale Provider
PostgreSQL 17 has added a ‘built-in’ locale provider that is independent of external environments such as Libc or icu. The BUILTIN can now be specified in commands and SQL statements that specify a locale provider. [2d819a0, f69319f]
PDF page 29
3.1.8 Event Trigger
The following features have been added to event triggers.
Disabling Event Triggers
default value is ‘on’, which enables event triggers.
Login event trigger
The login event trigger, which is executed on successful authentication from the client, has been added. The following is an example of the event trigger that appends the connection time to the table. [e83d1b0]
PDF page 30
Reindex DDL trigger
The DDL event triggers can now be generated at the start and end of the execution of REINDEX statements. [f21848d]
PDF page 31
PDF page 32
3.1.9 Configuration File
The maximum length of tokens in the pg_hba.conf and pg_ident.conf files has been extended from 256 bytes to unlimited. In complex environments configured with LDAP, there were problems with exceeding the previous maximum length. [38df84c]
3.1.10 Log files
The following new changes have been implemented in the output of the server logs.
Logging of trust connections
When the parameter log_connections is set to “on”, logs are output for trust connections as follows. [38df84c]
PDF page 33
Replication Slot logging
The logs about replication slots are output at the LOG level (usually at the DEBUG1 level) when the parameter log_replication_commands is set to ‘on’. The following example shows the logs at the beginning and end of replication. [7c3fb50]
Recovery related logging
The logs at the start and end of the recovery process have been added. The following example shows the log at instance startup for streaming replication. [1d35f70]
PDF page 34
3.1.11 Hook
The following Object Access Type (OAT) hooks have been added to the ALTER TABLE statement. [352ea3a]
{ ENABLE | DISABLE | [NO] FORCE } ROW LEVEL SECURITY
{ ENABLE | DISABLE } TRIGGER
{ ENABLE | DISABLE } RULE
3.1.12 Libpq
The following APIs have been added and enhanced.
Connect string sslnegotiation
The connection option sslnegotiation has been added. This option determines how the encryption method is negotiated during the client connection. This option can also be specified by the environment variable PGSSLNEGOTIATION. [d39a49c, fb5718f]
| Value | Description | Note |
|---|---|---|
| postgres | Perform PostgreSQL protocol negotiation. | Default |
| direct | First attempt to establish a standard SSL connection and if that fails reconnect and perform the negotiation. | |
| requiredirect | Attempt to establish a standard SSL connection and if that fails return a connection failure immediately. |
Close Portals and Statements
Functions to close portals and statements have been added. Functions with “send” in the name are non-blocking versions. [28b5726]
| Function | Description |
|---|---|
| PQclosePrepared | Close the prepaid statement. |
| PQclosePortal | Close the portal. |
| PQsendClosePrepared | Close the Prepared statement. Do not wait for completion. |
| PQsendClosePortal | Closes the portal. Do not wait for completion. |
PDF page 35
Password change
The function PQchangePassword has been added to change the password of a connected user. [a7be2a6]
Changes to chunk mode
The PGresults now retrieves multiple tuples at once. The function PQsetChunkedRowsMode has been added to change the mode accordingly. [4643a2b]
Pipeline Synchronization
The PQsendPipelineSync function has been added. This function is similar to the PQpipelineSync function, but it does not flush a synchronization message to the server unless the output buffer reaches a threshold value. [4794c2]
Sequence operation
The functions have been added to manipulate sequences, such as the relation_open function. [449e798]
| Function | Description | Note |
|---|---|---|
| sequence_opensequence_close | Open the sequence Close the sequence |
Injection Points
The following functions have been added to support injection points. [d86d20f]
| Function | Description | Note |
|---|---|---|
| InjectionPointAttach | Attaching Callbacks | |
| InjectionPointDetach | Detaching a callback | |
| InjectionPointRun | Run the injection point |
Non-Blocking cancel functions
Previously, the PQcancel API used blocking requests. It is now possible to send a cancel request without blocking. [61461a3]
PDF page 36
| Function | Description |
|---|---|
| PQcancelCreate | Prepare to send a cancel request. |
| PQcancelBlocking | Requesting discard of the current command in blocking state. |
| PQcancelPoll | Request discard of current command in non-blocking state. |
| PQcancelStart | Request discard of current command in non-blocking state. |
| PQcancelStatus | Retrieve the status of a canceled connection. |
| PQcancelSocket | Retrieve the identifier of the canceled connection socket. |
| PQcancelErrorMessage | Get the last error generated by the cancel operation. |
| PQcancelFinish | Close the connection. |
| PQcancelReset | Reset PGcancelConn and reuse it for a new connection. |
Background Worker
The flag BGWORKER_BYPASS_ROLELOGINCHECK can now be specified in the functions BackgroundWorkerInitializeConnection and BackgroundWorkerInitializeConnectionBy-Oid. This flag allows bypassing the role login check. [e768919]
DSM Registry
The function GetNamedDSMSegment has been added to allow shared libraries to easily use shared memory. Previously, shared libraries specified in the parameter shared_preload_libraries had to request shared memory via the shmem_request_hook hook. [8b2bcf3]
DSA Initial Size
Previously, DSAs were created at 1 MB and the maximum is still extended to DSA_MAX_SEGMENT_SIZE. The dsa_create_ext and dsa_create_in_place_ext functions have been added to allow the initial and maximum sizes to be specified. [bb952c8]
Streaming I/O
Abstracts access to relations and allows relation data to be accessed as a stream of buffers. This modification will make it easier to make changes in the future when implementations such as asynchronous I/O are added. It is used to execute the ANALYZE statement and perform a sequential scans on the table. [b7b0f3f, 041b968, b5a9b18]
PDF page 37
| Function | Description | Note |
|---|---|---|
| read_stream_begin_relation | Create a new read streaming object. | |
| read_stream_next_buffer | Retrieve a single fixed buffer from the stream. | |
| read_stream_resetread_stream_end | Release the queued buffer and reset the stream. Release the stream. |
Multi-block read
The multi-block version of the ReadBuffer API is now provided. The maximum number of blocks is determined by the new parameter io_combine_limit. In the future, asynchronous I/O may be used internally. [210622c]
| Function | Description | Note |
|---|---|---|
| StartReadBufferStartReadBuffersWaitReadBuffers | Start reading a single block. Start reading multi blocks. Wait for the completion of block read. |
Bump Memory Allocation
The memory allocator BumpContext has been added, which is suitable for memory allocations with short life times. BumpContext memory is now used for sorting tuples and for VACUUM processing. [29f6a95, 6ed83d5, 8a1b31e]
PDF page 38
| Function | Description |
|---|---|
| BumpContextCreate | Create Bump MemoryContext. |
| BumpAlloc | Allocate Bump memory. |
| BumpFree | Free Bump memory. |
| BumpRealloc | Re-allocate Bump memory. |
| BumpReset | Frees all memory which is allocated in the given set. |
| BumpDelete | Frees all memory which is allocated in the given context. |
| BumpGetChunkContext | Un-supported. |
| BumpGetChunkSpace | Un-supported. |
| BumpIsEmpty | Returns true if ‘block’ contains no chunk. |
| BumpStats | Compute stats about memory consumption of the context. |
| BumpCheck | Walk through chunks and check consistency of memory. |
Polling file descriptor
The PQsocketPoll function has been provided to monitor file descriptors. [f5e4ded]
3.1.13 Access Method
The following enhancements have been added to the access methods.
Parallel build of BRIN index
The multiple worker processes can now be used to build BRIN indexes. The amcanbuildparallel flag has been added to the index access method structure IndexAmRoutine. [b437571]
heap_page_prune function
The parameters of the HEAP_PAGE_PRUNE function have been changed to allow multiple options to be specified in a bitmap. Currently, only HEAP_PAGE_PRUNE_MARK_UNUSED_NOW and HEAP_PAGE_PRUNE_FREEZE options are available. [3d0f730, 6dbb490]
3.1.14 Wait Events
The following features have been added for wait events.
PDF page 39
Modified Wait Events
The following wait events have been added or changed. [fa88928, c9af054, c8e318b, 0013ba2, 5c430f9, d86d20f]
| Wait Event Name | Class | Description |
|---|---|---|
| CheckpointDelayComplete | IPC | Waiting for the backend to complete checkpoint |
| CheckpointDelayStart | IPC | Waiting for backend to start checkpoint |
| MultixactCreation | IPC | Waiting for multi-transaction creation |
| ReplicationSlotsyncMain | Activity | Replication slot synchronization wait |
| ReplicationSlotsyncShutdown | Activity | Waiting for replication slot to stop |
| WaitForStandbyConfirmation | Client | Waiting for standby confirmation |
| WalSummarizerError | Timeout | WAL summary error |
| WalSummaryRead | IO | Waiting for WAL summary to load |
| WalSummaryReady | IPC | Waiting for WAL summary generation |
| WalSummaryWrite | IO | Waiting for WAL summary writing |
| InjectionPoint | LWLock | Waiting for injection point loading |
| change | change | Note |
|---|---|---|
| AutoVacuumMainBaseBackupReadBaseBackupSyncBaseBackupWriteBgWorkerShutdownBgWorkerStartup | AutovacuumMain BasebackupRead BasebackupSync BasebackupWrite BgworkerShutdown BgworkerStartup | |
| BgWriterHibernateBgWriterMainBufferIOBufFileReadBufFileTruncateBufFileWriteDSMAllocateDSMFillZeroWriteGSSOpenServer | BgwriterHibernate BgwriterMain BufferIo BuffileRead BuffileTruncate BuffileWrite DsmAllocate DsmFillZeroWrite GssOpenServer | |
| LibPQWalReceiverConnect | LibpqwalreceiverConnect | |
| LibPQWalReceiverReceive | LibpqwalreceiverReceive | |
| LockFileAddToDataDirRead | LockFileAddtodatadirRead | |
| LockFileAddToDataDirSync | LockFileAddtodatadirSync | |
| LockFileAddToDataDirWrite | LockFileAddtodatadirWrite | |
| LockFileReCheckDataDirRead | LockFileRecheckdatadirRead | |
| ProcArrayGroupUpdateSLRUFlushSyncSLRUReadSLRUSyncSLRUWriteSSLOpenServerSysLoggerMainWALBootstrapSync | ProcarrayGroupUpdate SlruFlushSync SlruRead SlruSync SlruWrite SslOpenServer SysloggerMain WalBootstrapSync | |
| WALBootstrapWriteWALCopyReadWALCopySyncWALCopyWriteWALInitSyncWALInitWriteWALRead | WalBootstrapWrite WalCopyRead WalCopySync WalCopyWrite WalInitSync WalInitWrite WalRead | |
| WALSenderTimelineHistoryRead | WalsenderTimelineHistoryRead | |
| WalSenderWaitForWALWALSync | WalSenderWaitForWal WalSync | |
| WALSyncMethodAssignWALWrite | WalSyncMethodAssign WalWrite |
PDF page 40
List of Wait Events
The list of wait events is now written in the file src/backend/utils/activity/wait_event_names.txt and the code and documentation are generated automatically. [59cbf60]
PDF page 41
Custom Type
The method of registering custom wait events has been changed. New API “uint32 WaitEventExtensionNew(const char *wait_event_name)” is provided. With this, the shared memory hook is no longer required. [af720b4]
3.1.15 FILLFACTOR
The FILLFACTOR is now considered in the estimated number of tuples when table statistics are not gathered. Previously, FILLFACTOR was not considered, which could result in an overestimation of the number of tuples. [29cf61a]
PDF page 42
3.1.16 VACUUM
The TidStore is now used to store tuple IDs for VACUUM instead of a simple array. This change reduces the amount of memory used, which used to be larger, and eliminates the 1 GB limit. In addition, some column names in the pg_stat_progress_vacuum view have been changed. [667e65a]
3.1.17 LLVM
PostgreSQL 17 now supports LLVM 17, 18. Backported to supported older versions of PostgreSQL. [76200e5, d282e88]
3.1.18 Acceleration
The CRC calculation function COMP_CRC32C can now be executed natively in environments that support LoongArch. [4d14ccd] In environments where the Intel AVX-512 instruction set can be used, visibilitymap_count and pg_popcount functions can now be executed faster. [41c51f0, 792752a]
3.1.19 UNICODE
PostgreSQL 17 has the following changes in Unicode support. [9d17e5f, 9e2e4f0, ad49994]
- Unicode version changed from 15.0.0 to 15.1.0 (https://unicode.org/versions/Unicode15.1.0/)
PDF page 43
Unicode CLDR version changed from 43 to 45 (https://cldr.unicode.org/index/downloads/cldr-45)
Add update-unicode build target to update UNICODE table