Best practices for multithreaded processing of database records

前端 未结 5 1087
小蘑菇
小蘑菇 2020-12-31 05:11

I have a single process that queries a table for records where PROCESS_IND = \'N\', does some processing, and then updates the PROCESS_IND to \'Y\'

5条回答
  •  [愿得一人]
    2020-12-31 05:48

    The most obvious way is locking, if your database doesn't have locks, you could implement it yourself by adding a "Locked" field.

    Some of the ways to simplify the concurrency is to randomize the access to unprocessed items, so instead of competition on the first item, they distribute the access randomly.

提交回复
热议问题