---
title: "What is difference between Optimistic and Pessimistic locking?"  
description: "What is difference between Optimistic and Pessimistic locking?"  
author: "Sumit Kesarwani"  
published: 2014-01-27  
updated: 2020-09-24  
canonical: https://www.mindstick.com/interview/1890/what-is-difference-between-optimistic-and-pessimistic-locking  
category: "c#"  
tags: ["c#"]  
reading_time: 1 minute  

---

# What is difference between Optimistic and Pessimistic locking?

In Pessimistic locking when user wants to update data it locks the record and till then no one can update data. Other user’s can only view the data when there is pessimistic locking

In Optimistic locking multiple users can open the same record for updating, thus increase maximum concurrency. Record is only locked when updating the record.

## Answers

### Answer by Sumit Kesarwani

In Pessimistic locking when user wants to update data it locks the record and till then no one can update data. Other user’s can only view the data when there is pessimistic locking

In Optimistic locking multiple users can open the same record for updating, thus increase maximum concurrency. Record is only locked when updating the record.


---

Original Source: https://www.mindstick.com/interview/1890/what-is-difference-between-optimistic-and-pessimistic-locking

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
