operationsengineer1@xxxxxxxxx wrote:
i'm wanting to learn something here so i'm going to chime in. the way i read what you are saying is that you'd have start_date and number_days columns in your table. each day a query would run and pull the start_date and numbers_days columns. the application (or postgresql function) would then take the current date, subtract starte date and compare it to number of days. if it is above that number, the code will take some sort of action. is that about it or have i missed something?
I think that's what Jim's talking about. Databases are good at filtering large numbers of rows.
You'll also want some sort of status code or "processed" flag, so you know not to look at rows you've already handled.
The other alternative would be an "expiry_list" table that stores the target row's key and when it expires. Add a row when the contract is created. Delete the row when the contract is paid. Keep it all up-to-date with triggers.
-- Richard Huxton Archonet Ltd