Stats Design
From Dreamwidth Notes
This is a a loosely organized collection of notes and links for the Stats feature design. (Note: this is for the new stats system only - there's an existing legacy system too.)
Table definitions:
CREATE TABLE statkeylist ( statkeyid INT UNSIGNED NOT NULL AUTO_INCREMENT, name VARCHAR(255) DEFAULT NULL, PRIMARY KEY (statkeyid), UNIQUE KEY (name) ) CREATE TABLE site_stats ( category_id INT UNSIGNED NOT NULL, key_id INT UNSIGNED NOT NULL, insert_time INT UNSIGNED NOT NULL, VALUE INT UNSIGNED NOT NULL, -- FIXME: This is good for retrieving data for a single category+key, but -- maybe not as good if we want all keys for the category, with a limit on -- time (ie, last 5 entries, or last 2 weeks). Do we need an extra index? INDEX (category_id, key_id, insert_time) )
Storing statistics: DW::StatStore
Statistics: DW::StatData and DW::StatData::*
Collecting statistics: bin/worker/stats-collection and etc/stats-collection.conf
Displaying statistics: htdocs/stats/* (public stats) and htdocs/admin/stats.bml (restricted stats)