E.16. Release 9.5

Release date: 2016-01-07

E.16.1. Overview

Major enhancements in PostgreSQL 9.5 include:

The above items are explained in more detail in the sections below.

E.16.2. Migration to Version 9.5

A dump/restore using pg_dumpall, or use of pg_upgrade, is required for those wishing to migrate data from any previous release.

Version 9.5 contains a number of changes that may affect compatibility with previous releases. Observe the following incompatibilities:

E.16.3. Changes

Below you will find a detailed account of the changes between PostgreSQL 9.5 and the previous major release.

E.16.3.1. Server

E.16.3.1.1. Indexes

  • Add Block Range Indexes (BRIN) (Álvaro Herrera)

    BRIN indexes store only summary data (such as minimum and maximum values) for ranges of heap blocks. They are therefore very compact and cheap to update; but if the data is naturally clustered, they can still provide substantial speedup of searches.

  • Allow queries to perform accurate distance filtering of bounding-box-indexed objects (polygons, circles) using GiST indexes (Alexander Korotkov, Heikki Linnakangas)

    Previously, to exploit such an index a subquery had to be used to select a large number of rows ordered by bounding-box distance, and the result then had to be filtered further with a more accurate distance calculation.

  • Allow GiST indexes to perform index-only scans (Anastasia Lubennikova, Heikki Linnakangas, Andreas Karlsson)

  • Add configuration parameter gin_pending_list_limit to control the size of GIN pending lists (Fujii Masao)

    This value can also be set on a per-index basis as an index storage parameter. Previously the pending-list size was controlled by work_mem, which was awkward because appropriate values for work_mem are often much too large for this purpose.

  • Issue a warning during the creation of hash indexes because they are not crash-safe (Bruce Momjian)

E.16.3.1.2. General Performance

  • Improve the speed of sorting of varchar, text, and numeric fields via "abbreviated" keys (Peter Geoghegan, Andrew Gierth, Robert Haas)

  • Extend the infrastructure that allows sorting to be performed by inlined, non-SQL-callable comparison functions to cover CREATE INDEX, REINDEX, and CLUSTER (Peter Geoghegan)

  • Improve performance of hash joins (Tomas Vondra, Robert Haas)

  • Improve concurrency of shared buffer replacement (Robert Haas, Amit Kapila, Andres Freund)

  • Reduce the number of page locks and pins during index scans (Kevin Grittner)

    The primary benefit of this is to allow index vacuums to be blocked less often.

  • Make per-backend tracking of buffer pins more memory-efficient (Andres Freund)

  • Improve lock scalability (Andres Freund)

    This particularly addresses scalability problems when running on systems with multiple CPU sockets.

  • Allow the optimizer to remove unnecessary references to left-joined subqueries (David Rowley)

  • Allow pushdown of query restrictions into subqueries with window functions, where appropriate (David Rowley)

  • Allow a non-leakproof function to be pushed down into a security barrier view if the function does not receive any view output columns (Dean Rasheed)

  • Teach the planner to use statistics obtained from an expression index on a boolean-returning function, when a matching function call appears in WHERE (Tom Lane)

  • Make ANALYZE compute basic statistics (null fraction and average column width) even for columns whose data type lacks an equality function (Oleksandr Shulgin)

  • Speed up CRC (cyclic redundancy check) computations and switch to CRC-32C (Abhijit Menon-Sen, Heikki Linnakangas)

  • Improve bitmap index scan performance (Teodor Sigaev, Tom Lane)

  • Speed up CREATE INDEX by avoiding unnecessary memory copies (Robert Haas)

  • Increase the number of buffer mapping partitions (Amit Kapila, Andres Freund, Robert Haas)

    This improves performance for highly concurrent workloads.

E.16.3.1.3. Monitoring

  • Add per-table autovacuum logging control via new log_autovacuum_min_duration storage parameter (Michael Paquier)

  • Add new configuration parameter cluster_name (Thomas Munro)

    This string, typically set in postgresql.conf, allows clients to identify the cluster. This name also appears in the process title of all server processes, allowing for easier identification of processes belonging to the same cluster.

  • Prevent non-superusers from changing log_disconnections on connection startup (Fujii Masao)

