Shrink Postgres DB

Started by Spheron, July 29, 2025, 09:18:00 AM

Previous topic - Next topic

Spheron


Hello @all,

played here around with windows event logging in NetXMS V5.2.4 (Debian, Postgres).

Therefore the database size blowed up. I have changed serveral retention values an the housekeeper is running a few minutes an do it's best, but the database don't shrinks.

What can i do to shrink the DB? Deleting and restoring?

Greetings
Marco

Filipp Sudanov

If you've been using windows event syncronization, then 

VACUUM FULL WIN_EVENT_LOG; 
query might help, but it also needs additional disk space for it to run (https://www.postgresql.org/docs/current/sql-vacuum.html). 

If do don't need any records from this table, then
TRUNCATE WIN_EVENT_LOG;
will clean all records and instantly reclaim disk space

Spheron


Hi Filipp,

you are my hero!!!  ;D

Thanks for the infos. I truncate the table and postgres frees up the storage space...

Many thanks!

Greetings
Marco