Search Postgresql Archives

Re: help modeling a schedule system

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Well, when I did something similar a very long time ago, I put a "next time to fire" column in the table. Each time an event is fired, the application updates that column.

Was a lot simpler than baroque searches for events that would need firing between the last check and now. Was a lot cleaner than creating tons of instances out through the future.

You could create a stored procedure, if you want, to calculate the next time based on all the possible criteria.

You could, have a "last time fired" column that keeps track of when the event was most recently fired, for logging/debugging/info. You could have a trigger that updates that "next time to fire" column each time the "last time fired" column is updated.

-- 
Scott Ribe
scott_ribe@xxxxxxxxxxxxxxxx
http://www.elevated-dev.com/
(303) 722-0567 voice





-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux