0

I am working on revamping the database at the company I work at. I've been making decent progress getting various parts set up, but something occurred to me today that I hadn't really thought to consider as a variable for my setup.

With this database, there is the potential for there to be multiple users accessing it at the same time. Now it isn't an insane amount, like 50 different users all going at it at once. Rather the situation is closer to their being 2 or 3 users that can be assumed to be accessing the database at the same time.

Now each of these users would potentially be Updating, Adding, or Deleting records within the database. As such I am concerned about potential problems arising from a situation like the following:

Employee A begins editing a record
Employee B deletes the record Employee A is current editing
Employee A goes to commit changes, but the record no longer exists

So what are some ways I can set up the database to get around issues like this? Each person will be logged in to the database on an account, so I can track who is online and potentially making changes. What is some recommended reading any of you would have for a situation like this?

6
  • Theoretically depending on how you have your isolation level set up there should be locks that prevent this sort of thing from happening for the most part. How are your users editing rows? Is there an application front end or are they running sql scripts directly against the database?
    – Zane
    Commented Aug 15, 2018 at 18:04
  • @Zane There would be an application front end they'd be using which runs the queries in the background. Commented Aug 15, 2018 at 18:08
  • 1
    You have correctly identified a common problem called concurrency. This is a well-researched topic, and there are several textbooks written on the topic.
    – vonPryz
    Commented Aug 15, 2018 at 18:08
  • @Skitzafreak well then it will likely depend on how your application handles concurrency if the application holds open the transaction for user A while user B attempts his delete then the database should block that operation from occurring. However once user A makes his change user B will be able to delete the row. Without knowing more about how your app works it would a be a bit hard to answer however as von said their are tons of articles and books about handling this.
    – Zane
    Commented Aug 15, 2018 at 18:16
  • @vonPryz Thank you, I wasn't sure if the issue I was thinking of had a specific name or something. But now it'll make it easier to look for topics online. :) Commented Aug 15, 2018 at 18:18

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.