Alarm/Reminder app

I am trying to code an alarm/reminder desktop app using a DB.

The idea is that many users can create alarms in the shared DB, and when a certain alarm/reminder is triggered it will popup a notification on the client’s machine. Pretty much like a calendar/scheduler.

Well, the approach that comes to my mind first is to check every second for the complete list of records in the active reminders list and if the date and time matches (in any record), the ‘now’ time and date of the system, then trigger the notification.
But that means that I have to read the DB every second, which I’m not sure is the best… Is this the right approach ?


I check once a minute. Every second is too much for an alarm. And index the db by user by date/time. You only need the first record then.

The first record only,? Sorry Tim, I don’t understand how do I not need the full list to check…

I’m assuming that each user is going to have the alarm app running in the background. Therefore, you’re only checking one user at any given time. (Each instance of the alarm app is associated with a single user.) I also forgot to mention that each record should have an Open (or Processed - Open=‘Y’ or Processed=‘N’) flag. That flag should also be part of the index. So if your records are indexed by Open, User, DateTime, and if Open and User are fixed, then the first record returned is the next alarm that needs to be considered for this user. If the DateTime is less than or equal to the current DateTime, then show the alarm. It’s very efficient.

got it now… thanks for the explanation…