E.16.3.1.4. SSL

  • Check "Subject Alternative Names" in SSL server certificates, if present (Alexey Klyukin)

    When they are present, this replaces checks against the certificate's "Common Name".

  • Add system view pg_stat_ssl to report SSL connection information (Magnus Hagander)

  • Add libpq functions to return SSL information in an implementation-independent way (Heikki Linnakangas)

    While PQgetssl() can still be used to call OpenSSL functions, it is now considered deprecated because future versions of libpq might support other SSL implementations. When possible, use the new functions PQsslAttribute(), PQsslAttributeNames(), and PQsslInUse() to obtain SSL information in an SSL-implementation-independent way.

  • Make libpq honor any OpenSSL thread callbacks (Jan Urbanski)

    Previously they were overwritten.

E.16.3.1.5. Server Settings

  • Replace configuration parameter checkpoint_segments with min_wal_size and max_wal_size (Heikki Linnakangas)

    This change allows the allocation of a large number of WAL files without keeping them after they are no longer needed. Therefore the default for max_wal_size has been set to 1GB, much larger than the old default for checkpoint_segments. Also note that standby servers perform restartpoints to try to limit their WAL space consumption to max_wal_size; previously they did not pay any attention to checkpoint_segments.

  • Control the Linux OOM killer via new environment variables PG_OOM_ADJUST_FILE and PG_OOM_ADJUST_VALUE (Gurjeet Singh)

    The previous OOM control infrastructure involved compile-time options LINUX_OOM_SCORE_ADJ and LINUX_OOM_ADJ, which are no longer supported. The new behavior is available in all builds.

  • Allow recording of transaction commit time stamps when configuration parameter track_commit_timestamp is enabled (Álvaro Herrera, Petr Jelínek)

    Time stamp information can be accessed using functions pg_xact_commit_timestamp() and pg_last_committed_xact().

  • Allow local_preload_libraries to be set by ALTER ROLE SET (Peter Eisentraut, Kyotaro Horiguchi)

  • Allow autovacuum workers to respond to configuration parameter changes during a run (Michael Paquier)

  • Make configuration parameter debug_assertions read-only (Andres Freund)

    This means that assertions can no longer be turned off if they were enabled at compile time, allowing for more efficient code optimization. This change also removes the postgres -A option.

  • Allow setting effective_io_concurrency on systems where it has no effect (Peter Eisentraut)

  • Add system view pg_file_settings to show the contents of the server's configuration files (Sawada Masahiko)

  • Add pending_restart to the system view pg_settings to indicate a change has been made but will not take effect until a database restart (Peter Eisentraut)

  • Allow ALTER SYSTEM values to be reset with ALTER SYSTEM RESET (Vik Fearing)

    This command removes the specified setting from postgresql.auto.conf.

E.16.3.2. Replication and Recovery

  • Create mechanisms for tracking the progress of replication, including methods for identifying the origin of individual changes during logical replication (Andres Freund)

    This is helpful when implementing replication solutions.

  • Rework truncation of the multixact commit log to be properly WAL-logged (Andres Freund)

    This makes things substantially simpler and more robust.

  • Add recovery.conf parameter recovery_target_action to control post-recovery activity (Petr Jelínek)

    This replaces the old parameter pause_at_recovery_target.

  • Add new archive_mode value always to allow standbys to always archive received WAL files (Fujii Masao)

  • Add configuration parameter wal_retrieve_retry_interval to control WAL read retry after failure (Alexey Vasiliev, Michael Paquier)

    This is particularly helpful for warm standbys.

  • Allow compression of full-page images stored in WAL (Rahila Syed, Michael Paquier)

    This feature reduces WAL volume, at the cost of more CPU time spent on WAL logging and WAL replay. It is controlled by a new configuration parameter wal_compression, which currently is off by default.

  • Archive WAL files with suffix .partial during standby promotion (Heikki Linnakangas)

  • Add configuration parameter log_replication_commands to log replication commands (Fujii Masao)

    By default, replication commands, e.g. IDENTIFY_SYSTEM, are not logged, even when log_statement is set to all.

  • Report the processes holding replication slots in pg_replication_slots (Craig Ringer)

    The new output column is active_pid.

  • Allow recovery.conf's primary_conninfo setting to use connection URIs, e.g. postgres:// (Alexander Shulgin)

