PostgreSQL 14 Released!

Posted on 2021-09-30 by PostgreSQL Global Development Group
PostgreSQL Project

The PostgreSQL Global Development Group today announced the release of PostgreSQL 14, the latest version of the world’s most advanced open source database.

PostgreSQL 14 brings a variety of features that help developers and administrators deploy their data-backed applications. PostgreSQL continues to add innovations on complex data types, including more convenient access for JSON and support for noncontiguous ranges of data. This latest release adds to PostgreSQL's trend on improving high performance and distributed data workloads, with advances in connection concurrency, high-write workloads, query parallelism and logical replication.

"This latest release of PostgreSQL advances our users' ability to manage data workloads at scale, enhances observability, and contains new features that help application developers," said Magnus Hagander, a PostgreSQL Core Team member. "PostgreSQL 14 is a testament to the dedication of the global PostgreSQL community in addressing feedback and continuing to deliver innovative database software that is deployed by organizations large and small."

PostgreSQL, an innovative data management system known for its reliability and robustness, benefits from over 25 years of open source development from a global developer community and has become the preferred open source relational database for organizations of all sizes.

JSON Conveniences and Multiranges

PostgreSQL has supported manipulating JSON data since the release of PostgreSQL 9.2, though retrieval of values used a unique syntax. PostgreSQL 14 now lets you access JSON data using subscripts, e.g. a query like SELECT ('{ "postgres": { "release": 14 }}'::jsonb)['postgres']['release']; now works. This aligns PostgreSQL with syntax that is commonly recognized for retrieving information from JSON data. The subscripting framework added to PostgreSQL 14 can be generally extended to other nested data structures, and is also applied to the hstore data type in this release.

Range types, also first released in PostgreSQL 9.2, now have support for noncontiguous ranges through the introduction of the "multirange" data type. A multirange is an ordered list of ranges that are nonoverlapping, which lets developers write simpler queries for dealing with complex sequences of ranges. The range types native to PostgreSQL (dates, times, numbers) support multiranges, and other data types can be extended to use multirange support.

Performance Improvements for Heavy Workloads

PostgreSQL 14 provides a significant throughput boost on workloads that use many connections, with some benchmarks showing a 2x speedup. This release continues on the recent improvements to the management of B-tree indexes by reducing index bloat on tables with frequently updated indexes.

PostgreSQL 14 introduces the ability to pipeline queries to a database, which can significantly improve performance over high latency connections or for workloads with many small write (INSERT/UPDATE/DELETE) operations. As this is a client-side feature, you can use pipeline mode with any modern PostgreSQL database with the version 14 client or a client driver built with version 14 of libpq.

Enhancements for Distributed Workloads

Distributed PostgreSQL databases stand to benefit from PostgreSQL 14. When using logical replication, PostgreSQL can now stream in-progress transactions to subscribers, with significant performance benefits for applying large transactions on subscribers. PostgreSQL 14 also adds several other performance enhancements to the logical decoding system that powers logical replication.

Foreign data wrappers, which are used for working with federated workloads across PostgreSQL and other databases, can now leverage query parallelism in PostgreSQL 14. This release implements this ability in the postgres_fdw, the foreign data wrapper that interfaces with other PostgreSQL databases.

In addition to supporting query parallelism, postgres_fdw can now bulk insert data on foreign tables and import table partitions with the IMPORT FOREIGN SCHEMA directive.

Administration and Observability

PostgreSQL 14 extends its performance gains to the vacuuming system, including optimizations for reducing overhead from B-Trees. This release also adds a vacuum "emergency mode" that is designed to prevent transaction ID wraparound. ANALYZE, used to collect database statistics, now runs significantly faster in PostgreSQL 14 due to its own performance improvements.

Compression for PostgreSQL's TOAST system, which is used to store larger data like blocks of text or geometries, can now be configured. PostgreSQL 14 adds LZ4 compression for TOAST columns while retaining support for pglz compression.

PostgreSQL 14 adds several new features to help with monitoring and observability, including the ability to track the progress of COPY commands, write-ahead-log (WAL) activity, and statistics on replication slots. Enabling compute_query_id lets you uniquely track a query through several PostgreSQL features, including pg_stat_activity, EXPLAIN VERBOSE, and more.

SQL Performance, Conformance, and Convenience

Query planning and execution benefit from enhancements in PostgreSQL 14. This release includes several improvements to PostgreSQL's query parallelism support, including better performance of parallel sequential scans, the ability for PL/pgSQL to execute parallel queries when using the RETURN QUERY command, and enabling REFRESH MATERIALIZED VIEW to execute parallel queries. Additionally, queries that use nested loop joins may see performance benefits through additional caching that is added in PostgreSQL 14.

Extended statistics can now be used in PostgreSQL 14 for expressions. Additionally, window functions can now benefit from incremental sorts, a feature introduced in PostgreSQL 13.

Stored procedures, which allow for transaction control in a block of code, can now return data by using OUT parameters.

PostgreSQL 14 introduces the ability to "bin", or align, timestamps to a particular interval using the date_bin function. This release also adds the SQL conforming SEARCH and CYCLE clauses to help with ordering and cycle detection for recursive common table expressions.

Security Enhancements

PostgreSQL 14 makes it convenient to assign read-only and write-only privileges to users on tables, views, and schemas using the pg_read_all_data and pg_write_all_data predefined roles.

Additionally, this release now makes the standards-compliant SCRAM-SHA-256 password management and authentication system the default on new PostgreSQL instances.

About PostgreSQL

PostgreSQL is the world's most advanced open source database, with a global community of thousands of users, contributors, companies and organizations. Built on over 30 years of engineering, starting at the University of California, Berkeley, PostgreSQL has continued with an unmatched pace of development. PostgreSQL's mature feature set not only matches top proprietary database systems, but exceeds them in advanced database features, extensibility, security, and stability.