maintenance.sql 817 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 '5 days';
7
-- la même pour upload6
8
DELETE FROM upload6 WHERE date< timestamp 'now' - interval '5 days';
9 10
-- On ne blackliste plus pour virus, on droppe seulement
-- DELETE FROM virus where date< timestamp 'now' - interval '2 days';
11 12
-- Idem pour flood
-- DELETE FROM flood where date< timestamp 'now' - interval '2 days';
chove's avatar
chove committed
13 14

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

-- réindexation des tables
REINDEX TABLE upload;
Vincent Le gallic's avatar
Vincent Le gallic committed
19
REINDEX TABLE upload6;
20
-- REINDEX TABLE virus;
chove's avatar
chove committed
21 22
-- REINDEX TABLE flood; -- flood n'a pas d'index
REINDEX TABLE p2p;