PostgreSQL 10 was released. We have been waiting for new features to appear. My colleagues tested the new version in the spring and sent bug reports: one , two . And I was very pleased with the update and prepared the translation of the Release Notes into Russian. Let's discuss.
E.1.1. Review (TLDR)
E.1.2. Migration to version 10
E.1.3. Changes
E.1.3.1. Server
E.1.3.1.1. Parallel requests
E.1.3.1.2. Indices
E.1.3.1.3. Locks
E.1.3.1.4. Optimizer
E.1.3.1.5. Overall performance
E.1.3.1.6. Monitoring
E.1.3.1.6.1. Logging
E.1.3.1.6.2. pg_stat_activity
E.1.3.1.7. Authentication
E.1.3.1.8. Server configuration
E.1.3.1.9. Reliability
E.1.3.1.9.1. Proactive Write Log (WAL)
E.1.3.2. Replication and recovery
E.1.3.3. Requests
E.1.3.4. Auxiliary commands
E.1.3.5. Data types
E.1.3.6. Functions
E.1.3.7. Server languages
E.1.3.7.1. PL / Tcl
E.1.3.8. Client Interfaces
E.1.3.9. Client applications
E.1.3.9.1. psql
E.1.3.9.2. pgbench
E.1.3.10. Server applications
E.1.3.10.1. pg_dump, pg_dumpall, pg_restore
E.1.3.10.2. pg_basebackup
E.1.3.10.3. pg_ctl
E.1.3.11. Source
E.1.3.12. Additional modules
Major improvements in PostgreSQL 10:
All of the above is described in detail below.
To upgrade from any previous versions, you must dump / restore using pg_dumpall , or use pg_upgrade .
Version 10 contains a number of changes that may affect compatibility with previous releases. Here are the changes:
pg_xlog
log pg_xlog
to pg_wal
and rename the pg_clog
transaction pg_clog
to pg_xact
(Michael Paquier).pg_switch_xlog()
will become pg_switch_wal()
, pg_receivexlog
will become pg_receivewal
; --xlogdir
will become --waldir
. This is done for consistency with the renaming of pg_xlog
; in general, the term “xlog” will not be used by the user in the future.lsn
instead of location
(David Rowley). Previously, there were contradictions when using two terms.SELECT
list (Andres Freund) has been changed. Set-returning functions (SRFs) are now computed before calculating scalar expressions in the SELECT
list, as if they were placed in a LATERAL FROM
expression. This gives more robust semantics when using multiple SRFs. If they return a different number of rows, the shorter results will be extended to the longest by adding NULL values. Previously, the smallest common factor of the sizes of the SRF results was found, and they were repeated cyclically. Also, the SRF call is now denied with CASE
and COALESCE
constructs. For more information, see Section 37.4.8 .ALTER TABLE ... ADD PRIMARY KEY
sets the attribute of the column NOT NULL
, this change also applies to inherited child tables (Michael Paquier).BEFORE STATEMENT
- or AFTER STATEMENT
triggers were called more than once. Also, if there were statement-triggers on a table affected by a foreign key constraint (such as ON DELETE CASCADE
), they could be called more than once for an external SQL statement. This was against the standard, so it was changed.pg_sequence
(Peter Eisentraut) system catalog. The new table contains fields that can be modified using the nextval()
function, that is, last_value
, log_cnt
and is_called
. The remaining properties of the sequences, such as the initial value and increment, are stored in the corresponding row of the pg_sequence
directory. ALTER SEQUENCE
now fully transactional, implying locking a sequence to commit. The functions nextval()
and setval()
remain non-transactional.pg_sequence
. The new system representation pg_sequences
can also be used for this purpose; it provides column names that are more compatible with existing code.pg_basebackup
WAL
streaming required to restore the default backup (Magnus Hagander). This changes the default value of the -X/--xlog-method
pg_basebackup
in stream
. The value of none is added to reproduce the old behavior. The -x option of the pg_basebackup
command pg_basebackup
been removed (use -X fetch
instead).replication
keyword in a database column. From this release, logical replication uses the usual occurrence of the name of the database or the keyword all
. Physical replication continues to use the replication
keyword. Since logical replication is a novelty of this release, the change affects only users of third-party plug-ins for replication.pg_ctl
actions are pending default (Peter Eisentraut). Up to this point, some pg_ctl
actions did not wait for completion and required the -w
option to be used for this.log_directory
from pg_log
to log
(Andreas Karlsson).ssl_dh_params_file
configuration option has been ssl_dh_params_file
to specify a file with modified Diffie-Hellman parameters (Heikki Linnakangas). This removes the hard-case undocumented file name dh1024.pem
. Note that dh1024.pem
no longer checked by default; You must set the option value to use your own Diffie-Hellman parameters.password_encryption
no longer supports off
or plain
values. The UNENCRYPTED
option UNENCRYPTED
no longer supported in the CREATE/ALTER USER ... PASSWORD
command. Similarly, the option --unencrypted
was removed from the --unencrypted
command. Unencrypted passwords when migrating from older versions will be kept encrypted in this release. The default value for the password_encryption
parameter is still md5
.min_parallel_relation_size
, which turned out to be too general.shared_preload_libraries
parameter and others like it is not reduced to lower case, unless it is in quotes (QL Zhuo). These settings are a list of file names, but up to this point were treated as SQL identifiers, which are processed according to other rules.sql_inheritance
(Robert Haas). Changing the default value for this parameter meant that queries to the parent tables did not include data from the child tables. The SQL standard requires that they be included; however, this was the default with PostgreSQL 7.1.[[col1, col2], [col1, col2]]
; but now it is interpreted as a two-dimensional array. Compound types in arrays should now be written as Python tuples, not lists, to eliminate ambiguity; This means that you should write like this: [(col1, col2), (col1, col2)]
.--disable-integer-datetimes
. Floating point timestamps have some advantages, but were not used by default with PostgreSQL 8.3.contrib/tsearch2
(Robert Haas) module. This module provided compatibility with the full-text version of the pre-8.3 version.createlang
and droplang
command line droplang
(Peter Eisentraut). They are deprecated in PostgreSQL 9.1. Use the CREATE EXTENSION
and DROP EXTENSION
commands instead.Below is detailed information about the changes between PostgreSQL 10 and the previous major release.
INET
and CIDR
SP-GiST indexes (Emre Hasegeli).CREATE INDEX
option enables the automatic summarization of the previous BRIN page range when a new page range is created.brin_summarize_range()
updates the BRIN-index sumrization for the specified range and brin_desummarize_range()
to remove it. This is useful for updating the range summarization, which is now smaller due to UPDATEs and DELETEs.ALTER TYPE ... ADD VALUE
command in a transaction block if this enumeration was not created in it. Now only links to uncommitted values of transfers from other transactions are prohibited.effective_io_concurrency
table can be done with a more lightweight lock.max_pred_locks_per_relation
and max_pred_locks_per_page
.CREATE STATISTICS
, ALTER STATISTICS
and DROP STATISTICS
commands. This feature is useful when evaluating the memory usage of a query and when combining statistics from different columns.numeric
type arithmetic, including some variants of SUM()
, AVG()
and STDDEV()
(Heikki Linnakangas).macaddr
data macaddr
(Brandur Leach) has been increased.EXPLAIN
command (Ashutosh Bapat). By default, the planning and execution time was displayed by the EXPLAIN ANALYZE
command and was not displayed in other cases. The new option command EXPLAIN SUMMARY
allows you to explicitly control the display.pg_monitor
, pg_read_all_settings
, pg_read_all_stats
and pg_stat_scan_tables
make it easier to configure privileges.REFRESH MATERIALIZED VIEW
(Jim Mlodgenski).log_line_prefix
parameter to include a timestamp with milliseconds and PID in each postmaster output line (Christoph Berg). In the past, the prefix was empty.DEBUG1
.pg_stat_activity
(Michael Paquier, Robert Haas, Rushabh Lathia). This change allows you to report multiple low-level locks, including latch waits, read / write fsync files, client read / write, and synchronous replication.pg_stat_activity
(Kuntal Ghosh, Michael Paquier). This simplifies monitoring. New column backend_type
identifies the type of process.pg_stat_activity.wait_event_type LWLockTranche
and LWLockNamed
to LWLock
(Robert Haas). This makes the output more consistent.md5
) transfer and storage method.boolean
to enum
(Michael Paquier). This was necessary to support additional password hashing options.pg_hba_file_rules
to display pg_hba.conf
content (Haribabu Kommi). The contents of the file are shown, but not the current active settings.pg_ctl reload
, SELECT pg_reload_conf()
or sending a SIGHUP
signal. However, reloading the SSL configuration does not work if the SSL server key requires a password, since it is not possible to prompt for a password. In this case, the initial configuration will be applied.synchronous_standby_names
. synchronous_standby_names ANY
, . .pg_hba.conf
(Michael Paquier). pg_hba.conf
. , pg_basebackup
.write_lag
, flush_lag
replay_lag
.recovery.conf
(Michael Paquier). XID'.pg_stop_backup()
, WAL' (David Steele). pg_stop_backup()
.XMLTABLE
, XML
- (Pavel Stehule, Álvaro Herrera).UPDATE ... SET (column_list) = row_constructor
(Tom Lane). row_constructor
ROW
; . table_name.*
row_constructor
, row_constructors
.U+7FF
(Tom Lane). , , [[:alpha:]]
.AFTER
- , (Kevin Grittner, Thomas Munro). , .REFERENCES
- (Tom Lane). REFERENCES
- . , - SQL. ( ) , REFERENCES
- .ALTER DEFAULT PRIVILEGES
.CREATE SEQUENCE AS
, (Peter Eisentraut). , .COPY view FROM source
INSTEAD INSERT
- (Haribabu Kommi). COPY
.DROP FUNCTION
, . SQL.DROP
(Peter Eisentraut).IF NOT EXISTS
CREATE SERVER
, CREATE USER MAPPING
CREATE COLLATION
(Anastasia Lubennikova, Peter Eisentraut).VACUUM VERBOSE
xmin (Masahiko Sawada, Simon Riggs). log_autovacuum_min_duration .VACUUM
- (Claudio Freire, Álvaro Herrera).JSON
JSONB
(Dmitry Dolgov). ts_headline()
to_tsvector()
.macaddr
).SERIAL
, SQL.anyarray
) to_json()
to_jsonb()
(Andrew Dunstan). , anyarray
( , pg_stats
) JSON
-, .money
int8 (Peter Eisentraut). int8
- float8
money
-- float8
. . , money
int8
, , .money
(Peter Eisentraut).regexp_match()
(Emre Hasegeli). regexp_matches()
, , , .jsonb
, (Magnus Hagander).json_populate_record()
JSON (Nikita Glukhov). SQL JSON, JSON. , array_in()
record_in()
JSON-, , .txid_current_ifassigned()
NULL
, (Craig Ringer). txid_current()
, , . .txid_status()
(Craig Ringer). , , .make_date()
, . e. (Álvaro Herrera).to_timestamp()
to_date()
(Artur Zakirov). , to_date('2009-06-40','YYYY-MM-DD')
2009-07-10
. .cursor()
execute()
PL/Python (Peter Eisentraut). - .GET DIAGNOSTICS
PL/pgSQL (Tom Lane). .target_session_attrs
.PQencryptPasswordConn()
, (Michael Paquier, Heikki Linnakangas). MD5
- PQencryptPassword() . SCRAM-SHA-256-
.\if
, \elif
, \else
\endif
. , .\gx
( \g
) ( \x
) (Christoph Berg).\set
, . , \set
on
; , . \unset
, , . , , psql.\d
( ) \dD
( ), , null, (Peter Eisentraut)\d
(Daniel Gustafsson). stderr, stdout, .--log-prefix
(Masahiko Sawada).-M
, (Tom Lane).-Z/--compress
(Michael Paquier).--endpos
(Craig Ringer). --startpos
.--nosync
--no-clean
--no-sync
(Vik Fearing, Peter Eisentraut). .-N/--exclude-schema
.--no-blobs
pg_dump (Guillaume Lelarge). .--no-role-passwords
, (Robins Tharakan, Simon Riggs). pg_dumpall , .fsync()
, pg_dump pg_dumpall (Michael Paquier). , .. . --no-sync
.--no-sync
fsync (Michael Paquier).--wait
) no-wait ( --no-wait
) (Vik Fearing).--options
) (Peter Eisentraut).pg_ctl start --wait
postmaster.pid
, (Tom Lane). postmaster , postmaster.pid, pg_ctl , , . , , .start
promote
1, 0, . stop
.--with-icu
. .DLLEXPORT
Windows (Laurenz Albe). extern
, DLLEXPORT
.SPI SPI_push()
, SPI_pop()
, SPI_push_conditional()
, SPI_pop_conditional()
SPI_restore_connection()
(Tom Lane). . , , .SPI_palloc()
SPI-; palloc()
, . .clock_gettime()
, , (Tom Lane). gettimeofday()
, clock_gettime()
.--disable-strong-random
. pgcrypto
, .WaitLatchOrSocket()
Windows (Andres Freund).tupconvert.c
, OID (Ashutosh Bapat, Tom Lane). OID , Datum, , , OID.OID
postgres_fdw (Etsuro Fujita). OID
.UUID
(Paul Jungwirth).$N
?
pg_stat_statements (Lukas Fittl).infinite-
NaN
-.pgstathashindex()
- (Ashutosh Sharma).GRANT
pgstattuple (Stephen Frost). .page_checksum()
, (Tomas Vondra).bt_page_items()
(Tomas Vondra)..
— . . , WAL.
. , , .
.
: .
? ?
Source: https://habr.com/ru/post/339520/
All Articles