Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Reclaim disk space without locking table - PostgreSQL 10

I have a couple of tables in a PostgreSQL database which are used very frequently (for Insert/Delete purposes). Sometimes, their size of the tables grow up to GB's. How do I reclaim the disk space from these tables without locking them. These tables need to be used almost all the times so I can't afford getting them locked. VACUUM FULL reclaims the disk space however locks the table so I can't use FULL option.

Can someone please suggest a way?

Thanks

like image 693
P_Ar Avatar asked Oct 27 '25 08:10

P_Ar


1 Answers

Often you can avoid the problem by configuring autovacuum sufficiently aggressive that it can keep up with the change rate.

If that doesn't do the trick, or if you have regular mass DELETEs, look into a tool like pg_squeeze or pg_repack.

like image 77
Laurenz Albe Avatar answered Oct 28 '25 22:10

Laurenz Albe