E.16.3.3. Queries

  • Allow INSERTs that would generate constraint conflicts to be turned into UPDATEs or ignored (Peter Geoghegan, Heikki Linnakangas, Andres Freund)

    The syntax is INSERT ... ON CONFLICT DO NOTHING/UPDATE. This is the Postgres implementation of the popular UPSERT command.

  • Add GROUP BY analysis features GROUPING SETS, CUBE and ROLLUP (Andrew Gierth, Atri Sharma)

  • Allow setting multiple target columns in an UPDATE from the result of a single sub-SELECT (Tom Lane)

    This is accomplished using the syntax UPDATE tab SET (col1, col2, ...) = (SELECT ...).

  • Add SELECT option SKIP LOCKED to skip locked rows (Thomas Munro)

    This does not throw an error for locked rows like NOWAIT does.

  • Add SELECT option TABLESAMPLE to return a subset of a table (Petr Jelínek)

    This feature supports the SQL-standard table sampling methods. In addition, there are provisions for user-defined table sampling methods.

  • Suggest possible matches for mistyped column names (Peter Geoghegan, Robert Haas)

E.16.3.4. Utility Commands

  • Add more details about sort ordering in EXPLAIN output (Marius Timmer, Lukas Kreft, Arne Scheffer)

    Details include COLLATE, DESC, USING, and NULLS FIRST/LAST.

  • Make VACUUM log the number of pages skipped due to pins (Jim Nasby)

  • Make TRUNCATE properly update the pg_stat* tuple counters (Alexander Shulgin)

E.16.3.4.1. REINDEX

  • Allow REINDEX to reindex an entire schema using the SCHEMA option (Sawada Masahiko)

  • Add VERBOSE option to REINDEX (Sawada Masahiko)

  • Prevent REINDEX DATABASE and SCHEMA from outputting object names, unless VERBOSE is used (Simon Riggs)

  • Remove obsolete FORCE option from REINDEX (Fujii Masao)

E.16.3.5. Object Manipulation

E.16.3.5.1. Foreign Tables

  • Add support for IMPORT FOREIGN SCHEMA (Ronan Dunklau, Michael Paquier, Tom Lane)

    This command allows automatic creation of local foreign tables that match the structure of existing tables on a remote server.

  • Allow CHECK constraints to be placed on foreign tables (Shigeru Hanada, Etsuro Fujita)

    Such constraints are assumed to be enforced on the remote server, and are not enforced locally. However, they are assumed to hold for purposes of query optimization, such as constraint exclusion.

  • Allow foreign tables to participate in inheritance (Shigeru Hanada, Etsuro Fujita)

    To let this work naturally, foreign tables are now allowed to have check constraints marked as not valid, and to set storage and OID characteristics, even though these operations are effectively no-ops for a foreign table.

  • Allow foreign data wrappers and custom scans to implement join pushdown (KaiGai Kohei)

E.16.3.5.2. Event Triggers

  • Whenever a ddl_command_end event trigger is installed, capture details of DDL activity for it to inspect (Álvaro Herrera)

    This information is available through a set-returning function pg_event_trigger_ddl_commands(), or by inspection of C data structures if that function doesn't provide enough detail.

  • Allow event triggers on table rewrites caused by ALTER TABLE (Dimitri Fontaine)

  • Add event trigger support for database-level COMMENT, SECURITY LABEL, and GRANT/REVOKE (Álvaro Herrera)

  • Add columns to the output of pg_event_trigger_dropped_objects (Álvaro Herrera)

    This allows simpler processing of delete operations.

E.16.3.6. Data Types

  • Allow the xml data type to accept empty or all-whitespace content values (Peter Eisentraut)

    This is required by the SQL/XML specification.

  • Allow macaddr input using the format xxxx-xxxx-xxxx (Herwin Weststrate)

  • Disallow non-SQL-standard syntax for interval with both precision and field specifications (Bruce Momjian)

    Per the standard, such type specifications should be written as, for example, INTERVAL MINUTE TO SECOND(2). PostgreSQL formerly allowed this to be written as INTERVAL(2) MINUTE TO SECOND, but it must now be written in the standard way.

  • Add selectivity estimators for inet/cidr operators and improve estimators for text search functions (Emre Hasegeli, Tom Lane)

  • Add data types regrole and regnamespace to simplify entering and pretty-printing the OID of a role or namespace (Kyotaro Horiguchi)

