order order form field id order_no (order number) business_id (merchant ID) user_id (member ID) money (consumption amount)
user membership table id name member name
business merchant form id name merchant name
cardinality: 200merchants A merchant may have 200customers
premise: members buy once, second purchase is considered repurchase
question: are there any good designs and ideas
the method I have come up with at present:
create a new table and save the relationship between merchants and members
re_business_user
< table > < thead > < tr > < th > business_id < / th > < th > user_id < / th > < th > number < / th > < th > money < / th > < th > date < / th > < th > created_at < / th > < / tr > < / thead > < tbody > < tr > < td > merchant ID < / td > < td > user ID < / td > < td > number of purchases < / td > < td > purchase amount < / td > < td > time (2018-05-11) < / td > < td > creation time < / td > < / tr > < / tbody > < / table > every day, when a merchant buys goods, users query whether the re_business_user data exists (add date equal to the current time 2018-05-11 in the where condition). There is no new one-day record. If there is, update the purchase times + 1 and increase the purchase amount
so that I can quickly calculate the 7-day repurchase rate, 15-day repurchase rate and 30-day repurchase rate
this design will result in a large amount of data in the whole table, and there will be about 120W of data in a month (200 200 30)
do you bosses have any good ideas to solve this problem? Thank you