vacuum for each relation vacuum_rel full_vacuum_rel (if vacuum full) scan_heap pg_rusage_init(&ru0); ereport(vacuuming tableX); vacuum the table ereport(all information + pg_rusage_show(&ru0)) for each index vacuum_index pg_rusage_init(&ru0); clean the index ereport(all information + pg_rusage_show(&ru0)) check for tuple count mismatch vacuum_heap or repair_frag update free space map update statistics in pg_class report results to the stat collector lazy_vacuum_rel (if vacuum) open the indexes lazy_scan_heap pg_rusage_init(&ru0); ereport(vacuuming tableX); for each index lazy_vacuum_index pg_rusage_init(&ru0); clean the index ereport(all information + pg_rusage_show(&ru0)) lazy_vacuum_heap ereport(all information + pg_rusage_show(&ru0)) close the indexes optionnaly truncate the relation update free space map update statistics in pg_class report results to the stat collector vacuum_rel(toast table if any) same as above analyze_rel (if analyze)