Versie 19.0 van PostgreSQL is kort geleden verschenen. Dit populaire open source relational database management system draait op een groot aantal besturingssystemen en is daardoor uitstekend inzetbaar in diverse omgevingen. Het is een afgeleide van Ingres, nadat de hoofdontwikkelaar daarvan voor zichzelf is begonnen en deze database van opensource closedsource werd. Uitgebreide releasenotes voor deze uitgave zijn op deze pagina te vinden; dit zijn de belangrijkste veranderingen die in versie 19 zijn aangebracht:
Simplifying workload managementTables that receive many updates and deletes can build up unused space, known as "bloat," which can also significantly impact query performance. The
VACUUM FULLandCLUSTERcommands were previously used to handle this, but had tradeoffs, including preventing access to the table until the cleanup finished. PostgreSQL 19 introduces theREPACKcommand, which reclaims this space and can reorder a table's data to match an index, and withREPACK (CONCURRENTLY), can do so without blocking reads or writes.REPACKreplaces theVACUUM FULLandCLUSTERcommands, both of which remain available for compatibility.The PostgreSQL query planner usually picks an efficient plan for each query, but the plan can change as your data changes, and sometimes the new plan is slower. PostgreSQL 19 adds the
pg_plan_adviceextension, which allows stabilization of plan choices and the ability to experiment with different plans using the "plan advice" mini-language. The companionpg_stash_adviceextension stores advice and automatically applies it to queries based on their query identifier, so you can fix a slow plan without changing your application.PostgreSQL 19 also helps autovacuum keep up on busy systems. Autovacuum can now vacuum indexes using parallel workers, controlled by the new
autovacuum_max_parallel_workerssetting, and uses a new scoring system to decide which tables to process first. Queries that read a table can now automatically mark pages as all-visible in the visibility map during execution, reducing the work that future vacuums need to do. Additionally,vacuumdb --analyze-onlynow analyzes partitioned tables when no tables are specified.This release adds new views for monitoring workloads, including
Distributed data improvementspg_stat_lockfor per-lock-type statistics,pg_stat_recoveryfor recovery status, andpg_stat_autovacuum_scoresto show how autovacuum prioritizes tables. The newIOoption forEXPLAIN ANALYZEand the matchingauto_explainsetting report asynchronous I/O activity. PostgreSQL 19 also reports the amount of WAL written for full-page images inpg_stat_wal,EXPLAIN (ANALYZE, WAL), and in vacuum and analyze log events.Previously, PostgreSQL often required users to restart their server to enable logical replication, which could be disruptive in production workloads. PostgreSQL 19 simplifies logical replication initialization by automatically raising the effective WAL level to
logicalwhen you create the first logical replication slot. You can see the WAL level in use with the neweffective_wal_levelsetting.PostgreSQL 19 also adds logical replication of sequence values, which you can publish using
FOR ALL SEQUENCESwithCREATE PUBLICATION.CREATE PUBLICATIONalso adds anEXCEPTclause to exclude tables when publishingFOR ALL TABLES, andCREATE SUBSCRIPTIONcan now get its connection settings from a foreign server, such as one defined withpostgres_fdw, using theSERVERclause. Additionally, the newretain_dead_tuplessubscription option lets PostgreSQL detect updates that conflict with a concurrent delete, and these conflicts are counted inpg_stat_subscription_stats.For applications that send reads to standbys, PostgreSQL 19 adds "read-your-writes" consistency with the new
WAIT FOR LSNcommand. A session on a standby can useWAIT FOR LSNto wait until the standby has replayed the write-ahead log (WAL) up to a specific log sequence number (LSN) before running a query, so the application can read data it just wrote on the primary.PostgreSQL 19 also improves queries on foreign tables. With the new
Developer experience and performance enhancementsimport_statsoption,postgres_fdwcan import table statistics from the remote server when you runANALYZE, instead of sampling rows from the remote table, which helps the query planner choose better plans.PostgreSQL 19 adds
INSERT ... ON CONFLICT DO SELECT, which lets theRETURNINGclause return existing rows that conflict with an insert, simplifying the common "get or create" pattern.COPYcan now output data as JSON, including as a single JSON array, and the SQL/JSON path language adds string methods such aslower(),upper(),replace(),split_part(), andbtrim(). Additionally, thelead(),lag(),first_value(),last_value(), andnth_value()window functions can now skipNULLvalues usingIGNORE NULLS. Therandom()function can now also generate random dates and timestamps within a range.This release also makes many workloads faster without changes to your application. PostgreSQL 19 improves the performance of foreign key checks, which in testing made bulk inserts nearly 2x faster, and adds more query planner optimizations, such as converting
NOT INclauses to more efficient anti-joins whenNULLvalues are not present, and performing eager aggregation before joins to reduce the number of rows to process. PostgreSQL 19 also builds on the asynchronous I/O subsystem added in PostgreSQL 18. Whenio_methodis set toworker(the default), PostgreSQL now automatically adjusts the number of I/O workers between the newio_min_workersandio_max_workerssettings, which replace theio_workerssetting. There are also scalability improvements when usingLISTENandNOTIFYto exchange notifications in multi-channel workloads.Finally, the new
Other notable changespassword_expiration_warning_thresholdsetting warns users when their password is about to expire.PostgreSQL 19 adds server-side support for Server Name Indication (SNI), letting a single PostgreSQL server present a different TLS certificate based on the hostname a client connects to. You can map hostnames to their certificates and keys in the new
pg_hosts.conffile. PostgreSQL 19 also now issues a warning after a successfulmd5password authentication, which you can turn off with themd5_password_warningssetting.md5password authentication was deprecated in PostgreSQL 18 and will be removed in a future release. If you require password-based authentication, use SCRAM authentication. This release also removes support for RADIUS authentication.Just-in-time compilation (JIT) is now disabled by default, as the cost estimates PostgreSQL used to decide when to use it proved unreliable. If you run many large analytical queries, you may want to enable JIT. When PostgreSQL is built with LZ4 support, the default TOAST compression method is now
Additional Featureslz4.Many other new features and improvements have been added to PostgreSQL 19 that may also be helpful for your use cases. Please see the release notes for a complete list of new and changed features.
/i/2008540272.webp?f=imagenormal)