Postgres 19
Açıklaması şöyle
PostgreSQL 19 has an interesting new feature for DBAs: 'REPACK'Traditionally, when a PostgreSQL table becomes heavily bloated, DBAs may consider:VACUUM FULL → reclaims disk space, but requires a table rewrite and can block access.CLUSTER → reorganizes the table based on an index, but also involves a rewrite.PostgreSQL 19 introduces:psql> REPACK <table_name>;And one particularly interesting part:psql> REPACK CONCURRENTLY <table_name>;The new command combines the functionality of VACUUM FULL and CLUSTER, while the CONCURRENTLY option is designed to allow repacking without blocking reads and writes to the table.For production DBAs, this is interesting because table bloat is not just a storage problem. It can affect I/O, cache efficiency and query performance.PostgreSQL 19 is currently in beta, so this is something to understand and test in a lab before considering production use.The PostgreSQL ecosystem keeps moving.
REPACK CONCURRENTLY
Açıklaması şöyle
PG 19 adds REPACK, and with CONCURRENTLY it copies the live rows to a new file, keeps track of what your app changes in the meantime, replays those changes, and only takes the lock for the final swap.Two things to check first: the table needs a primary key, and you need enough free disk for the table plus its indexes.
Postgres 19 Öncesi
Kurmak için şöyle yaparızCREATE EXTENSION pg_repack;
Açıklaması şöyle. Tabloyu yeni bir yere kopyalar ve indeksleri yeniden yapılandırır. Böylece saklama alanından tasarruf ederiz.
It creates a new table like we have seen in reindexing and copies all the data from the old table to a new table and after that rebuild the indexes. After full copying is done new table acts as the main one and the old one is dropped.
Şöyle yaparız.
pg_repack -k --table mytable mydb;
Hiç yorum yok:
Yorum Gönder