NetXMS Support Forum

English Support => General Support => Topic started by: Spheron on July 29, 2025, 09:18:00 AM

Title: Shrink Postgres DB
Post by: Spheron on July 29, 2025, 09:18:00 AM

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
Title: Re: Shrink Postgres DB
Post by: Filipp Sudanov on July 29, 2025, 11:41:10 AM
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
Title: Re: Shrink Postgres DB
Post by: Spheron on July 29, 2025, 01:04:53 PM

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