Files
DBAdmin/inbox/DataBase/PostgreSQL/maintenance/vacuum.sql
T
2026-05-18 06:40:19 +00:00

25 lines
695 B
SQL
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
VACUUM - > REMOVES DEAD ROWS, AND MARK THEM FOR REUSE, BUT IT DOESNT RETURN THE SPACE TO ORACLE,. IT DOESN'T NEED EXCLUSIVE LOCK ON THE TABLE.
-------------------------------------------------------------------------
vacuum a table:
dbaclass=# vacuum dbatest.emptab;
VACUUM
both vacuum and analyze:
dbaclass=# vacuum analyze dbatest.emptab;
VACUUM
with verbose:
dbaclass# vacuum verbose analyze dbatest.emptab;
Monitor vacuum process( if vacuum process runs for a long time)
dbaclass#select * from pg_stat_progress_vacuum;
Check vacuum related information for the table
dbaclass=# select schemaname,relname,last_vacuum,vacuum_count from pg_stat_user_tables where relname='emptab';