E.16.3.6.1. JSON

E.16.3.7. Functions

  • Add generate_series() for numeric values (Plato Malugin)

  • Allow array_agg() and ARRAY() to take arrays as inputs (Ali Akbar, Tom Lane)

  • Add functions array_position() and array_positions() to return subscripts of array values (Pavel Stehule)

  • Add a point-to-polygon distance operator <-> (Alexander Korotkov)

  • Allow multibyte characters as escapes in SIMILAR TO and SUBSTRING (Jeff Davis)

    Previously, only a single-byte character was allowed as an escape.

  • Add a width_bucket() variant that supports any sortable data type and non-uniform bucket widths (Petr Jelínek)

  • Add an optional missing_ok argument to pg_read_file() and related functions (Michael Paquier, Heikki Linnakangas)

  • Allow => to specify named parameters in function calls (Pavel Stehule)

    Previously only := could be used. This requires removing the possibility for => to be a user-defined operator. Creation of user-defined => operators has been issuing warnings since PostgreSQL 9.0.

  • Add POSIX-compliant rounding for platforms that use PostgreSQL-supplied rounding functions (Pedro Gimeno Fortea)

E.16.3.7.1. System Information Functions and Views

E.16.3.7.2. Aggregates

  • Add min()/max() aggregates for inet/cidr data types (Haribabu Kommi)

  • Use 128-bit integers, where supported, as accumulators for some aggregate functions (Andreas Karlsson)

E.16.3.8. Server-Side Languages

  • Improve support for composite types in PL/Python (Ed Behn, Ronan Dunklau)

    This allows PL/Python functions to return arrays of composite types.

  • Reduce lossiness of PL/Python floating-point value conversions (Marko Kreen)

  • Allow specification of conversion routines between SQL data types and data types of procedural languages (Peter Eisentraut)

    This change adds new commands CREATE/DROP TRANSFORM. This also adds optional transformations between the hstore and ltree types to/from PL/Perl and PL/Python.

E.16.3.8.1. PL/pgSQL Server-Side Language

  • Improve PL/pgSQL array performance (Tom Lane)

  • Add an ASSERT statement in PL/pgSQL (Pavel Stehule)

  • Allow more PL/pgSQL keywords to be used as identifiers (Tom Lane)

E.16.3.9. Client Applications

  • Move pg_archivecleanup, pg_test_fsync, pg_test_timing, and pg_xlogdump from contrib to src/bin (Peter Eisentraut)

    This should result in these programs being installed by default in most installations.

  • Add pg_rewind, which allows re-synchronizing a master server after failback (Heikki Linnakangas)

  • Allow pg_receivexlog to manage physical replication slots (Michael Paquier)

    This is controlled via new --create-slot and --drop-slot options.

  • Allow pg_receivexlog to synchronously flush WAL to storage using new --synchronous option (Furuya Osamu, Fujii Masao)

    Without this, WAL files are fsync'ed only on close.

  • Allow vacuumdb to vacuum in parallel using new --jobs option (Dilip Kumar)

  • In vacuumdb, do not prompt for the same password repeatedly when multiple connections are necessary (Haribabu Kommi, Michael Paquier)

  • Add --verbose option to reindexdb (Sawada Masahiko)

  • Make pg_basebackup use a tablespace mapping file when using tar format, to support symbolic links and file paths of 100+ characters in length on MS Windows (Amit Kapila)

  • Add pg_xlogdump option --stats to display summary statistics (Abhijit Menon-Sen)

