Well, you might have a column in the table that says if the record is being processed. As part of the transaction, retrieve the data for the record that is not currently being processed, and update the record to say that it is now being processed. The details of how conflicts will be handled will depend on the type of transactions you create and the database you use, but I suspect that transactions should be at the center of it.
Assuming you really want to use a database, rather than a message queue of some description. You might want to use a message queue in conjunction with a database ... and some databases have queues built into them, which can also be useful. Even if you need an entry in the database, you can only have a queue from identifiers β clients can simply pull the next item out of the queue and then retrieve the data. You can still record the time at which the item was taken out of the queue, so if the client works or something like that, the batch job can put any failed jobs (for example, those that were collected a day ago, t there are still results) in the queue.
Jon skeet
source share