Oracle] talking about Lock and Latch

Source: Internet
Author: User

The following is a detailed analysis of the similarities and differences between Lock and Latch in Oracle. For more information, see

First, let's talk about what they have in common:They are essentially an exclusive lock on resources and are all caused by concurrency (if the database has only one session, it cannot be locked ).

Next we will focus on their differences:

FirstThey have different purposes. enqueue (that is, the Lock and Oracle official documents use these two terms together. In the waiting event, we can see that a large number of enqueue are actually locks) it is to solve data contention at the business layer, while latch is to solve the contention of memory resources.

SecondThey run in different ways. enqueue uses the queuing method, first come first served, while latch's competition is almost unordered. In a random way, first come first served, not necessarily first served, in addition, it is also a time slice round training method that won't be occupied all the time. It is not finished yet, and the time slice is one to one.

ThirdThe session length is different. The enqueue may be held for a long time based on the business situation, while the latch is usually very short. Fourth, the cause is different. Too many enqueue is usually a problem of business design, while too many latch are, it is generally a problem at the database level (for example, no Bound variables, tables, or index hot blocks are used ).

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.