You usually have the "autovacuum" daemon running alongside Postgres. AFAIK, it collects stats from Postmaster and runs VACUUM/VACUUM ANALYZE/VACUUM FULL according to some policies of its own.
Our sysadmins here tend to switch it off and run a cronjob at known times instead, to avoid autovacuum running at unexpected times. Which reminds me: any repair/vacuum feature we do in Moodle needs to be easy for sysadmins to disable.
If I think about it, Moodle depends on the DB enough that trying to run a table-locking VACUUM FULL interactively could end up not working -- HTTP timeouts and session locking problems. Cron.php perhaps?
General developer forum
Databases: Any measures against MySQL corruption?
This discussion has been locked so you can no longer reply to it.