maintenance.sql 687 Bytes
Newer Older
chove's avatar
chove committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
-----------------------------------------------------------------
-- Maintenance de la base pgsql sur rouge, lancé par cron
-----------------------------------------------------------------

-- effacement des vieux enregistrements
DELETE FROM upload where date< timestamp 'now' - interval '2 days';
DELETE FROM virus where date< timestamp 'now' - interval '2 days';
DELETE FROM flood where date< timestamp 'now' - interval '2 days';
DELETE FROM p2p where date< timestamp 'now' - interval '2 days';

-- suppression complète des entrées
VACUUM FULL;

-- réindexation des tables
REINDEX TABLE upload;
REINDEX TABLE virus;
-- REINDEX TABLE flood; -- flood n'a pas d'index
REINDEX TABLE p2p;