PostgreSQL 15 is a landmark release bringing the SQL standard MERGE command, significant sort performance improvements and enhanced logical replication — closing the gap with commercial databases.
The MERGE Command
MERGE allows conditional INSERT, UPDATE or DELETE in a single statement — previously requiring complex CTEs or application logic.
-- New in PostgreSQL 15
MERGE INTO target_table t
USING source_table s ON t.id = s.id
WHEN MATCHED THEN
UPDATE SET value = s.value
WHEN NOT MATCHED THEN
INSERT (id, value) VALUES (s.id, s.value)
WHEN NOT MATCHED BY SOURCE THEN
DELETE;
Performance Improvements
- Up to 400% faster in-memory sort operations
- Improved WAL compression — reduces replication bandwidth
- Parallel query improvements for aggregate functions
Install PostgreSQL 15 on Ubuntu
sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
sudo apt update
sudo apt install postgresql-15 -y
Upgrade from PostgreSQL 14
sudo pg_upgradecluster 14 main
Conclusion
PostgreSQL 15 is a production-ready upgrade with compelling new features. Our team provides database server management for PostgreSQL, MySQL and MariaDB.
📖 Related How-To Guides:
Comments