Let's say I have a table named products
and I want to know how many times the products were searched, viewed and purchased. I want also to know when the products were searched, viewed and purchased.
My first approach was to make a table with the product_id
, a field indicating if the item was 0=searched
, 1=viewed
and 2=purchased
and another field keeping the ´datetime´ of the event, so I can filter by time.
This works pretty well, but is NOT scalable. If I have 50,000 products in the database and 1,000 users making 5 searches each one every day, then I have 50,000 * 1,000 * 5 = 250'000,000
new records per day, so this not looks like the perfect solution to me.
I have a few ideas about how to enhance this but I'd really like to read about better ways, since I'm not happy with mine.