mysql - Best way to aggregate logging data -


so have database contains logs of people clicking link. store id, country, referrer-domain, clickedat. last column timestamp.

at moment there not lot of rows, if takes off might tens hundreds of thousands of rows. best way query database things this:

  • times viewed per day past month
  • top 20 countries used link
  • top 20 websites referring link

using count(*) way slow. i've seen techniques add query every update, insert, delete happens save in special aggregation table. i'm not sure work, i'd have users able select 2 specific dates example. or i'd have aggregate day.

if add indexed date, column, you're not doing date/time calculations on fly, should able query using normal aggregations. take long time before 'way slow' formatted queries.

if takes off, de-normalising data describe, don't optimise prematurely!


Comments

Popular posts from this blog

Command prompt result in label. Python 2.7 -

javascript - How do I use URL parameters to change link href on page? -

amazon web services - AWS Route53 Trying To Get Site To Resolve To www -