Sample Header Ad - 728x90

When to Run VACUUM ANALYZE on PostgreSQL Tables?

0 votes
1 answer
112 views
I am working with a PostgreSQL database and need some advice on when to run VACUUM ANALYZE on my tables. 1. I am attaching a very large table tmp_details (50 million records) as a partition to an existing table details (500 million records). The details table is actively used for reporting, but I am not performing any other write operations on it. Given the PostgreSQL documentation (https://www.postgresql.org/docs/current/populate.html) suggests running VACUUM ANALYZE after loading large amounts of data: - Is it necessary to run VACUUM ANALYZE on the details table after attaching tmp_details to it? - If yes, should I vacuum the entire details table or just the newly attached partition? 2. I am also creating a new table notreconciled (10 million records) from tmp_details. The notreconciled table will be used both for reporting and as a partition later. Should I run VACUUM ANALYZE on the notreconciled table after creating it? Any insights or best practices would be greatly appreciated!
Asked by Purushottam Nawale (161 rep)
Jan 13, 2025, 03:52 PM
Last activity: Jan 13, 2025, 10:00 PM