Let's talk about what they have in common: they are essentially an exclusive lock on resources, all caused by concurrency (if the database has only one session, it cannot be locked ).
Next we will focus on their differences:
First, they have different purposes. enqueue (that is, Lock, Oracle official documents use these two terms together. In the waiting event, we can see a large number of enqueue, which is actually lock) it is to solve data contention at the business layer, while latch is to solve the contention of memory resources.
Second, they 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, instead of being snatched, 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.
Third, the session length is different. enqueue may hold the session for a long time based on the business situation, while 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 ).
For more information about Oracle, see the Oracle topic page.