How do I fire scheduled events (datetime) without checking the database every second for each record?

Viewed 34

I have rows of data containing an email address, phone, message, and a datetime.The message will be sent to the email address and phone number at the specified datetime. It might also be sent to a webhook URL.

Suppose I have 50 million rows of these data with dates spanning to over a year in the future. And Suppose I want the messages sent the second they're due or even within the minute they're due.

Does Calendly really check their databases each minute to send those '30minute before' notifications for millions of events? Does Gmail check the database every second if a scheduled email is due? Or is there another way to fire events specified in the database without querying as much?

0 Answers
Related