3 Architecture
PDF page 17
Describes the improved architecture and features in PostgreSQL 19.
3.1.1 Changed System Catalogs
The following catalogs and views have been changed. [228c370, 167ed80, fd5a1a0, deb6744, b71bae4, a5b5432, a850be2, 185e304, d3b6183, 96b3784, f9a09aa, f6a4c49, 3edaf29, 76b7872, e68b6ad, 5db6a34, ab40db3, 0d78952, f3c9e34, c257ba8, a36164e, 307447e, fb80f38, ac58465, 723619e, 8fe315f, 2f094e7, 3b88e50, 4019f72, 01d485b, 87f61f0]
| View Name | Description |
|---|---|
| pg_dsm_registry_allocations | Provides information on Dynamic Shared Memory (DSM) |
| pg_propgraph_element | Property Graph Elements |
| pg_propgraph_element_label | Property Graph Element Labels |
| pg_propgraph_label | Property Graph Labels |
| pg_propgraph_label_property | Property Graph Label Properties |
| pg_propgraph_property | Property Graph Properties |
| pg_publication_sequences | Sequences including in PUBLICATION |
| pg_stat_autovacuum_scores | VACUUM score data for each table |
| pg_stat_lock | Runtime statistics for the locked condition |
| pg_stat_progress_data_checksums | Progress report on checksum configuration Changes |
| pg_stat_progress_repack | REPACK statement progress report |
| pg_stat_recovery | Report on the recovery status of the startup process |
PDF page 18
| View name | Added column | Data type | Description |
|---|---|---|---|
| pg_available_extensions | location | text | Directory for storing extension modules |
| pg_available_extension_versions | location | text | Directory for storing extension modules |
| pg_foreign_data_wrapper | fdwconnection | oid | OID for Foreign Data Wrapper connection function |
| pg_publication | puballsequences | boolean | Is FOR ALL SEQUENCES specified? |
| pg_publication_rel | prexcept | boolean | Indicates whether it is a replication exception table |
| pg_range | rngconstruct2 | regproc | OID for a two-argument constructor |
| rngconstruct3 | regproc | OID for a three-argument constructor | |
| rngmltconstruct0 | regproc | OID for a multi-range constructor with zero arguments | |
| rngmltconstruct1 | regproc | OID for a multi-range constructor with one arguments | |
| rngmltconstruct2 | regproc | OID for a multi-range constructor with two arguments | |
| pg_replication_slots | slotsync skip re__ ason | text | The reason for skipping slot synchronization |
| pg_stats | tableid | oid | OID of the table |
| attnum | smallint | Number of columns | |
| pg_stats_ext | tableid | oid | OID of the table |
| statistics_id | oid | Extended statistics object OID | |
| pg_stats_ext_exprs | tableid | oid | OID of the table |
| statistics_id | oid | Extended statistics object OID | |
| range_length_histogram | anyarray | Histogram with non-empty bin length | |
| range_empty_frac | real | Percentage of empty values | |
| range_bounds_histogram | anyarray | Histogram of the upper and lower limits of a range | |
| pg_stat_database_conflicts | stats_reset | timestamptz | Data reset timestamp |
| pg_stat_progress_analyze | started_by | text | ANALYZE trigger (manual, autovacuum) |
| pg_stat_progress_basebackup | backup_type | text | Specify the type of backup (full or incremental) |
| pg_stat_progress_vacuum | mode | text | VACUUM Execution Modes (normal, aggressive, failsafe) |
| started_by | text | VAUUM trigger (manual, autovacuum, autovacuum_wraparound) | |
| pg_stat_replication_slots | mem exceeded__ count | bigint | Number of times the decoding memory usage exceeded logical_decoding_work_mem |
| slotsync skip co__ unt | bigint | Number of synchronization skips for replication slots | |
| slotsync last ski__ p | timestamptz | Last timestamp of synchronization skip for replication slots | |
| pg_stat_subscription_stats | confl_update_deleted | bigint | Number of times the item to be updated has been deleted in other sources |
| sync_seq_error_count | bigint | Number of sequence synchronization errors | |
| sync_table_error_count | bigint | Number of synchronization errors for the table | |
| pg_stat_user_functions | stats_reset | timestamptz | Statistics reset timestamp |
| pg_stat_wal | wal_fpi_bytes | numeric | Number of bytes for full-page write |
| pg_subscription | subretaindeadtup les | boolean | Is update_deleted detection enabled? |
| submaxretention | int | Maximum retention period for dead doubles | |
| subretentionactiv e | boolean | To keep the dead tuple? | |
| subserver | oid | OID of the FOREIGN SERVER for PUBLICATION connection | |
| subwalrcvtimeou t | text | WAL receiver timeout | |
| pg_stat_{all|sys|user}_{tables|indexes} | stats_reset | timestamptz | Statistics reset timestamp |
| pg_statio_{all|sys|user}_{tables|indexes} | stats_reset | timestamptz | Statistics reset timestamp |
PDF page 19
PDF page 20
| View name | Remove column | Description |
|---|---|---|
| pg_stat_subscription_stats | sync_error_count | Renamed to sync_tale_error_count |
| View name | Description |
|---|---|
| pg_edge_table_components | Property Graph object information |
| pg_element_table_key_columns | Property Graph object key columns |
| pg_element_table_labels | Property Graph object labels |
| pg_element_table_properties | Property Graph object properties |
| pg_element_tables | Property Graph object tables |
| pg_labels | Property Graph object labels |
| pg_property_graph_privileges | Property Graph object privileges |
| property_graphs | Property Graph information |
PDF page 21
| View name | Description |
|---|---|
| pg_aggregate | The aggtransspace column allows negative values. It is used when the transition state cannot be predicted, such as with array_agg function. |
| pg_class | The tuple with “relkind=‘g’”, which indicates a PROPERTY GRAPH object, is added |
| pg_subscription_rel | Information about the sequences to be replicated is added |
| pg_stat_wal_receiver | The “connecting” message may appear in the status column |
View pg_dsm_registry_allocations
The pg_dsm_registry_allocations view provides information about Dynamic Shared Memory (DSM). This view can only be accessed by users with the SUPERUSER privilege or who are members of the pg_read_all_stats role. [167ed80]
| Column name | Data type | Description |
|---|---|---|
| name | text | Entry name |
| type | text | Indicates the entry type. The following values are returned. • segment • area • hash |
| size | bigint | Entry size |
View pg_stat_lock
The pg_stat_lock view provides cumulative information on lock durations. This view is accessible to all users. [4019f72]
PDF page 22
| Column name | Data type | Description |
|---|---|---|
| locktype | text | Type of the lock |
| waits | bigint | Total number of waiting times |
| wait_time | bigint | Total waiting time |
| fastpath_exceeded | bigint | Number of times a lock could not be acquired via the fast path |
| stats_reset | timestamp with time zone | Timestamp of the statistics reset |
View pg_stat_progress_data_checksums
The pg_stat_progress_data_checksums view allows real-time monitoring of the progress of checksum activation. [f19c0ec]
PDF page 23
| Column name | Data type | Description | Note |
|---|---|---|---|
| pid | integer | Process ID of the worker | |
| datid | oid | OID of the database | |
| datname | name | Name of the database | |
| phase | text | Current progressing phase | |
| databases_totaldatabases_done | bigint | The total number of databases | |
| bigint | The number of processed databases | ||
| relations_totalralations_done | bigint | The number of tables | |
| bigint | The number of processed tables | ||
| blocks_totalblocks_done | bigint | The number of total blocks | |
| bigint | The number of processed blocks |
View pg_stat_progress_repack
The pg_stat_progress_repack view allows real-time monitoring of the execution status of the REPACK statements. [ac58465]
PDF page 24
| Column name | Data type | Description |
|---|---|---|
| pid | integer | Process ID of the backend server |
| datid | oid | OID of the database |
| datname | name | Name of the database |
| relid | oid | OID of the targeted for REPACK statement |
| command | text | SQL statements (REPACK, VACUUM FULL, etc.) |
| phase | text | Processing phase |
| repack_index_relid | oid | OID of the processing index |
| heap_tuples_scanned | bigint | Number of tuples scanned |
| heap_tuples_written | bigint | Number of tuples written |
| heap_blks_total | bigint | Number of blocks in the table |
| heap_blks_scanned | bigint | Number of blocks scanned |
| index_rebuild_count | bigint | Number of index rebuilds |
PDF page 25
View pg_stat_recovery
The pg_stat_recovery view provides the recovery status of the standby database. This view can be retrieved by users with the SUPERUSER privilege or who have the pg_monitor role. [01d485b]
| Column name | Data type | Description |
|---|---|---|
| promote_triggered | boolean | Whether a promotion occurred |
| last_replayed_read_lsn | pg_lsn | Last start WAL position replayed |
| last_replayed_end_lsn | pg_lsn | Last end WAL position replayed |
| last_replayed_tli | integer | Last timeline replayed |
| replay_end_lsn | pg_lsn | WAL log location of the record currently being replayed |
| replay_end_tli | integer | Timeline of the WAL record replayed |
| recovery_last_xact_time | timestamp with time zone | Timestamp of the last transaction commit |
| current_chunk_start_time | timestamp with time zone | Time when the startup process observed |
| pause_state | text | Recovery pause state |
3.1.2 Logical Replication Enhancements
The following new features have been implemented for logical replication
PDF page 26
Sequence Replication
Sequence replication is now supported in logical replication. On the publication side, create the publication by specifying the ALL SEQUENCES clause. The names of the sequences contained in the publication are stored in the pg_publication_sequences view. [5509055]
PDF page 27
SERVER clause in the CREATE SUBSCRIPTION statement
Previously, the connection information for connecting to the PUBLICATION was specified directly in the CONNECTION clause of the CREATE SUBSCRIPTION statement. In PostgreSQL 19, it is now possible to specify an existing SERVER object in the SERVER clause. [8185bb5]
PDF page 28
Specifying Exception Tables
The EXCEPT clause can be specified for the PUBLICATION that uses the ALL TABLES clause to designate tables to be excepted. The EXCEPT clause is specified in the CREATE PUBLICATION or ALTER PUBLICATION statement. The prexcept column has been added to the pg_publication_rel catalog to indicate exception tables. [5984ea8, fd36606, 493f8c6]
Subscription option retain_dead_tuples
The retain_dead_tuples option has been added to subscriptions. Enabling this option causes the subscriber to retain deleted tuples until the remote transaction is completed. When setting the retain_dead_tuples option to “true”, the track_commit_timestamp parameter must also be set to “true” (default: “false”). [228c370]
Subscription option max_retention_duration
The max_retention_duration option has been added to subscriptions. This option sets the maximum retention period for non-deletable transaction IDs in environments where the retain_dead_tuples
PDF page 29
option is enabled. Once this threshold is exceeded, the apply worker stops retaining conflict detection information. The setting for this option can be verified in the submaxretention column of the pg_subscription catalog. [a850be2]
Detection of Memory Usage for Decoding
The mem_exceeded_count column has been added to the pg_stat_replication_slots view. This column indicates the number of times the memory used for logical decoding exceeded the logical_decoding_work_mem parameter. [d3b6183]
Conflict Detection
The update_deleted conflict can now be detected when an update on a subscriber conflicts with a local deletion. To use this feature, the retain_dead_tuples option must be enabled on the subscriber. [fd5a1a0]
PDF page 30
Automatic WAL Level Change
Even if the wal_level parameter is set to its default value of “replica”, the WAL output level is automatically changed to “logical” when a logical replication slot is created. The internal parameter effective_wal_level has been added to indicate this state. When all logical replication slots are deleted, the value of the effective_wal_level parameter reverts to its original state. [67c2097]
3.1.3 Partition Table Enhancements
The following new features have been implemented in the partition table.
PDF page 31
Merging Partitions
It is now possible to merge multiple partitions into a single partition using an ALTER TABLE statement on RANGE or LIST partitioned tables. Specify the existing partitions in the MERGE PARTITIONS clause and specify the name of the new partition to be created as the destination in the INTO clause. [f2e4cc4, 713e553]
Syntax 1 - MERGE PARTITIONS clause
The following example merges partitions part1v1 and part1v2 into the part1v12 partition.
PDF page 32
Partition Splitting
It is now possible to split a partition into multiple partitions using the ALTER TABLE statement on RANGE/LIST partition tables. Specify the source partition in the SPLIT PARTITION clause of the ALTER TABLE statement, and specify the destination partitions and partitioning values in the INTO clause. [4b3d173, 713e553]
Syntax 2 - SPLIT PARTITION clause
PDF page 33
3.1.4 SQL Property Graph
PostgreSQL 19 introduces the PROPERTY GRAPH object, which provides graph query features. This feature implements Property Graph Queries (SQL/PGQ) - ISO/IEC 9075-16:2023. PROPERTY GRAPH objects are created using the CREATE PROPERTY GRAPH statement. It creates a table that serves as the source for graph queries and maps it to a PROPERTY GRAPH. VERTEX and NODE, as well as EDGE and RELATIONSHIP, have the same meanings. This document does not provide detailed instructions on how to use it. [2f094e7]
Syntax 3 - Creating a Property Graph
PDF page 34
3.1.5 SSL/SNI
PostgreSQL now supports SSL Server Name Indication (SNI) on the server side. This feature is enabled by setting the ssl_sni parameter to “on” (the default value is “off”). To configure SNI, use the pg_hosts.conf file in the database cluster. In the pg_hosts.conf file, enter the following entries, one per line. [4f43302]
PDF page 35
| Setting | Description | Note |
|---|---|---|
| HOSTNAME | Hostname (required) | |
| SSL CERTIFICATE | SSL certificate file (required) | |
| SSL KEY | SSL private key file (required) | |
| SSL CA | SSL authentication file (optional) | |
| PASSPHRASE COMMAND | Passphrase (optional) | |
| PASSPHRASE COMMAND RELOAD | Reload passphrase (optional) |
3.1.6 Dynamic Checksum Configuration
It is now possible to enable or disable block checksums while the instance is running. To enable checksums, execute the pg_enable_data_checksums function; to disable them, execute the pg_disable_data_checksums function. Enabling checksums is executed by a background worker process. When enabling checksums, the pg_enable_data_checksums function allows specifying the cost_delay parameter (default value 0) and the cost_limit parameter (default value 100), which enables checksums in a behavior similar to VACUUM cost delay. Checksum enablement executes in the background, and progress can be tracked via the pg_stat_progress_data_checksums view. [f19c0ec]
PDF page 36
3.1.7 Roles
The pg_read_all_data and pg_write_all_data functions now support reading and writing large objects. In previous versions, the error “ERROR: permission denied for large object {OID}” occurred. [d981976]
PDF page 37
3.1.8 Libpq
The following APIs have been added or enhanced.
Connection string servicefile
The servicefile option has been added to the connection string to specify a service file. The
PDF page 38
Connection string oauth_ca_file
The oauth_ca_file option has been added to the connection string to specify an OAuth certificate. The PGOAUTHCAFILE environment variable is now available in non-debug modes as well. [9933681]
Retrieving Version Information
The get_pg_version function, which retrieves version information from the PG_VERSION file, has been added. This function is used by commands such as pg_resetwal, pg_combinebackup, pg_createsubscriber, and pg_upgrade. [cd0be13]
Other API
The following APIs have been added. [fe07100, 7508169, e533524, b8d7685]
| API name | Description | Note |
|---|---|---|
| pg_database_localeGetNamedDSAGetNamedDSHash | Retrieve the database’s default locale Assign the DSA Assign the DSA hash | |
| ParallelSlotSetIdlePQgetThreadLock | Mark ParallelSlot as idle Retrieve lock information for the current thread |
3.1.9 I/O Processing
These are the improvements to I/O processing in PostgreSQL 19.
PDF page 39
Automatic Scaling of Asynchronous I/O Workers
The number of I/O workers now automatically increases or decreases in response to load. The number of active I/O workers is determined by the following parameters: As the I/O queue grows, the number of workers increases; if a worker remains idle for a certain period of time, it is stopped. [d1c01b7]
| Parameter name | Description | Default value |
|---|---|---|
| io_min_workers | Minimum number of I/O workers | 2 |
| io_max_workers | Maximum number of I/O workers | 8 |
| io_worker_idle_timeout | Idle time before a worker terminates | 60s |
| io_worker_launch_interval | Interval between worker launches | 100ms |
Enhanced Streaming I/O
PostgreSQL 19 has enhanced the scope of streaming I/O.
VACUUM for BRIN index [a6eac22]
Data deleting reads for hash index [bfa3c4f]
Index reads in the Contrib module pgstattuple [213f007]
Improvements to asynchronous I/O processing
When using io_uring with I/O methods, the behavior has been changed so that synchronous I/O is used for reads of four blocks or fewer. [a9ee668, 8ca147d, f63ca33]
3.1.10 Automatic Vacuum
The following features have been added to the automatic VACUUM processing.
Using Parallel Workers
It is now possible to use parallel workers during automatic VACUUM operations. Automatic VACUUM performs the same processing as the VACUUM (PARALLEL) statement. The number of parallel workers is determined by the autovacuum_max_parallel_workers parameter. The default value for this parameter is 0. Refer to the automatic VACUUM log to verify that parallel workers are launched.
PDF page 40
Prioritization by scoring
PostgreSQL 19 introduced the scoring system that determines the execution order of automatic VACUUM operations. It prioritizes tables that deviate the most from the thresholds used to trigger VACUUM and ANALYZE operations. Scores are determined by the newly added pg_stat_autovacuum_scores view. For example, if 100 tuples are updated by an UPDATE statement and the VACUUM threshold is 80, the score will be 1.25. The actual score is determined by multiplying this value by the following parameters, which represent their respective weights. [87f61f0]
| Parameter name | Default value | Description |
|---|---|---|
| autovacuum_analyze_score_weight | 1.0 | ANALYZE score weight |
| autovacuum_freeze_score_weight | 1.0 | FREEZE score weight |
| autovacuum_multixact_freeze_score_weight | 1.0 | Multi-Transaction FREEZE score weight |
| autovacuum_vacuum_insert_score_weight | 1.0 | VACUUM INSRT score weight |
| autovacuum_vacuum_score_weight | 1.0 | VACUUM score weight |
The structure of the pg_stat_autovacuum_scores view is as follows.
PDF page 41
| Column name | Data type | Description |
|---|---|---|
| relid | oid | OID of the table |
| schemaname | name | Name of the schema |
| relname | name | Name of the table |
| score | double precision | Maximum value of all component scores |
| xid_score | double precision | Transaction ID age score |
| vacuum_score | double precision | Vacuum score |
| vacuum_insert_score | double precision | Vacuum insert score |
| analyze_score | double precision | Analyze score |
| do_vacuum | boolean | Whether autovacuum would vacuum the table |
| do_analyze | boolean | Whether autovacuum would analyze the table |
| for_wraparound | boolean | Whether autovacuum would vacuum the table for wraparound prevention |
3.1.11 Hook
The following hooks have been added for the planner.
PDF page 42
Hook planner_setup_hook, planner_shutdown_hook
The planner_setup_hook hook, which is executed when the PlannerGlobal object is initialized, and the planner_shutdown_hook hook, which is executed immediately before the object is destroyed, have been added. [94f3ad3, 0f4c8d3]
Hook joinrel_setup_hook, join_path_setup_hook
The joinrel_setup_hook hook, which is executed when creating table join relations (joinrel), and the join_path_setup_hook hook, which is executed when adding paths to a joinrel, have been added. [4020b37]
3.1.12 Faster processing
Performance improvements have been implemented through changes to processor instructions and sorting algorithms.
Sorting
Some sorting algorithms have been changed from Quick sort to Radix sort. If there are fewer than 40 items, Quick sort will be used. [ef3c3cf]
Internal functions hex_encode / hex_decode
The hex_encode and hex_decode functions now support SIMD instructions for the x86-64 and Aarch64 architectures. The larger the input value, the more effective the performance improvement is expected to be. [ec8719c]
Page Checksum
If available, AVX2 instructions are used to calculate the page checksum. [5e13b0f]
CRC32C
If the Crypto Extension is available on an Arm v8 processor, it is used for CRC32C calculations. [fbc57f2]
COPY FROM statement
Performance has been improved by using SIMD instructions to check for the presence of special characters. [e0a3a3f]
PDF page 43
3.1.13 Log Output
The byte count for full-page images is now included in the logs generated by the automatic ANALYZE operation. [ad25744]
3.1.14 OAuth Authentication
The following new features have been added to the OAuth authentication feature.
File pg_hba.conf Settings
It is now possible to specify OAuth validator information in the pg_hba.conf options. The following is an example of pg_hba.conf from the manual. [b977bd3]
Validator Error Output
The following parameters have been added to control how errors generated by the validator are logged. [d438a36]
PDF page 44
| Parameter name | Description | Default value |
|---|---|---|
| oauth_validator.error_detail | Error information contained in DETAIL | '' |
| oauth_validator.internal_error | Whether to output internal errors | false |
3.1.15 Wait Events
The following wait events have been added. [6c5c393, e05a24c, 7a39f43]
| Wait event name | Description | Note |
|---|---|---|
| WaitEventBufferCOPY_FROM_READCOPY_TO_WRITE | Waiting for the data buffer Waiting for the COPY FROM read Waiting for the COPY TO write | Changed from WaitEventBufferPin |
| WAIT_FOR_WAL_WRITE | Waiting to write to the standby |