Dealing with concurrent updates

Does anyone have suggestions on resources, concepts and topics to look into on handling concurrent updates? Like I have two different systems possibly updating the same record/object, how should I be handling concurrent updates to prevent duplicates and other issues. The two different systems have their own db but eventually the shared data has to be written in a middleware postgres db that has to handle the concurrent scenarios.
7 Replies
JavaBot
JavaBot3d ago
This post has been reserved for your question.
Hey @Kale Vivi! Please use /close or the Close Post button above when your problem is solved. Please remember to follow the help guidelines. This post will be automatically marked as dormant after 300 minutes of inactivity.
TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here.
ayylmao123xdd
ayylmao123xdd3d ago
try database locking optimistic and pessimistic depending on the use case
dan1st
dan1st3d ago
it depends on what you are dealing with if it's about concurrency within your application, you can use language mechanisms: https://discord.com/channels/648956210850299986/1027179147086282752 If you it's about synchronizing access to a DB from multiple applications, you would want to use the mechanisms provided by the DB (e.g. locking or transactions)
Kale Vivi
Kale ViviOP3d ago
How does the db or language know the order of the inserts/updates/changes? Is it based on ids or timestamps or..? I'll start reading up on the concepts above. thanks!
JavaBot
JavaBot3d ago
If you are finished with your post, please close it. If you are not, please ignore this message. Note that you will not be able to send further messages here after this post have been closed but you will be able to create new posts.
dan1st
dan1st3d ago
if it gets a request for doing an operation and it can execute the operation, it does that
JavaBot
JavaBot3d ago
💤 Post marked as dormant
This post has been inactive for over 300 minutes, thus, it has been archived. If your question was not answered yet, feel free to re-open this post or create a new one. In case your post is not getting any attention, you can try to use /help ping. Warning: abusing this will result in moderative actions taken against you.

Did you find this page helpful?