Assumptions: we have 100,000 Orders which hold the status = Locked | unlocked for update.
when the order is created it is unlocked. We can also create filter saying "when delivery time - current time < 10 hours, lock the order", lets say its called as Window time (10 hours)
To do this, there is a scheduler which will update the order if the condition to lock the order is true,
What is the efficient way to achieve this?
--- one solution, lets brain storm ---
1. select the order with status = unlocked (locked status need not be locked again).
2. See if the order is supposed to lock, lock if the condition of Window is true otherwise, leave it unlocked.
repeat this every 2 minutes, this seems like a weired idea. Db has to query all the orders in step 1 to get the list of orders which are unlocked. (performance will suck as orders will be increasing day by day, RIGHt).
--------- Please post your solutions to achieve this ---
* I was thinking of creating a view with orders having unlocked status ..
..
.. your suggestions ?