3 Architecture
PDF page 13
3.1.1 Modified catalogs
The following catalogs have been changed.
| Catalog name | Description |
|---|---|
| pg_stat_progress_cluster | Traces the execution status of CLUSTER. |
| pg_stat_progress_create_index | Traces the execution status of CREATE INEDX. |
| pg_stat_gssapi | Showing information about GSSAPI usage. |
| pg_statistic_ext_data | Holds data for extended planner statistic |
| Catalog name | Description |
|---|---|
| column_column_usage | Column information that depends on a specific column (stores information on a table with generated columns). |
| Catalog name | Added column | Data type | Description |
|---|---|---|---|
| *1 | oid | oid | Change attribute to regular column. |
| pg_attribute | attgenerated | char | ’s’ for generated column. |
| pg_collation | collisdeterministic | boolean | Is the collation deterministic? |
| pg_statistic | stacol[1-5] | oid | Collation information. |
| pg_stat_database | checksum_failures | bigint | Number of blocks for which a checksum error was detected. |
| checksum_last_failure | timestamp with time zone | Last timestamp for which checksum error was detected. | |
| pg_stat_replication | reply_time | timestamp with time zone | Message time from standby instance. |
| pg_stat_ssl | client_serial | numeric | Client certificate serial number. |
| issuer_dn | text | Client certificate issuer DN. |
PDF page 14
*1 There are many corresponding catalogs.
| Catalog name | Deleted column | Description |
|---|---|---|
| pg_attrdef | adsrc | A human-readable representation of the default value. |
| pg_class | relhasoids | Whether the table is WITH OIDS specified. |
| pg_constraint | consrc | A human-readable representation of the expression. |
| pg_statistic_ext | stxndistinct | Move to pg_statistics_ext_data |
| stxdependencies | Move to pg_statistics_ext_data |
| Catalog name | Modified Column | Description |
|---|---|---|
| pg_shadow | valuntil | Data type changed to timestamp with time zone. |
| pg_stat_ssl | client_dn | Column name changed from ’lientdn'. |
Among the modified system catalogs, the details of the major catalogs are described below.
Pg_stat_progress_cluster catalog
The pg_stat_progress_cluster catalog can trace the execution status of CLUSTER statements or VACUUM FULL statements.
| Column name | Data type | Description |
|---|---|---|
| pid | integer | Process ID of backend. |
| datid | oid | OID of the database to which this backend is connected. |
| datname | name | Name of the database to which this backend is connected. |
| relid | oid | OID of the table being clustered. |
| command | text | The command that is running. |
| phase | text | Current processing phase. |
| cluster_index_relid | oid | OID of the index being used. |
| heap_tuples_scanned | bigint | Number of heap tuples scanned. |
| heap_tuples_written | bigint | Number of heap tuples written. |
| heap_blks_total | bigint | Total number of heap blocks in the table. |
| heap_blks_scanned | bigint | Number of heap blocks scanned. |
| index_rebuild_count | bigint | Number of indexes rebuilt. |
PDF page 15
Pg_stat_progress_create_index catalog
The pg_stat_progress_create_index catalog can trace the execution status of CREATE INDEX statement. The status is also reflected when the REINDEX statement is executed.
| Column name | Data type | Description |
|---|---|---|
| pid | integer | Process ID of backend. |
| datid | oid | OID of the database to which this backend is connected. |
| datname | name | Name of the database to which this backend is connected. |
| relid | oid | OID of the table on which the index is being created. |
| index_relid | oid | OID of the index. |
| command | text | Executed SQL statement name. |
| phase | text | Current processing phase of index creation. |
| lockers_total | bigint | Total number of lockers to wait for. |
| lockers_done | bigint | Total number of lockers already waited for. |
| current_locker_pid | bigint | Process ID of the locker currently being waited for. |
| blocks_total | bigint | Total number of the blocks to be processed. |
| blocks_done | bigint | Total number of the blocks already processed. |
| tuples_total | bigint | Total number of tuples to be processed. |
| tuples_done | bigint | Number of tuples already processed. |
| partitions_total | bigint | Total number of partitions. |
| partitions_done | bigint | Number of partitions on which the index has been completed. |
PDF page 16
Pg_stat_replication catalog
The reply_time column has been added to the pg_stat_replication catalog. This column stores the sending time of the last reply message received from the standby instance. This column can only be displayed by the SUPERUSER attribute or the holder of the pg_monitor role.
PDF page 17
Pg_indexes catalog
The pg_indexes catalog now includes partitioned indexes. Specifically, the relkind column in the pg_class catalog now includes an index of ‘I’.
Pg_stat_database catalog
The checksum_failures column and checksum_last_failure column in the pg_stat_database catalog are now updated when a block checksum error is detected. The value of checksum_failures column is updated each time when a checksum error is detected, so it does not indicate the actual number of blocks corrupted.
PDF page 18
Pg_stat_gssapi catalog
The pg_stat_gssapi view showing information about GSSAPI usage on this connection. It can be joined to pg_stat_activity or pg_stat_replication on the pid column to get more details about the connection.
| Column name | Data type | Description |
|---|---|---|
| pid | integer | Process ID of backend. |
| gss_authenticated | boolean | True if GSSAPI authentication was used. |
| principal | text | Principal used to authenticate this connection. |
| encrypted | boolean | True if GSSAPI encryption is in use. |
Pg_statistic_ext_data catalog
This catalog holds data for extended planner statistics defined in pg_statistic_ext.
PDF page 19
| Column name | Data type | Description |
|---|---|---|
| stxoid | oid | Reference of pg_statistic_ext catalog |
| stxdndistinct | pg_ndistinct | N-distinct counts |
| stxddependencies | pg_dependencies | Functional dependency statistics |
| stxdmcv | pg_mcv_list | MCV (most-common values) list statistics |
3.1.2 Abolition of recovery.conf file
The recovery.conf file used to build standby instances in a streaming replication environment, and for recovery from backup has been obsolete. Various settings in the recovery.conf file have been integrated into the postgresql.conf file. Some parameters have been changed.
| recovery.conf | postgresql.conf | Note |
|---|---|---|
| standby_modetrigger_file | promote_trigger_file | Discontinued. |
In case of recovery, create a recovery.signal file in the database cluster and start the instance. This file is deleted when the recovery process is complete. In a streaming replication environment, create a standby.signal file in the database cluster on slave instances. This file is deleted when promoted to primary. If the recovery.conf file exists in the database cluster, instance startup fails.
PDF page 20
3.1.3 Instance startup log
The version number is now output to the log at instance startup. If the parameter logging_collector is specified as “on”, it is output to the log file.
PDF page 21
3.1.4 Maximum number of connections
The number of connections for replication is now obtained using the max_wal_senders parameter without depending on the max_connections parameter. As a result of this modification, information of max_wal_senders has been added to the output of the pg_controldata command.
3.1.5 Parallel query enhancement
Parallel queries now work even if the transaction isolation level of the session is SERIALIZABLE. The following example uses the auto_explain module to output the execution plan of the SQL statement executed in the transaction of the SERIALIZABLE isolation level.
PDF page 22
PDF page 23
3.1.6 Jsonb type and GIN index
The “jsonb @@ jsonpath” and “jsonb @? jsonpath” operators have been added to the GIN index created for the jsonb type. The operator class of GIN index can be used either jsonb_ops or json_path_ops. The following is the execution plan of the SELECT statement described in the manual.
3.1.7 Wait Event
The following changes were made to the wait event output to the wait_event column of the pg_stat_activity catalog.
PDF page 24
| Wait event name | Description | Modify |
|---|---|---|
| BackendRandomLock | Waiting to generate a random number. | Deleted |
| GSSOpenServer | Waiting for connect to GSSAPI server. | Added |
| CheckpointDone | Waiting for a checkpoint to complete. | Added |
| CheckpointStart | Waiting for a checkpoint to start. | Added |
| Promote | Waiting for standby promotion. | Added |
| WALSync | Waiting for a WAL file to reach stable storage. | Added |
3.1.8 ECPG
The following features have been added to ECPG.
Bytea data type
The variable of type bytea is defined in the DECLARE SECTION and can be used for data input/output.
PDF page 25
PREPARE AS statement
It is now possible to write SQL statements directly by PREPARE AS statement.
3.1.9 Pluggable Storage Engine
The basic specifications for using multiple storage engines have been decided. The access method for the table specifies the TYPE TABLE clause in the CREATE ACCESS METHOD statement. Syntax
The default storage engine is specified by the default_table_access_method parameter. The default value for this parameter is “heap”. As a result of this modification, it has been added tuple to the pg_am catalog.
PDF page 26
Specify engine when creating table
To specify a storage engine for a table, specify the USING clause in the CREATE TABLE statement. It can also be specified with the CREATE TABLE AS SELECT statement or the CREATE MATERIALIZED VIEW statement.
Display table definition by psql command
When the “\d+ table_name” command is executed, the storage engine name of the table is output.
PDF page 27
Display of access method by psql command
Table access methods are also displayed with the \dA command. Previously, only the index access method was output.
PDF page 28
3.1.10 Pg_hba.conf file
The following new features have been added to the pg_hba.conf file.
New parameter of clientcert item
A new setting “verfy-full” can be specified for the clientcert parameter. This option also ensures that the certificate’s “cn” (common name) matches the username or proper mapping.
GSSAPI authentication encryption option
Generic Security Standard Application Programming Interface (GSSAPI) with encryption option is available for client authentication. An entry of hostgssenc / hostnogssenc can be specified in the pg_hba.conf file. In order to enable GSSAPI authentication, it is necessary to specify –with-gssapi as an option of “configure” command at installation.
3.1.11 Text search
Supported languages for text search increased. It was 16 languages in PostgreSQL 11 but has increased to 22 languages in PostgreSQL 12.
PDF page 29
PDF page 30
3.1.12 Libpq API
The following functions have been added to the C language interface to PostgreSQL.
PQresultMemorySize
“size_t PQresultMemorySize (const PGresult * res)” API has been added. This function returns the amount of memory allocated by PGresult. It can be used to manage application memory.
GetForeignDataWrapperExtended
“ForeignDataWrapper * GetForeignDataWrapperExtended (Oid fwdid, bits16 flags)” API has been added.
GetForeignServerExtended
“ForeignServer * GetForeignServerExtended (Oid fwdid, bits16 flags)” API has been added.
3.1.13 Transaction ID
The 64-bit transaction ID is available. API “GetTopFullTransactionId”, “GetTopFullTransactionIdIfAny”, “GetCurrentFullTransactionId” and “GetCurrentFullTransactionIdIfAny” are provided. However, the current heap does not use them.
3.1.14 Client environment variable
Environment variables PG_COLOR and PG_COLORS have been added. Specify whether to use the color of the diagnostic message in PG_COLOR. Possible values are always, auto or never. PG_COLORS is specified by combining the category of escape sequence and code with an equal sign (=). When specifying multiple categories, separate them with a colon (:).
| Category | Default value | Note |
|---|---|---|
| error | 01;31 | |
| warning | 01;35 | |
| locus | 01 |
PDF page 31
3.1.15 Client connection string
Tcp_user_timeout indicating TCP timeout has been added to the client connection string.