diff options
author | Marko Kreen | 2012-07-09 09:47:02 +0000 |
---|---|---|
committer | Marko Kreen | 2012-07-09 09:47:02 +0000 |
commit | 82c67156bb05033832ab1ce3dbf7c13fe3fcd6f6 (patch) | |
tree | 25df05bcfcb870d7776a6ca0b2160e1ff0eb7b46 | |
parent | b312a974de686fe9764ed06809eed1f8215452ce (diff) |
londiste.periodic_maintenance: cleanup for applied_execute
-rw-r--r-- | sql/londiste/functions/londiste.periodic_maintenance.sql | 18 | ||||
-rw-r--r-- | sql/londiste/structure/functions.sql | 1 | ||||
-rw-r--r-- | sql/londiste/structure/grants.ini | 1 |
3 files changed, 20 insertions, 0 deletions
diff --git a/sql/londiste/functions/londiste.periodic_maintenance.sql b/sql/londiste/functions/londiste.periodic_maintenance.sql new file mode 100644 index 00000000..0b70d09e --- /dev/null +++ b/sql/londiste/functions/londiste.periodic_maintenance.sql @@ -0,0 +1,18 @@ + +create or replace function londiste.periodic_maintenance() +returns integer as $$ +-- ---------------------------------------------------------------------- +-- Function: londiste.periodic_maintenance(0) +-- +-- Clean random stuff. +-- ---------------------------------------------------------------------- +begin + + -- clean old EXECUTE entries + delete from londiste.applied_execute + where execute_time < now() - '3 months'::interval; + + return 0; +end; +$$ language plpgsql; -- need admin access + diff --git a/sql/londiste/structure/functions.sql b/sql/londiste/structure/functions.sql index b903f100..4c8322a5 100644 --- a/sql/londiste/structure/functions.sql +++ b/sql/londiste/structure/functions.sql @@ -34,6 +34,7 @@ select londiste.upgrade_schema(); \i functions/londiste.local_set_table_state.sql \i functions/londiste.local_set_table_attrs.sql \i functions/londiste.local_set_table_struct.sql +\i functions/londiste.periodic_maintenance.sql -- Group: Utility functions \i functions/londiste.find_column_types.sql diff --git a/sql/londiste/structure/grants.ini b/sql/londiste/structure/grants.ini index 1e077438..0c704014 100644 --- a/sql/londiste/structure/grants.ini +++ b/sql/londiste/structure/grants.ini @@ -54,6 +54,7 @@ londiste_remote_fns = # used by owner only londiste_internal_fns = + londiste.periodic_maintenance(), londiste.upgrade_schema() # used by local worker, admin |