Hit stats aggregation

Page views
What's available from each hit:
 * page name
 * referrer:
 * local wiki/page
 * foreign URL
 * client:
 * geoip lookup (country or city-resolution?)

Image views
What's available from each hit:
 * image name
 * thumbnail pixel width
 * page number [for pdf, djvu]
 * referrer:
 * local wiki/page
 * foreign URL
 * client:
 * geoip lookup (country or city-resolution?)

General

 * Aggregation resolution?
 * View style?
 * How much to combine / make available?

Storage
Raw hit counts would be real easy:
 * img_stats
 * is_img (varchar) -> img_name
 * is_timestamp: start time
 * is_period (int): number of seconds covered by this time period [5 minutes, 1 hr, 7 days, whatev]
 * is_hits (int)

To do breakdowns maybe split it up...


 * img_stats
 * is_id (int) primary key
 * is_img (varchar) -> img_name <- absurdly inefficient!
 * is_timestamp: start time
 * is_period (int): number of seconds covered by this time period [5 minutes, 1 hr, 7 days, whatev]
 * is_hits (int)
 * img_stats_region
 * isr_id (int) -> is_id
 * isr_country char(2)
 * isr_hits (int)
 * img_stats_size
 * iss_id (int) -> is_id
 * iss_size_min (int) <- break down into ranges since we allow open-ended sizes :P
 * iss_size_max (int)
 * iss_hits (int)
 * img_stats_referer
 * isr_id (int) -> is_id
 * isr_url varchar(255) <- absurdly inefficient for multiple hits
 * isr_hits (int)