Re: Multiple execution of the same job against same data

From: Pilks <richardp_at_lukhozi.co.za>
Date: Mon, 12 Oct 2015 07:59:09 -0700 (PDT)
Message-ID: <fbf1328b-00e6-457a-a18c-75f6bfc29435_at_googlegroups.com>


On Sunday, October 11, 2015 at 3:34:59 PM UTC+2, tagu..._at_gmail.com wrote:
> Hi folks:
>
> Environment: linux, php and mysql.
>
> I have a process that I am planning to execute automatically with a CRON, every 5 minutes. This process updates all records with status 'P' to 'E', based on certain criteria. That far everything good and simple.
>
> But here is the kicker: On the front end, users are constantly adding new 'P' records to the table, so it could happen that before the update process ends, there may be new 'P' records added.
>
> The questions are:
>
> 1) Will the update process update those as well, or they will be left 'P' until the next execution?
>
Luis

That depends on how you are processing those in the table. 1. Do you read the table in a select that looks for a "P" record then process it, then select again for the next "P" record? 2. Do you read all "P" records and process them in PHP one at a time?

If 1 then they could be handled. If 2 only those present when you selected the "P" records will be processed.

Richard

> 2) What if there are so many 'P' records that the update process doesn't end within the 5 minutes and CRON fires up another instance of the update process? Will that screw up the database?
>
> Any help appreciated.
>
> Regards,
>
> Lou
Received on Mon Oct 12 2015 - 16:59:09 CEST

Original text of this message