Vacuum tables in postgresql

user3814846 picture user3814846 · Sep 13, 2014 · Viewed 14k times · Source

Using ,at this moment am finding the tables that have dead_tuples using the following query

select relname from pg_stat_user_tables where n_dead_tup > 0

this will retuns the table name and then I'll run

VACUUM VERBOSE ANALYZE <table_name>

Is that a good method or do I need to change it,if so please suggest me some methods

Thanks

Answer

Hasan Ramezani picture Hasan Ramezani · Sep 13, 2014

according to Documentation

VACUUM reclaims storage occupied by dead tuples.

But according to this post

Dead rows are deleted rows that will later be reused for new rows from INSERTs or UPDATEs. Some dead rows (or reserved free space) can be particularly useful for HOT (Heap-Only Tuples) updates that can reuse space in the same data page efficiently