maintenance.sql 816 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
-- la même pour upload6
DELETE FROM upload6 WHERE date< timestamp 'now' - interval '2 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;
19 20
REINDEX TABLE upload6
-- REINDEX TABLE virus;
chove's avatar
chove committed
21 22
-- REINDEX TABLE flood; -- flood n'a pas d'index
REINDEX TABLE p2p;