I am building an ad server and need some advice on aggregating or summerising the data which will happen using a cron every hour.
Basically, when an ad is delivered to a webpage, I need to record that impression and when an ad is clicked I need to record that click. This will happen by creating a new row in a database table, one table for clicks and one table for impressions. But if I am serving millions of impressions and clicks a day, I then need to summerise the clicks and impressions by hour which means adding up all the rows and inserting into a new table (summary table) and then deleting those raw data rows.
What I am unsure about is will reading, writing and dropping rows in a table at the same time cause issues and what is the best way to do this?
Thanks.