Full list of changes: https://why-upgrade.depesz.com/show?from=9.5.21&to=11.7
- Parallel queries
- Declarative partitioning
- Covering indexes
- Improved performance
Release notes: https://www.postgresql.org/docs/9.6/release.html
- Parallel execution of sequential scans, joins and aggregates
- Substantial performance improvements
- Improved observability
pg_stat_activity
now includes information about what a process is waiting for.- Add
pg_stat_progress_vacuum
system view to provide progress reporting for VACUUM operations - Add
pg_control_system()
,pg_control_checkpoint()
,pg_control_recovery()
, andpg_control_init()
functions to expose fields of pg_control to SQL - Add
pg_config
system view - Add
pg_stat_wal_receiver
system view to provide information about the state of a hot-standby server's WAL receiver process - Add
pg_blocking_pids()
function to reliably identify which sessions block which others
-
Remove the long-deprecated
CREATEUSER/NOCREATEUSER
options fromCREATE ROLE
and allied commands -
psql
's-c
option no longer implies--no-psqlrc
Write
--no-psqlrc
(or its abbreviation-X
) explicitly to obtain the old behavior. Scripts so modified will still work with old versions of psql.
-
Allow sessions to be terminated automatically if they are in idle-in-transaction state for too long
This behavior is controlled by the new configuration parameter
[idle_in_transaction_session_timeout](https://www.postgresql.org/docs/9.6/runtime-config-client.html#GUC-IDLE-IN-TRANSACTION-SESSION-TIMEOUT)
. It can be useful to prevent forgotten transactions from holding locks or preventing vacuum cleanup for too long.TODO: enable
-
Merge the
archive
andhot_standby
values of the[wal_level](https://www.postgresql.org/docs/9.6/runtime-config-wal.html#GUC-WAL-LEVEL)
configuration parameter into a single new valuereplica
TODO: Change in config
-
Allow use of an index-only scan on a partial index when the index's WHERE clause references columns that are not indexed.
For example, an index defined by
CREATE INDEX tidx_partial ON t(b) WHERE a > 0
can now be used for an index-only scan by a query that specifiesWHERE a > 0
and does not otherwise use a. Previously this was disallowed because a is not listed as an index column. -
Improve aggregate-function performance by sharing calculations across multiple aggregates if they have the same arguments and transition functions.
For example,
SELECT AVG(x), VARIANCE(x) FROM tab
can use a single per-row computation for both aggregates.
-
Allow synchronous replication to support multiple simultaneous synchronous standby servers, not just one.
-
Add a
--slot
option topg_basebackup
.This lets
pg_basebackup
use a replication slot defined for WAL streaming. After the base backup completes, selecting the same slot for regular streaming replication allows seamless startup of the new standby server.
- Allow omitting one or both boundaries in an array slice specifier, e.g.
array_col[3:]
- Implement look-behind constraints in regular expressions
-
Add
jsonb_insert()
function to insert a new element into ajsonb
array, or a not-previously-existing key into ajsonb
object -
Add variadic functions
num_nulls()
andnum_nonnulls()
that count the number of their arguments that are null or non-nullAn example usage is
CHECK(num_nonnulls(a,b,c) = 1)
which asserts that exactly one ofa,b,c
is notNULL
. These functions can also be used to count the number of null or nonnull elements in an array. -
Add
pg_size_bytes()
function to convert human-readable size strings to numbers
-
Support multiple
-c
and-f
command-line options.The specified operations are carried out in the order in which the options are given, and then psql terminates.
-
Add configuration parameter
auto_explain.sample_rate
to allowcontrib/auto_explain
to capture just a configurable fraction of all queries.This allows reduction of overhead for heavy query traffic, while still getting useful information on average.
-
Add support for "word similarity" to contrib/pg_trgm
These functions and operators measure the similarity between one string and the most similar single word of another string.
-
Add contrib/pg_visibility module to allow examining table visibility maps
Release notes: https://www.postgresql.org/docs/10/release.html
- Logical replication publish/subscribe
- Declarative table partitioning
- Improved performance
- Improved monitoring and control
-
Change the implementation of set-returning functions appearing in a query's SELECT list
Set-returning functions are now evaluated before evaluation of scalar expressions in the SELECT list, much as though they had been placed in a LATERAL FROM-clause item. This allows saner semantics for cases where multiple set-returning functions are present. If they return different numbers of rows, the shorter results are extended to match the longest result by adding nulls. Previously the results were cycled until they all terminated at the same time, producing a number of rows equal to the least common multiple of the functions' periods. In addition, set-returning functions are now disallowed within CASE and COALESCE constructs. For more information see Section 37.4.8.
-
Rename write-ahead log directory
pg_xlog
topg_wal
, and rename transaction status directorypg_clog
topg_xact
-
Rename SQL functions, tools, and options that reference “xlog” to “wal”
For example,
pg_switch_xlog()
becomespg_switch_wal()
,pg_receivexlog
becomespg_receivewal
, and--xlogdir
becomes--waldir
. This is for consistency with the change of thepg_xlog
directory name; in general, the “xlog” terminology is no longer used in any user-facing places. -
Rename WAL-related functions and views to use
lsn
instead oflocation
-
Move sequences' metadata fields into a new
pg_sequence
system catalogTODO: Monitor auto-increment integer primary keys
- Enable parallelism by default by changing the default setting of
max_parallel_workers_per_gather
to 2
-
Add multi-column optimizer statistics to compute the correlation ratio and number of distinct values.
New commands are
CREATE STATISTICS
,ALTER STATISTICS
, andDROP STATISTICS
. This feature is helpful in estimating query memory usage and when combining the statistics from individual columns.
-
Add default monitoring roles
New roles
pg_monitor
,pg_read_all_settings
,pg_read_all_stats
, andpg_stat_scan_tables
allow simplified permission configuration.See: https://www.postgresql.org/docs/11/default-roles.html
TODO: Datadog agent privileges
-
Add functions to return the log and WAL directory contents
The new functions are
pg_ls_logdir()
andpg_ls_waldir()
and can be executed by non-superusers with the proper permissions. -
Add function
pg_current_logfile()
to read logging collector's current stderr and csvlog output file names
-
New configuration defaults:
wal_level = replica
max_wal_senders = 10
max_replication_slots = 10
hot_standby = on
-
Add columns to
pg_stat_replication
to report replication delay timesThe new columns are
write_lag
,flush_lag
, andreplay_lag
.
-
Add conditional branch support to psql
This feature adds psql meta-commands
\if
,\elif
,\else
, and\endif
. This is primarily helpful for scripting.
Release notes: https://www.postgresql.org/docs/11/release-11.html
- SQL stored procedures that support embedded transactions
- Optional Just-in-Time (JIT) compilation for some SQL code, speeding evaluation of expressions
- Covering indexes can now be created, using the
INCLUDE
clause ofCREATE INDEX
- Ability to avoid a table rewrite for
ALTER TABLE ... ADD COLUMN
with a non-null column default - Allow
btree_gin
to indexbool
,bpchar
,name
anduuid
data types
-
Allow aggregate functions on partitioned tables to be evaluated separately for each partition, subsequently merging the results.
TODO: This feature is disabled by default but can be enabled by changing
enable_partitionwise_aggregate
- Add casts from JSONB scalars to numeric and boolean data types
- Add psql command
\gdesc
to display the names and types of the columns in a query result