Hi,
i have a very very large records table, (for example for ab_test_id = 23, it contain upto 20,000 records)
Table1:
id | user_id | batch_id | invitation id | ab_test_id | email_id |
---|
1 | 12 | 23 | dsadad21 | 23 | 1 |
2 | 13 | 24 | assasd23 | 23 | 2 |
3 | 14 | 26 | dsdsad2 | 23 | 1 |
4 | 14 | 23 | dasdsd23 | 26 | 1 |
5 | 12 | 25 | sdad23 | 26 | 2 |
6 | 17 | 23 | sdad231 | 28 | 2 |
Now i have one more table like below
Table 2:
batch_id | email_id | invitation id | user_signed |
---|
23 | 1 | dsadad21 | 1 |
24 | 2 | assasd23 | 0 |
26 | 1 | dsdsad2 | 1 |
23 | 1 | dasdsd23 | 0 |
Now i want to create a table with id, batch_id, user_id, invitation_id, ab_test_id, email_id along with below
1.)count(invitation id) as HITs, where Table1.email_id = Table2.email_id and Table1.batch_id = Table2.batch_id and Table1.invitation id = Table2.invitation id for each email_id
2.)count(invitation id) as signed, where Table1.email_id = Table2.email_id and Table1.batch_id = Table2.batch_id and and Table1.invitation id = Table2.invitation id and user_signed = 1 for each email_id.
To create like this kind, if i use join it will take very very long time to load, so what could be done?
Let me know if you need more info on this. Please help me on this.