I want to send bulk email to my site users and the email will be sent to lets say 100k+ users at a time. What I want to achieve is to keep record of my mail()
function calls i.e. as soon as the mail is sent to the user, an entry is added for that user in the temporary table. This helps me in condition if my server crashes then I can send the emails to the rest of the users.
Here's my problem:
I select the records from the users table where the records are NOT IN (select sent_ids from temp_table)
If there are to many sent IDs, let's say 70% of the total users, then it will make the query relatively slow.
What can I do to solve my problem?