What is the difference between optimistic and pessimistic locking?

Поделиться
HTML-код
  • Опубликовано: 7 сен 2024
  • Locking is an important concept in maintaining the integrity of data in a concurrent application.
    Pessimistic locking is the basic form of locking in which we obtain the lock on the database table or record that we are going to update. All the other threads wait for the lock to be released before starting their operation. It means that you need an exclusive lock before updating a record.
    Optimistic locking is another way of locking in which we just check if anyone else has updated the data before us, then we reject the transaction and re-read the data. We generally use a versioning scheme by implementing a version column in data.
    Watch more Playlists:
    System Design Interview Questions: • System Design Intervie...
    Software Architect Questions: • Software Architect Int...
    Microservices Questions: • Microservices Intervie...
    Devops Interview Questions: • DevOps Interview Quest...
    Connect with us:
    Facebook: / knowledgepowerhouse
    Twitter: / knowledgepowe10
    Amazon: www.amazon.com...
    Site: www.knowledgepowerhouse.com

Комментарии • 1

  • @RohitChaurasiyalisten
    @RohitChaurasiyalisten Год назад

    it was nice but one thing when we are discussing about pessimistic locking we need to discuss about isolation also. there are 4 type isolation with combination of isolation and pessimistic locking it will work perfect. Anyway Thanks example was awesome