What is New in PostgreSQL 12
PostgreSQL 12 introduces major improvements in performance, storage efficiency, and ease of use. This release focuses on making large table management more efficient, enhancing query performance, and adding powerful new features for both developers and database administrators.
Key highlights include generated columns, improved partitioning, faster vacuuming, and significant enhancements to indexing and query execution.
Major New Features
PostgreSQL 12 brings several groundbreaking capabilities:
- Generated Columns - Columns whose values are automatically computed and stored based on other columns using the
GENERATED ALWAYS ASsyntax - Significant improvements to declarative partitioning with better query performance and easier maintenance
- Support for
REINDEX CONCURRENTLYallowing index rebuilds without blocking writes - Improved vacuum behavior with the ability to skip index vacuuming when not needed
Performance Enhancements
PostgreSQL 12 delivers noticeable speed improvements in many common operations:
- Faster B-tree index creation and maintenance
- Improved query planning for partitioned tables
- Better handling of common table expressions (CTEs) with materialization control
- Enhanced parallel query execution for more operations
- Optimized sorting and aggregation with reduced memory usage
Partitioning and Indexing Improvements
Partitioning has been greatly enhanced in PostgreSQL 12:
- Support for foreign keys referencing partitioned tables
- Improved partition pruning for more query types
- Ability to attach and detach partitions more efficiently
- Better default partitioning strategies
Additionally, the new REINDEX CONCURRENTLY feature allows administrators to rebuild indexes with minimal impact on application performance.
Security and Administration
Security and manageability receive important updates:
- New system role
pg_read_all_settingsfor safer configuration access - Improved logging of authentication failures
- Better control over WAL writing behavior
- Enhanced support for JIT compilation with more tunable parameters
SQL and Developer Features
Developers benefit from several new SQL capabilities:
- New functions:
jsonb_set()improvements,generate_series()for numeric and timestamp ranges - Support for
ALTER TABLE ... ATTACH PARTITIONwith validation control - More flexible handling of identity columns
- Improved error messages and diagnostics
Monitoring and Observability
| Area | New / Improved Feature |
|---|---|
| Partitioning | Better query planning and partition pruning |
| Vacuum | More efficient index vacuuming and statistics updates |
| Indexing | REINDEX CONCURRENTLY support |
| Generated Columns | Stored computed columns |
Migration Considerations
When upgrading to PostgreSQL 12, pay attention to these points:
- Generated columns require careful planning during schema migration
- Partitioned tables may benefit from redefinition using the new features
- Test vacuum and indexing operations as behavior has changed significantly
- Review applications using older partitioning syntax
PostgreSQL 12 represents a major step forward in performance and usability, making it an excellent choice for both new projects and existing systems looking for better efficiency and modern features.