E.16.3.9.1. psql

  • Allow psql to produce AsciiDoc output (Szymon Guz)

  • Add an errors mode that displays only failed commands to psql's ECHO variable (Pavel Stehule)

    This behavior can also be selected with psql's -b option.

  • Provide separate column, header, and border linestyle control in psql's unicode linestyle (Pavel Stehule)

    Single or double lines are supported; the default is single.

  • Add new option %l in psql's PROMPT variables to display the current multiline statement line number (Sawada Masahiko)

  • Add \pset option pager_min_lines to control pager invocation (Andrew Dunstan)

  • Improve psql line counting used when deciding to invoke the pager (Andrew Dunstan)

  • psql now fails if the file specified by an --output or --log-file switch cannot be written (Tom Lane, Daniel Vérité)

    Previously, it effectively ignored the switch in such cases.

  • Add psql tab completion when setting the search_path variable (Jeff Janes)

    Currently only the first schema can be tab-completed.

  • Improve psql's tab completion for triggers and rules (Andreas Karlsson)

E.16.3.9.1.1. Backslash Commands

  • Add psql \? help sections variables and options (Pavel Stehule)

    \? variables shows psql's special variables and \? options shows the command-line options. \? commands shows the meta-commands, which is the traditional output and remains the default. These help displays can also be obtained with the command-line option --help=section.

  • Show tablespace size in psql's \db+ (Fabrízio de Royes Mello)

  • Show data type owners in psql's \dT+ (Magnus Hagander)

  • Allow psql's \watch to output \timing information (Fujii Masao)

    Also prevent --echo-hidden from echoing \watch queries, since that is generally unwanted.

  • Make psql's \sf and \ef commands honor ECHO_HIDDEN (Andrew Dunstan)

  • Improve psql tab completion for \set, \unset, and :variable names (Pavel Stehule)

  • Allow tab completion of role names in psql \c commands (Ian Barwick)

E.16.3.9.2. pg_dump

  • Allow pg_dump to share a snapshot taken by another session using --snapshot (Simon Riggs, Michael Paquier)

    The remote snapshot must have been exported by pg_export_snapshot() or logical replication slot creation. This can be used to share a consistent snapshot across multiple pg_dump processes.

  • Support table sizes exceeding 8GB in tar archive format (Tom Lane)

    The POSIX standard for tar format does not allow elements of a tar archive to exceed 8GB, but most modern implementations of tar support an extension that does allow it. Use the extension format when necessary, rather than failing.

  • Make pg_dump always print the server and pg_dump versions (Jing Wang)

    Previously, version information was only printed in --verbose mode.

  • Remove the long-ignored -i/--ignore-version option from pg_dump, pg_dumpall, and pg_restore (Fujii Masao)

E.16.3.9.3. pg_ctl

  • Support multiple pg_ctl -o options, concatenating their values (Bruce Momjian)

  • Allow control of pg_ctl's event source logging on MS Windows (MauMau)

    This only controls pg_ctl, not the server, which has separate settings in postgresql.conf.

  • If the server's listen address is set to a wildcard value (0.0.0.0 in IPv4 or :: in IPv6), connect via the loopback address rather than trying to use the wildcard address literally (Kondo Yuta)

    This fix primarily affects Windows, since on other platforms pg_ctl will prefer to use a Unix-domain socket.

E.16.3.9.4. pg_upgrade

  • Move pg_upgrade from contrib to src/bin (Peter Eisentraut)

    In connection with this change, the functionality previously provided by the pg_upgrade_support module has been moved into the core server.

  • Support multiple pg_upgrade -o/-O options, concatenating their values (Bruce Momjian)

  • Improve database collation comparisons in pg_upgrade (Heikki Linnakangas)

  • Remove support for upgrading from 8.3 clusters (Bruce Momjian)

E.16.3.9.5. pgbench

  • Move pgbench from contrib to src/bin (Peter Eisentraut)

  • Fix calculation of TPS number "excluding connections establishing" (Tatsuo Ishii, Fabien Coelho)

    The overhead for connection establishment was miscalculated whenever the number of pgbench threads was less than the number of client connections. Although this is clearly a bug, we won't back-patch it into pre-9.5 branches since it makes TPS numbers not comparable to previous results.

  • Allow counting of pgbench transactions that take over a specified amount of time (Fabien Coelho)

    This is controlled by a new --latency-limit option.

  • Allow pgbench to generate Gaussian/exponential distributions using \setrandom (Kondo Mitsumasa, Fabien Coelho)

  • Allow pgbench's \set command to handle arithmetic expressions containing more than one operator, and add % (modulo) to the set of operators it supports (Robert Haas, Fabien Coelho)

