user3814846
user3814846

Reputation:

Vacuum tables in postgresql

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

Upvotes: 13

Views: 31550

Answers (1)

Hasan Ramezani
Hasan Ramezani

Reputation: 5194

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

Upvotes: 4

Related Questions