Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> Re: Waits on cache buffers chains latch

Re: Waits on cache buffers chains latch

From: Gaja Krishna Vaidyanatha <oraperfman_at_yahoo.com>
Date: Thu, 21 Jun 2001 21:15:42 -0700
Message-ID: <F001.00333235.20010621210521@fatcity.com>

Hi Johnson,

I think you may be "reading just a tad bit too much" into what I wrote regarding the "SORT_AREA_SIZE increase" recommendation. The rationale for that was not based on "disk sorts are always faster than memory sorts or vice versa". It was based on the fact that data for "global temporary tables (GTT)" are "stored" in the sort area of a session's PGA, and when the sort area becomes full, the session starts writing the data for the GTTs to temporary segments (or extents of an already allocated TRUE temp segment using the sort extent pool algorithm).

If the TEMP tablespace is of type "temporary", then the data blocks in the database buffer cache are NOT used. If the TEMP tablespace is of type "permanent", then the temp segments (for sorts and for GTT data larger than SORT_AREA_SIZE) are written to blocks in the database buffer cache, which in-turn is written to the files of the temporary tablespace by DBWR (Like how TEMP tablespaces used to work prior to 7.3 when they were of type "permanent").

If the temporary tablespace is of type "permanent" then the temp segments (that store the data for the GTTs) are constantly allocated and deallocated (if the data in the GTTs are retained only at the transaction-level or if sessions live only for a very short duration). That can cause contention for the ST enqueue, plus as mentioned before, it also uses blocks in the database buffer cache. If the same set of blocks are accessed repeatedly (constantly re-reading the data from the GTT within the same session or transaction as the case may be), then the cache buffers chains latch will be required to perform "logical I/O" on the said blocks. In that case, setting a larger SORT_AREA_SIZE will help in storing more "GTT data" in the PGA, rather than the Database Buffer Cache. A key factor to note about GTTs is that "it is local to a user's session or transaction" and is stored in the sort area of the PGA, so long as it can fit there. Anything that does not fit goes to the user's temporary tablespace.

Obviously, while engaging in any performance tuning engagement, we have to track the "offending SQL" that is causing the problem and this can be done by tracing your way back from V$SESSION_WAIT to V$SESSION to V$SQLAREA or V$SQL, to determine what is causing the problem.

Regarding the "strange behavior" of the queries on your system (after increasing SORT_AREA_SIZE), one possibility could be that your system could have been experiencing "memory starvation". The "blindspot" that gets most people while setting large sort areas is that for queries that are accessing tables or indexes with a "degree of parallelism of n", the amount of memory that could be allocated for those queries is (n x SORT_AREA_SIZE). Now if a bunch of users(y) are executing these queries and you have a large enough pool of PARALLEL_MAX_SERVERS, then memory consumption becomes a product of (y x n x SORT_AREA_SIZE). To make things interesting, if a bunch of tables(z) is referenced in the query and they all have a degree of parallelism > 1, then the memory consumption jumps to (z x y x n x SORT_AREA_SIZE). You can see where I am going with this.

In closing, Oracle recommends setting
SORT_MULTIBLOCK_READ_COUNT to 2 and I am still trying to find out "why is it 2?". I will post a message when I determine the rationale behind that recommendation. Until then, you may be better served by leaving that at 2.

Hope that clarifies things a bit,

Gaja


Gaja Krishna Vaidyanatha
Director, Storage Management Products,
Quest Software, Inc.
Co-author - Oracle Performance Tuning 101

Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail http://personal.mail.yahoo.com/
-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Gaja Krishna Vaidyanatha
  INET: oraperfman_at_yahoo.com

Fat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051
San Diego, California        -- Public Internet access / Mailing Lists
--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).
Received on Thu Jun 21 2001 - 23:15:42 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US