IBM Db2 - The Ultimate Database for Cloud, Analytics & Mobile
I need help for the following issue I have :
A table contains records with a STATUS column. This status is either 'TO BE PROCESSED' or 'PROCESSED'. New records with status 'TO BE PROCESSED' are added continuously into this table.
Now we want to develop an application that regularly looks to see if there are records to be processed and this application should run in parallel so the speed up the processing of these records.
Put in other words : the first connection looks for records using following query :
select col1,col2 from table where STATUS_CODE = 'TO BE PROCESSED' fetch first 20 rows for update of STATUS_CODE.
The intention is that this first connection selects 20 records to be processed and then subsequently processes them. In the meantime, other parallel connections should select and process another set of 20 records and so on.
The issue we encounter is that the parallel connections are locking each other ans so, do not run in parallel.
I read about the SKIP LOCKED ROW option that exists in DB2 z/OS but we run DB2 LUW v10.5 , with CUR_COMMIT enabled and the SKIP LOCKED ROW option does not exist in LUW
Any suggestions on how to simulate this SKIP LOCKED ROW behaviour on DB2 LUW ?