Summary: PostgreSQL 18 introduces many new features including asynchronous I/O with 2-3x performance improvements, virtual generated columns, UUIDv7 support, temporal constraints, and enhanced security. This overview covers the major features that will impact developers and DBAs.
Introduction
PostgreSQL 18 Beta 1 was released on May 8, 2025, marking one of the most significant releases in recent years. This version introduces fundamental changes to how PostgreSQL handles I/O operations, along with numerous developer-friendly features and security enhancements.
The release focuses on three core areas:
- Performance: Revolutionary asynchronous I/O and query optimizations
- Developer Experience: New features like UUIDv7 and virtual generated columns
- Operations: Better upgrades, enhanced monitoring, and improved security
Let's explore what makes PostgreSQL 18 a landmark release.
Major Performance Improvements
With PostgreSQL 18, we see a major shift in how the database handles I/O operations, particularly for read-heavy workloads. The introduction of asynchronous I/O (AIO) which gives up to 2-3x performance improvements in many scenarios.
Asynchronous I/O
PostgreSQL 18 introduces an asynchronous I/O (AIO) subsystem that fundamentally changes how the database handles I/O operations. This represents a major architectural shift from PostgreSQL's traditional synchronous I/O model.
Key benefits:
- Up to 2-3x performance improvements for read-heavy workloads
- Reduced I/O latency, especially in cloud environments
- Support for both Linux io_uring and cross-platform worker implementations
-- New configuration options
SHOW io_method; -- 'worker', 'sync', or 'io_uring'
SHOW io_workers; -- Number of I/O worker processes
The new pg_aios
system view allows you to monitor asynchronous I/O operations in real-time.
B-tree Skip Scan Support
PostgreSQL 18 adds "skip scan" capability to B-tree indexes, enabling faster queries that don't specify all leading index columns.
-- With index on (region, category, date)
-- This query can now use skip scan:
SELECT * FROM sales WHERE category = 'Electronics' AND date > '2024-01-01';
-- No need to specify 'region' anymore!
Query Optimization Enhancements
- Smarter OR/IN processing: Automatic conversion to ANY(array) operations
- Improved hash joins: Better performance for table joins
- Parallel GIN index builds: Faster creation of indexes for JSON and full-text search
- Enhanced partitioned table support: Better pruning and join optimizations
Developer Experience Improvements
With PostgreSQL 18, developers gain access to several new features that simplify schema design and improve application performance.
Virtual Generated Columns (Default)
PostgreSQL 18 makes virtual generated columns the default, computing values on-demand rather than storing them.
CREATE TABLE orders (
id SERIAL PRIMARY KEY,
subtotal DECIMAL(10,2),
tax_rate DECIMAL(5,4) DEFAULT 0.0875,
-- Virtual by default - computed when read
total DECIMAL(10,2) GENERATED ALWAYS AS (subtotal * (1 + tax_rate)),
-- Explicitly stored if needed
audit_info TEXT GENERATED ALWAYS AS (...) STORED
);
Benefits:
- Reduced storage requirements
- Faster INSERT/UPDATE operations
- Always up-to-date calculated values
- Stored generated columns can now be logically replicated
UUIDv7: Timestamp-Ordered UUIDs
Native support for UUIDv7 brings the best of both worlds: global uniqueness and database-friendly ordering.
-- Generate timestamp-ordered UUIDs
SELECT uuidv7();
-- Result: 01980de8-ad3d-715c-b739-faf2bb1a7aad
-- Extract timestamp information
SELECT uuid_extract_timestamp(uuidv7());
-- Result: 2025-06-21 10:20:28.549+01
Why UUIDv7 matters:
- Better B-tree index performance than random UUIDs
- Natural chronological ordering
- Reduced page splits and improved caching
- Ideal for distributed systems requiring sortable IDs
It is worth noting that uuidv4()
in this release is now an alias for gen_rand_uuid
.
Enhanced RETURNING Clause
With PostgreSQL 18, the RETURNING
clause has been enhanced to allow more flexible access to both old and new values in DML operations.
You can now access both the old and new values in a single RETURNING
clause, making it easier to track changes.
-- Get both old and new values in UPDATE
UPDATE users
SET email = 'new@example.com'
WHERE id = 1
RETURNING
OLD.email as previous_email,
NEW.email as current_email;
Temporal Constraints WITHOUT OVERLAPS
Support for time-based constraints using the WITHOUT OVERLAPS clause.
-- Prevent overlapping time periods
CREATE TABLE room_bookings (
room_id INT,
booking_period tstzrange,
PRIMARY KEY (room_id, booking_period WITHOUT OVERLAPS)
);
Enhanced Security Features
In addition to performance and developer experience improvements, PostgreSQL 18 introduces several security enhancements for better authentication and data integrity.
OAuth Authentication
PostgreSQL 18 introduces OAuth 2.0 authentication support, allowing integration with modern identity providers.
You configure it in pg_hba.conf
like other auth methods, and load token validators using the new oauth_validator_libraries
setting. This adds an extensible option for integrating with identity providers.
MD5 Deprecation Warning
MD5 password authentication is now deprecated in favor of the more secure SCRAM-SHA-256 method. The MD5 method will still work, but you will be removed in the next major release.
Enhanced TLS Support
New ssl_tls13_ciphers
parameter allows fine-grained control over TLS 1.3 cipher suites.
Operational Improvements
In addition to performance and developer features, PostgreSQL 18 introduces several operational enhancements that simplify management and improve upgrade processes.
Smoother Major Version Upgrades
PostgreSQL 18 significantly improves the upgrade experience:
Statistics preservation: Keep planner statistics during upgrades, eliminating the need for lengthy post-upgrade ANALYZE
operations which were required in previous versions.
Enhanced pg_upgrade
:
--jobs
flag for parallel processing--swap
flag for faster directory operations- Better handling of large installations
Enhanced Query Analysis with EXPLAIN
PostgreSQL 18 expands the capabilities of the EXPLAIN
utility, making it easier to understand and optimize query performance.
-- Now includes buffer usage by default
EXPLAIN ANALYZE SELECT * FROM large_table WHERE id > 1000;
-- Get detailed metrics including CPU, WAL, and read stats
EXPLAIN (ANALYZE, VERBOSE) SELECT * FROM large_table WHERE id > 1000;
These improvements help identify costly operations by showing how many shared buffers were accessed, how many index lookups occurred, and how much I/O, CPU, and WAL activity each plan node generated.
PostgreSQL 18 also adds vacuum and analyze timing directly in pg_stat_all_tables
, plus per-backend statistics for I/O and WAL usage. Logical replication now logs write conflicts and surfaces them in pg_stat_subscription_stats
, making it easier to diagnose replication issues in real time.
Improved Monitoring
Some notable monitoring enhancements included in PostgreSQL 18 are:
- Enhanced
pg_stat_io
with byte-level statistics - Per-backend I/O and WAL statistics
- Better logical replication conflict reporting
- Vacuum and analyze timing in
pg_stat_all_tables
Data Checksums by Default
New PostgreSQL 18 clusters enable data checksums by default, providing better data integrity validation.
# Disable if needed during initialization
initdb --no-data-checksums
This change helps catch data corruption issues early, especially in cloud environments where storage reliability can vary.
Schema Management Enhancements
NOT NULL Constraints as NOT VALID
Add NOT NULL constraints without immediate table scans:
-- Add constraint without full table scan
ALTER TABLE large_table
ADD CONSTRAINT users_email_not_null
CHECK (email IS NOT NULL) NOT VALID;
-- Validate later with minimal locking
ALTER TABLE large_table
VALIDATE CONSTRAINT users_email_not_null;
This is especially useful in production environments where downtime must be minimized. By deferring validation, you can add the constraint instantly and then validate it during off-peak hours with minimal impact on live traffic.
Enhanced Constraint Features
- Constraints can be marked as NOT ENFORCED
- Better inheritance behavior for NOT NULL constraints
- Support for NOT VALID and NO INHERIT clauses
Wire Protocol Updates
PostgreSQL 18 introduces wire protocol version 3.2 - the first update since PostgreSQL 7.4 in 2003. While libpq continues to use version 3.0 by default, this enables future client improvements.
Getting Started with PostgreSQL 18
PostgreSQL 18 Beta 1 is available for testing. While not recommended for production, it's an excellent time to:
- Test your applications for compatibility
- Benchmark the new asynchronous I/O features
- Experiment with UUIDv7 and virtual generated columns
- Validate upgrade procedures
Neon will support PostgreSQL 18 shortly after the official release, just like with previous versions. But if you want to try it out locally right now, you can spin up a PostgreSQL 18 container using Docker:
docker run --name pg18 \
-e POSTGRES_PASSWORD=postgres \
-p 5432:5432 \
postgres:18beta1
This will give you a PostgreSQL 18 instance running locally for testing purposes. You can then connect using your favorite PostgreSQL client or psql
.
Looking Ahead
PostgreSQL 18 represents a major release that modernizes the database for cloud-native workloads but also maintaining backward compatibility. The asynchronous I/O system alone makes this a compelling upgrade.
The beta testing period is crucial for ensuring a stable release. We encourage testing your applications against PostgreSQL 18 Beta 1 to help identify any compatibility issues before the final release.
Expected timeline: PostgreSQL 18 final release is anticipated for September/October 2025.
As always, Neon will have PostgreSQL 18 support ready shortly after the official release, just as we did with PostgreSQL 17.