E.16.3.10. Source Code

  • Simplify WAL record format (Heikki Linnakangas)

    This allows external tools to more easily track what blocks are modified.

  • Improve the representation of transaction commit and abort WAL records (Andres Freund)

  • Add atomic memory operations API (Andres Freund)

  • Allow custom path and scan methods (KaiGai Kohei, Tom Lane)

    This allows extensions greater control over the optimizer and executor.

  • Allow foreign data wrappers to do post-filter locking (Etsuro Fujita)

  • Foreign tables can now take part in INSERT ... ON CONFLICT DO NOTHING queries (Peter Geoghegan, Heikki Linnakangas, Andres Freund)

    Foreign data wrappers must be modified to handle this. INSERT ... ON CONFLICT DO UPDATE is not supported on foreign tables.

  • Improve hash_create()'s API for selecting simple-binary-key hash functions (Teodor Sigaev, Tom Lane)

  • Improve parallel execution infrastructure (Robert Haas, Amit Kapila, Noah Misch, Rushabh Lathia, Jeevan Chalke)

  • Remove Alpha (CPU) and Tru64 (OS) ports (Andres Freund)

  • Remove swap-byte-based spinlock implementation for ARMv5 and earlier CPUs (Robert Haas)

    ARMv5's weak memory ordering made this locking implementation unsafe. Spinlock support is still possible on newer gcc implementations with atomics support.

  • Generate an error when excessively long (100+ character) file paths are written to tar files (Peter Eisentraut)

    Tar does not support such overly-long paths.

  • Change index operator class for columns pg_seclabel.provider and pg_shseclabel.provider to be text_pattern_ops (Tom Lane)

    This avoids possible problems with these indexes when different databases of a cluster have different default collations.

  • Change the spinlock primitives to function as compiler barriers (Robert Haas)

E.16.3.10.1. MS Windows

  • Allow higher-precision time stamp resolution on Windows 8, Windows Server 2012, and later Windows systems (Craig Ringer)

  • Install shared libraries to bin in MS Windows (Peter Eisentraut, Michael Paquier)

  • Install src/test/modules together with contrib on MSVC builds (Michael Paquier)

  • Allow configure's --with-extra-version option to be honored by the MSVC build (Michael Paquier)

  • Pass PGFILEDESC into MSVC contrib builds (Michael Paquier)

  • Add icons to all MSVC-built binaries and version information to all MS Windows binaries (Noah Misch)

    MinGW already had such icons.

  • Add optional-argument support to the internal getopt_long() implementation (Michael Paquier, Andres Freund)

    This is used by the MSVC build.

E.16.3.11. Additional Modules

  • Add statistics for minimum, maximum, mean, and standard deviation times to pg_stat_statements (Mitsumasa Kondo, Andrew Dunstan)

  • Add pgcrypto function pgp_armor_headers() to extract PGP armor headers (Marko Tiikkaja, Heikki Linnakangas)

  • Allow empty replacement strings in unaccent (Mohammad Alhashash)

    This is useful in languages where diacritic signs are represented as separate characters.

  • Allow multicharacter source strings in unaccent (Tom Lane)

    This could be useful in languages where diacritic signs are represented as separate characters. It also allows more complex unaccent dictionaries.

  • Add contrib modules tsm_system_rows and tsm_system_time to allow additional table sampling methods (Petr Jelínek)

  • Add GIN index inspection functions to pageinspect (Heikki Linnakangas, Peter Geoghegan, Michael Paquier)

  • Add information about buffer pins to pg_buffercache display (Andres Freund)

  • Allow pgstattuple to report approximate answers with less overhead using pgstattuple_approx() (Abhijit Menon-Sen)

  • Move dummy_seclabel, test_shm_mq, test_parser, and worker_spi from contrib to src/test/modules (Álvaro Herrera)

    These modules are only meant for server testing, so they do not need to be built or installed when packaging PostgreSQL.