What Is New in PostgreSQL 18
PostgreSQL 18 introduces a suite of enhancements focused on performance, replication, and manageability. These updates provide tangible benefits for database administrators and developers working with large-scale systems.
| Category | Key Changes |
|---|---|
| Performance | Parallelization of FULL and RIGHT OUTER JOINs, system-wide I/O statistics, more efficient vacuuming on partitioned tables. |
| Replication | Logical replication from standbys, row filtering and column lists for publications, new pg_subscription_check module. |
| Monitoring | New system views for I/O stats (pg_stat_io), progress reporting for VACUUM on partitioned tables. |
| SQL & Administration | New pg_terminate_backend_role() function, ALTER SYSTEM READ ONLY command, support for single-byte XOR and NAND bitwise operators. |
| Deprecations & Removals | Deprecation of the recovery.conf file, removal of the pg_standby utility. |
How does PostgreSQL 18 speed up my queries?
The query planner can now execute FULL OUTER JOIN and RIGHT OUTER JOIN operations in parallel. This means multiple worker processes can tackle different parts of the join simultaneously, significantly reducing execution time for these complex operations on large datasets.
In practice, analytical queries and large report generation that rely on these types of joins will see the most immediate benefit. This is a continuation of PostgreSQL's ongoing effort to leverage multi-core systems for better performance.
What's new for replication and high availability?
Logical replication can now be performed directly from a physical standby server. This allows you to use a hot standby as a publisher, offloading the replication workload from the primary server and creating more flexible replication topologies.
Publications have been enhanced with row filters and column lists. You can now replicate a subset of rows based on a WHERE condition or a specific list of columns, giving you finer control over the data that gets replicated and saving bandwidth.
The new pg_subscription_check module provides a function to verify that a standby server's data
matches its publisher, which is crucial for ensuring data consistency in logical replication setups.
How can I better monitor database I/O?
A new system view, pg_stat_io, provides a system-wide perspective on I/O operations. It aggregates
statistics across all databases, offering insights into read/write patterns, extended writes, and fsync
operations.
This matters because it finally gives a clear picture of how the database is interacting with the storage system. You can identify if I/O is a bottleneck and which backend processes are the most active, which was much harder to track in previous versions.
What administrative commands were added?
The new ALTER SYSTEM READ ONLY command allows an administrator to put the entire cluster into a
read-only state. This is useful for ensuring no writes occur during certain maintenance windows or before a
failover.
For managing connections, the pg_terminate_backend_role() function lets you terminate all active
connections owned by a specific role. This is a more surgical approach than waiting for idle connections to
timeout or restarting the server.
VACUUM operations on partitioned tables now report progress to the pg_stat_progress_vacuum view.
This is a big help for monitoring long-running vacuum jobs on large partitioned tables.
FAQ
Can I use my existing standby server as a logical replication publisher now?
Yes, this is a
key feature of PostgreSQL 18. You can set up logical replication to stream data from a physical standby,
reducing load on your primary server.
Do I need to change my config for the deprecated recovery.conf?
Yes, the parameters from
recovery.conf must be moved to the main postgresql.conf file. The old file has been deprecated and will be
removed in a future release.
Will my FULL OUTER JOINs automatically run in parallel?
They are eligible for parallel
execution, but the planner will decide based on cost. Ensure your max_parallel_workers settings are
configured appropriately to allow it.
What happens if I try to use the removed pg_standby utility?
The utility has been removed.
You will need to use a different method for managing archive recovery, such as the built-in
restore_command functionality.
How do the new bitwise operators (XOR, NAND) work?
They operate on single-byte (aka "bit")
strings. The single-byte XOR operator is # and the single-byte NAND operator is ~&,
providing more tools for bit-level manipulation directly in SQL.