From c3068c892514080d8bb1b1029bfb2182b6eac79a Mon Sep 17 00:00:00 2001 From: Michael Vogel Date: Sat, 28 Nov 2015 13:19:09 +0100 Subject: [PATCH] Optimize tables on a daily base that are written very often --- include/cron.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/include/cron.php b/include/cron.php index 7b2244b55e..46d56f077e 100644 --- a/include/cron.php +++ b/include/cron.php @@ -189,6 +189,14 @@ function cron_run(&$argv, &$argc){ q('DELETE FROM `photo` WHERE `uid` = 0 AND `resource-id` LIKE "pic:%%" AND `created` < NOW() - INTERVAL %d SECOND', $cachetime); } + // Optimize some tables that are written often + q("OPTIMIZE TABLE `cache`"); + q("OPTIMIZE TABLE `session`"); + q("OPTIMIZE TABLE `config`"); + q("OPTIMIZE TABLE `pconfig`"); + q("OPTIMIZE TABLE `photo`"); + q("OPTIMIZE TABLE `workerqueue`"); + set_config('system','cache_last_cleared', time()); }