3 Architecture
PDF page 14
3.1.1 Modified catalogs
The following catalogs have been changed.
| View name | Description |
|---|---|
| pg_backend_memory_contexts | Displays all the memory contexts of the server process attached to the current session. |
| pg_stat_progress_copy | Outputs the execution status of the COPY statement. |
| pg_stat_replication_slots | Outputs the usage status of the replication slot. |
| pg_stat_wal | Outputs the WAL data output status. |
| pg_stats_ext_exprs | Provides information about all expressions included in extended statistics objects |
| View name | Description |
|---|---|
| routine_column_usage | Identifies the column used by the function or procedure. Currently not tracked. |
| routine_routine_usage | Identifies the function used by the function or procedure. Currently, some are not tracked. |
| routine_sequence_usage | Identifies the sequence used by a function or procedure. Currently, some are not tracked. |
| routine_table_usage | Identifies the table used by the function or procedure. Currently not tracked. |
PDF page 15
| View name | Added column | Data type | Description |
|---|---|---|---|
| pg_attribute | attcompression | char | Current compression method of the column. |
| pg_inherits | inhdetachpendin g | boolean | True for a partition that is in the process of being detached |
| pg_locks | waitstart | timestamp with time zone | Time when the server process time started waiting for this lock. |
| pg_prepared_statements | pg_prepared_statementsgeneric_plans | bigint | Number of times generic plan was chosen. |
| custom_plans | bigint | Number of times custom plan was chosen | |
| pg_proc | prosqlbody | pg_node_tre e | Pre-parsed SQL function body. |
| pg_range | rngmultitypid | oid | OID of the multirange type. |
| pg_replication_slots | two_phase | boolean | Enabled for decoding prepared transactions. |
| pg_stat_activity | query_id | bigint | Identifier of this backend’s most recent query. |
| pg_stat_database | session_time | double precision | Time spent by database sessions in this database. |
| active_time | double precision | Time spent executing SQL statements in this database. | |
| idle_in_transacti | double | Time spent idling while in a | |
| on_time | precision | transaction in this database. | |
| sessions | bigint | Total number of sessions. | |
| sessions_abandoned | bigint | Number of lost sessions. | |
| sessions_fatal | bigint | Number of sessions caused by fatal error. | |
| sessions_killed | bigint | Number of sessions terminated by the operator. | |
| pg_stats_ext | exprs | text[] | Expression to get extended statistics |
| pg_statistic_ext | stxexprs | pg_node_tre e | Expression trees for statistics object attributes. |
| pg_statistic_ext_data | stxdexpr | pg_statistic [] | A list of any expressions covered by this statistics object. |
| pg_subscription | subbinary | boolean | Publisher send data in binary format. |
| substream | boolean | Streaming of in-progress transactions. | |
| pg_type | typsubscript | regproc | Subscripting handler function’s OID. |
PDF page 16
| Catalog name | Column name | Description |
|---|---|---|
| pg_stat_ssl | compression | It was deleted because compression was disabled. |
| View name | Description |
|---|---|
| pg_attribute | The column definition order has changed. |
| pg_class | The initial value of the reltuples column has been changed to -1. |
| pg_settings | pending_restart column shows as true when a pertinent entry in postgresql.conf is removed. |
| pg_statistic_ext | Extended statistics with the ’e’= expression may be output in the stxkind column. |
| pg_stat_activity | Information of the archiver process and the walsender process will be output. walsender now show their latest replication command. This feature is backported to older versions. |
| pg_subscription_rel | ‘f’ = finished table copy may be output in the srsubstate column. |
| pg_type | The typtype column may output ’m’ to indicate a multi-range type. |
Among the modified system catalogs, the details of the major catalogs are described below.
PDF page 17
Pg_backend_memory_contexts
The pg_backend_memory_contexts view provides a view of the memory context usage of the server process corresponding to the current session. This view can only be viewed by users with the SUPERUSER attribute.
| Column name | Data type | Description |
|---|---|---|
| name | text | Name of the memory context. |
| ident | text | Identification information of the memory context. |
| parent | text | Name of the parent of this memory context. |
| level | integer | Distance from TopMemoryContext. |
| total_bytes | bigint | Total bytes allocated for this memory context. |
| total_nblocks | bigint | Total number of blocks allocated for this memory context. |
| free_bytes | bigint | Free space in bytes. |
| free_chunks | bigint | Total number of free chunks. |
| used_bytes | bigint | Used space in bytes. |
Pg_stat_progress_copy
This view will output the execution status of the COPY statement.
PDF page 18
| Column name | Data type | Description |
|---|---|---|
| pid | integer | Process ID of backend. |
| datid | oid | OID of the database |
| datname | name | Name of the database |
| relid | oid | OID of the table on which the COPY command is executed. |
| command | text | Command name, COPY FROM or COPY TO. |
| type | text | The IO types. |
| bytes_processed | bigint | Number of bytes already processed. |
| bytes_total | bigint | Size of source file for COPY FROM command. |
| tuples_processed | bigint | Number of tuples already processed. |
| tuples_excluded | bigint | Number of tuples not processed because they were excluded. |
Pg_stat_replication_slots
This view outputs the state of the logical replication slot. To reset the contents of the view, run the pg_stat_reset_replication_slot function.
PDF page 19
| Column name | Data type | Description |
|---|---|---|
| slot_name | text | Identifier for the replication slot. |
| spill_txns | bigint | Number of transactions spilled to disk. |
| spill_count | bigint | Number of times transactions were spilled to disk. |
| spill_bytes | bigint | Amount of decoded transaction data spilled to disk. |
| stream_txns | bigint | Number of in-progress transactions streamed. |
| stream_count | bigint | Number of times in-progress transactions. |
| stream_bytes | bigint | Amount of decoded in-progress transaction data streamed. |
| total_txns | bigint | Number of decoded transactions. |
| total_bytes | bigint | Amount of decoded transactions data. |
| stats_reset | timestamp with time zone | timestamp with Time at which these statistics were last reset |
Pg_stat_wal
Only one tuple of WAL output status is output to the pg_stat_wal view. The value of this view can be reset by pg_stat_reset_shared function with ‘wal’ specified. The values of the wal_write_time and wal_sync_time columns are output only when the track_wal_io_timing parameter to ‘on’.
PDF page 20
| Column name | Data type | Description |
|---|---|---|
| wal_records | bigint | Total number of WAL records. |
| wal_fpi | bigint | Total number of WAL full page images. |
| wal_bytes | numeric | Total amount of WAL generated. |
| wal_buffers_full | bigint | Number of times WAL data was written to disk because WAL buffers became full |
| wal_write | bigint | Number of times WAL buffers were written. |
| wal_sync | bigint | Number of times WAL files were synced to disk. |
| wal_write_time | double precision | Total amount of time spent writing WAL buffers |
| wal_sync_time | double precision | Total amount of time spent syncing WAL files. |
| stats_reset | timestamp with time zone | with Time at which these statistics were last reset. |
3.1.2 Logical Replication
The following features have been added to Logical Replication.
Logical Streaming Replication
Traditional logical replication transfers updates to the subscription instance on every transaction commit. PostgreSQL 14 offers a logical streaming replication feature that transfers data without waiting for the transaction to be committed. For logical streaming replication, set the streaming
PDF page 21
attribute to ‘on’ when creating or modifying SUBSCRIPTION. The default value for the STREAMING attribute is ‘off’.
Binary transfer
Traditional logical replication has converted data into text and transfers it. Binary transfer is possible by setting the attribute binary of SUBSCRIPTION to ‘on’. This can be expected to reduce the amount of network transfer. If no attribute is specified, it will be transferred in text format as before.
PDF page 22
Separation of initial synchronization and differential update
Data initial synchronization and update information transactions have been separated. This eliminates the need to start over from the initial data synchronization when an error occurs. An additional temporary logical replication slot is required when migrating initial data. The name of this replication slot is “pg_%u_sync_%u_%llu” (SUBSCRIPTION oid, table relid, System ID).
Wait Events
The following wait events can now be confirmed.
| Wait Event name | Description |
|---|---|
| LogicalChangesRead | Waiting for reading from a logical change file. |
| LogicalChangesWrite | Waiting for writing to the logical change file. |
| LogicalSubxactRead | Waiting for a read from a logical sub-transaction file. |
| LogicalSubxactWrite | Waiting to write to a logical sub-transaction file. |
Add Messages
The output plugin accepts a new parameter ‘Messages’ that controls if logical decoding messages are written into the replication stream.
3.1.3 Parallel Query
SELECT part of the REFRESH MATERIALIZED VIEW statement can now be executed in parallel. The example below is a log of the auto_explain module when the REFRESH MATERIALIZED VIEW statement is executed.
PDF page 23
3.1.4 LZ4 compression of TOAST columns
It is now possible to specify LZ4 as the compression method for TOAST column data. In order to perform LZ4 compression, PostgreSQL with –with-lz4 specified in the option of the ‘configure’ command is required. To specify the compression method for TOAST columns in the CREATE TABLE statement, specify pglz or lz4 in the COMPRESSION clause of the column attribute. The default value is determined by default_toast_compression. In the ALTER TABLE statement (or ALTER MATERIALIZED VIEW statement), the SET COMPRESSION clause can be specified in the column definition change syntax. Changing the compression method with the ALTER TABLE statement does not change the existing tuple.
PDF page 24
3.1.5 Execution Plan
The following enhancements have been implemented to the SQL statement execution plan creation feature.
Asynchronous execution
Asynchronous processing can now be executed in ForeignScan processing. Improve performance by running ForeignScan in parallel when accessing data on remote servers. To use this feature, set the async_capable option to ‘on’ in the postgres_fdw module (default value is ‘off’).
PDF page 25
Memoize
The new executor node type named Memoize has been added. The planner can include this node type in the plan to have the executor cache the results from inside the parameterized nested loop join. The use of this execution plan can be controlled by the parameter enable_memoize. The default value is ‘on’. Currently, this execution plan is considered for regular joins and LATERAL type joins.
PDF page 26
3.1.6 Extended Statistics
It is now possible to define extended statistics on expressions. The pg_stats_ext_exprs system view has been added to reference extended statistics with expressions.
3.1.7 Data types
The following data types have been added / extended.
Maximum / minimum value of numeric data type
Infinity and -Infinity, which indicate the maximum and minimum values, can now be specified for numeric and float types. The value obtained by dividing a non-zero floating point number by the Infinity value, or the return value of zero when -Infinity is specified for the exp function and power function.
PDF page 27
Multirange type
A data type has been provided that indicates multiple ranges that do not overlap. The specific data types are as follows.
| Data type name | Description |
|---|---|
| datemultirange | Date type range |
| int4multirange | Int type range |
| int8multirange | Bigint type range |
| nummultirange | Numeric type range |
| tsmultirange | Timestamp type range |
| tstzmultirange | Timestamp with time zone type range |
| anymultirange | Multi-range pseudo data type |
| anycompatiblemutirange | Any pseudo-type multiple range type |
The following is an example of range specification by bigint type.
PDF page 28
Jsonb type
The access method by subscript for jsonb type has been enhanced.
PDF page 29
Pg_lsn type
It is now possible to perform addition / subtraction calculations using the numeric type for values of the pg_lsn type.
Point type
The operators («|, »|) that get strictly below/above can now be used for point types.
3.1.8 BRIN indexes
The following operator classes are now available for BRIN indexes.
Bloom Filter
The operator classes “{data type}_bloom_ops” that use Bloom filters have been added. The following attributes can be specified for this operator class.
| Attribute name | Description |
|---|---|
| n_distinct_per_range | Specifies the estimated number of non-null values in the block range. The default value is -0.1. |
| false_positive_rate | Specifies the desired false positive rate used by the index. The default value is 0.01. |
PDF page 30
Min/Max-Multi Index
The operator classes “{data type}_minmax_multi_ops” have been added to store multiple minimum and maximum values. The following attributes can be specified for this operator class.
| Attribute name | Description |
|---|---|
| values_per_range | Specifies the maximum number of values to be stored by the index. The default value is 32, and values from 8 to 32 can be specified. |
3.1.9 Wait Events
The following wait events have been added.
| Wait Event name | Type | Description |
|---|---|---|
| AppendReady | IPC | Waiting for subplan node preparation. |
| BaseBackupRead | IO | Waiting for base backup file to be read. |
| BufferIO | IPC | Waiting for buffer I/O to complete. |
| BufFileTruncate | IO | Waiting for buffer file truncation. |
| LogicalChangesRead | IO | Waiting to read the logical change file. |
| LogicalChangesWrite | IO | Waiting to write a logical change file. |
| LogicalSubxactRead | IO | Waiting to load a logical subtransaction. |
| LogicalSubxactWrite | IO | Waiting for a logical subtransaction to write. |
| WalReceiverExit | IPC | Waiting for the WAL receiver process to finish. |
The following wait events have been retyped.
| Wait Event name | Before | After | Note |
|---|---|---|---|
| WalReceiverWaitStart | Client | IPC |
3.1.10 Stored Procedure
The following functions have been added.
PDF page 31
SPI_execute_extended
This API replaces the deprecated SPI_execute_plan_with_paramlist. It is possible to specify the reowner used to fix the execution plan. Syntax
SPI_cursor_parse_open
Set up a cursor using a query string and parameters. Syntax
SPI_scroll_cursor_fetch
Fetch some rows from a cursor Syntax
3.1.11 Pg_hba.conf file
By adding a backslash () at the end of a line, a single setting can now be described across multiple lines. The backslash must be the last character on the line.
PDF page 32
3.1.12 LIBPQ library
The following extensions have been implemented in the libpq library.
Connection string target_session_attrs
The following values have been added to the settings of the target_session_attrs parameter.
| Value | Description |
|---|---|
| read-only | The destination database cannot be updated. The opposite of read-write. |
| primary | Connect to the primary instance of streaming replication. |
| standby | Connect to a standby instance of streaming replication. |
| prefer-standby | Connect if a standby instance exists. If the standby instance does not exist, connect to the primary instance. |
Connection string sslcrldir
It is now possible to set the sslcrldir to specify the CRL storage directory for SSL connections. It can also be specified by the environment variable PGSSLCRLDIR.
Connection string sslsni
Configure Server Name Indication (SNI) for SSL connections. It can also be specified by the environment variable PGSSLSNI.
Pipeline mode
The libpq pipeline mode allows applications to avoid FE/BE protocol synchronization messages implicitly included in the old libpq API after each query. The following functions have been added.
| Function name | Description |
|---|---|
| PQpipelineStatus | Returns the status of the current pipeline mode. |
| PQenterPipelineMode | Enter pipeline mode. |
| PQexitPipelineMode | Exit pipeline mode. |
| PQpipelineSync | Request pipeline synchronization. |
Debug log
The PQsetTraceFlags function has been added.
PDF page 33
Sync message
The PQsendFlushRequest function has been added.
3.1.13 ECPG
DECLARE STATEMENT statement can now be specified for ECPG.
3.1.14 Roles
The following roles have been added.
Pg_database_owner
The pg_database_owner role has been added. Members of this role implicitly consist of the database owner. It is usually expected to be used in a template database.
Pg_read_all_data / pg_write_all_data
Added pg_read_all_data role, which allows reading all objects in the database, and pg_write_all_data role, which allows writing.
PDF page 34
3.1.15 Logfile
Additional information is now output to the log file.
Log_autovacuum_min_duration
Detailed information for each index is now output to the automatic VACUUM log (log_autovacuum_min_duration).
Log_connection
Additional information about authentication is output to the connection log (log_connection).
PDF page 35
3.1.16 Process name
The information is appended to some process names in the instance.
WAL Receiver
The status is now output to the process name of the wal receiver process.
WAL sender
The replication command name is now output to the process name of the WAL sender process for logical replication.
3.1.17 Regular Expression
The complement-class escapes \D, \S, \W are now allowed within bracket expressions. Also, ‘word’ has been added as a character class. This is the equivalent of \w.
PDF page 36
3.1.18 Text search
The languages for text search have been increased. The following languages have been added to PostgreSQL 14.
| Language name | Description |
|---|---|
| armenian | Armenian language |
| basque | Basque language |
| catalan | Catalan language |
| hindi | Hindi language |
| serbian | Serbian language |
| yiddish | Yiddish language |
3.1.19 Test module
The PL/Sample module, which can be used as a template for procedure languages, has been added.
PDF page 37
3.1.20 Maximum password length
The maximum length limit for password strings used for client authentication has been removed.
3.1.21 LLVM
Now supports LLVM 12.