Cache stats in the database (and auto-update them from cron)

This commit is contained in:
Yorhel 2012-07-18 10:21:13 +02:00
parent f6564dfd9c
commit 0738583243
3 changed files with 18 additions and 5 deletions

View file

@ -7,3 +7,9 @@ CREATE INDEX ON man_index_new USING btree(lower(name) text_pattern_ops);
DROP TABLE man_index;
ALTER TABLE man_index_new RENAME TO man_index;
COMMIT;
BEGIN;
CREATE TABLE stats_cache_new AS SELECT count(distinct hash) AS hashes, count(distinct name) AS mans, count(*) AS files, count(distinct package) AS packages FROM man;
DROP TABLE stats_cache;
ALTER TABLE stats_cache_new RENAME TO stats_cache;
COMMIT;