[ic] Database values changing during a job

Kevin Walsh kevin at cursor.biz
Sun Oct 29 13:38:18 EST 2006

Grant <emailgrant at gmail.com> wrote:
> I have a job that allocates available inventory to orders based on a
> bunch of different factors.  It takes about 20 minutes to run and it's
> run every hour.  The problem is, if certain values change during the
> job's execution, it will be thrown off.
> I thought of setting up a cache of certain values before the job is
> run and comparing them when the job is complete so the job can be
> re-run if anything has changed.  Alternatively, is there anything
> built into mysql that I could use to straighten this out?
Perhaps you could set up a couple of staging tables.  Copy working data
into the staging table(s) and run your job against those.  I'm sure you
don't want to lock the tables for 20 minutes at a time, every hour.

On the other hand, wouldn't it be better to allocate inventory to orders
as soon as the orders are placed, and/or as soon as new stock comes in,
rather than running a job every hour.  It sounds a lot less error-prone
to me.

   _/   _/  _/_/_/_/  _/    _/  _/_/_/  _/    _/
  _/_/_/   _/_/      _/    _/    _/    _/_/  _/   K e v i n   W a l s h
 _/ _/    _/          _/ _/     _/    _/  _/_/    kevin at cursor.biz
_/   _/  _/_/_/_/      _/    _/_/_/  _/    _/

More information about the interchange-users mailing list