Skip to Main Content

Breadcrumb

Question and Answer

Tom Kyte

Thanks for the question, ANTONYRAJ.

Asked: April 27, 2010 - 11:01 am UTC

Last updated: February 01, 2013 - 8:48 am UTC

Version: 11.1.0.7

Viewed 1000+ times

You Asked

Hello Tom,
Could you please explain the reason behind having both parent and child latches in Oracle? and why some of the parent latches doesn't have child latches?
and what is the differnece between parent and solitary latches?
Why does Oracle is still using _SPIN_COUNT of 2000?I guess the value was set long ago when the processor speeds were much slower.Considering the current processing power of processors,is it recommended to increase the _SPIN_COUNT value? Thanks.


and Tom said...

first of all, do not touch _ parameters.

Think about it, your logic that spin count should be higher because cpu's are faster would only hold true if the latch holder was running at the OLD SPEED.

Latches are designed to serialize access to shared data structures - shared data structures that are to be held by someone for a very very short period of time. The spin count was set to hold the latch requester on the cpu for a given number of cpu cycles. Now, if the goal was cpu cycles and the cpu cycles become faster - does that mean we should wait for more cpu cycles? No - it wouldn't - we are still holding on for so many cpu cycles. spin_count is not spin_elapsed_time - it is a count of times to spin (cpu cycles to burn) and works regardless of the speed of the cpu cycles.



having child latches allows us to have more than one latch - to break a big structure (say the shared pool) into smaller substructures and assign each a child latch to cover it. If we use the child latch - we typically don't use the parent latch (although we can use it to aggregate statistics up in reports and what not).

If a parent latch doesn't have any children, the structure it protects was not deemed "big enough" - the shared pool is only split up if it is large and you have many cpu's. Also, if you have one cpu - having lots of child latches doesn't make sense anymore (only one thing happening on that system anyway!)


Rating

  (3 ratings)

Is this answer out of date? If it is, please let us know via a Comment

Comments

ANTONYRAJ CHINNAPPAN, April 27, 2010 - 1:10 pm UTC

Thanks Tom!

Antony, April 27, 2010 - 1:12 pm UTC

I guess you didn't answer the question on solitary latches.
Tom Kyte
April 27, 2010 - 1:29 pm UTC

Tell me what a solitary latch is - do you mean a parent latch without any children - they are solitary. It is just a latch.

Latch Children

A reader, February 01, 2013 - 4:37 am UTC

Tom,

I had queried v$latch_children for the latch "Cache Buffer lru chains" . I could see that , of the available 256 children, only 2 children had gets,misses,sleeps a high count. Rest of the children had '0' value for all columns except gets. Does this mean only 2 children are used? Does the no of children used depends on the load.
Tom Kyte
February 01, 2013 - 8:48 am UTC

if you see some gets, you are seeing others being used...