0👍
Have you checked out Celery? You might process your queries asynchronously, queuing the queries and then handing results or errors back when they’re available. That seems like a likely path to take if you want to avoid locking.
Otherwise, it does seem like some locking would need to occur.
0👍
Would it be possible for you to add a highest_bid
column to Products
. If my logic is not off, you could then update the highest bid where product_id = x and highest < current_bid
. If this query indicates that a row has been updated then you add the new record to the bid table. This would probably mean that you would have to have a default value for highest_bid column.
Source:stackexchange.com