To ensure proper database running, after insert and deletion operations, you need to routinely run VACUUM FULL and ANALYZE based on customer scenarios and update statistics to obtain better performance.
You need to routinely run VACUUM, VACUUM FULL, and ANALYZE to maintain tables, because:
VACUUM FULL customer; VACUUM
VACUUM FULL needs to add exclusive locks on tables it operates on and requires that all other database operations be suspended.
ANALYZE customer; ANALYZE
Run ANALYZE VERBOSE to update statistics and display table information.
ANALYZE VERBOSE customer; ANALYZE
You can use VACUUM ANALYZE at the same time to optimize the query.
VACUUM ANALYZE customer; VACUUM
VACUUM and ANALYZE cause a substantial increase in I/O traffic, which may cause poor performance of other active sessions.