涉及广告网络分析的Mysql应用程序:表格设计

Now, I am recording impressions, clicks, ctr. impressions are the ad impressions, clicks are the ad clicks and ctr is the click through rate worked out by = clicks/impressions Currently I have three tables->

  1. in_table(in_imp, in_clks, in_ctr) for advertisers
  2. out_table(out_imp, out_clks, out_ctr) for publishers

Now I was wondering what would be a better way to reorganise this table structure.

In general I see nothing wrong but I'd suggest you take a look at openx and see how they collect and store data. I'm not saying that their way is the only way, but openx is a very popular adserver and has been around the block a while.

Add to that, that openx has a ton of features and you might just end up using it.

Generally it's hard to suggest a one-size-fits-all table setup because IMHO this very much depends on data volume (e.g. how many, how fast) and also on the reports you want to create from data. MySQL may not even seem to be the perfect tool for the job - but who knows.

Since you plan on using MySQL my other suggestions for you are to investigate table engines (e.g. MyISAM vs. INNODB), then to think about how to break up data (e.g. a table per week, or month?) and also to think ahead about aggregating the data for reports and so forth later on.