Databases (and search engines like Elasticsearch) typically store the date of birth instead of the current age. It's a simple date value instead of a calculated one which must be maintained every day. But statistics often should contain the age - which is much more pleasant for humans than the date (or year) of birth. This post shows an easy way to use the Elasticsearch date_histogram aggregation to output age buckets instead of counting users by their year of birth.
Suchergebnisse mit Tag „statistics“
Statistics are nice, but may also increase database load. Counting web users (page impressions) may produce a lot of UPDATE requests setting counter=counter+1. I tried to merge them using Gearman.
Memcached is a great tool for speeding up your database access. A "stats" command returns usage statistics but few documentation is available on what's returned.
Statistics are important for many projects, but not all of them are easy to build. Many long-term stats involve heavy SQL queries and some may of these queries may also freeze database servers or tables. Caching intermediate results may limit these queries to a minimum.