maintenance.sql 676 Bytes
Newer Older
chove's avatar
chove committed
1
-----------------------------------------------------------------
2
-- Maintenance de la base pgsql sur thot, lancé par cron
chove's avatar
chove committed
3 4 5
-----------------------------------------------------------------

-- effacement des vieux enregistrements
6
DELETE FROM upload where date< timestamp 'now' - interval '2 days';
7 8
-- On ne blackliste plus pour virus, on droppe seulement
-- DELETE FROM virus where date< timestamp 'now' - interval '2 days';
9
DELETE FROM flood where date< timestamp 'now' - interval '2 days';
chove's avatar
chove committed
10 11

-- suppression complète des entrées
12
VACUUM;
chove's avatar
chove committed
13 14 15 16 17 18

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