Vacuum tables in postgresql

16,130

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

Share:
16,130
Admin
Author by

Admin

Updated on June 13, 2022

Comments

  • Admin
    Admin almost 2 years

    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 return 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