Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Aman Sharma
@amansharmadb http://blog.aristadba.com
System
Metadata
• Granules contain
• Array of buffers
holding copies
Granule Header
of data blocks Buffer Header Buffer Header Buffer Header Buffer Header
• Array of buffer Buffer Header Buffer Header Buffer Header Buffer Header
• Metadata for
Block Header Block Header Block Header Block Header
management
B B F F F F
Cache C C E E E E E
buffer
C C C C
chains
latches C C C C
B B B B
A A A A
_db_block_hash_latches
• V$BUFFER_POOL DBWR
• V$BUFFER_POOL_STATISTICS
• Exposed in X$KCBWBPD DBWR
• Contains description of
• WorkAsrea sets
• Granules
WorkArea WorkArea WorkArea WorkArea
Set1 Set2 Set3 Set4
WorkArea Sets
• Represents the logical division of a
large buffer cache Default Cache
• Were introduced in 8i(8.1.5)
WorkArea WorkArea
• Each buffer pool is maintained by Set 1 Set 2
one or more workarea sets
Keep Cache
• Created in the Shared Pool
• Written by DBWR WorkArea WorkArea
Set 2 Set 2 Recycle Cache
• Searched and protected by Cache
Buffer LRU Chain Latch
• Each workarea set contains
multiple LRU and CKPT queues
DBWR
• Maintained using X$KCBWDS
• CPU_COUNT/2
Aman Sharma|AIOUG-Hyd-Performance Tuning Day June 2018 27
Buffer Cache - Linked Lists
Buffer Cache
• Several linked lists within the buffer
cache Hot End
• Most popularly known are
Dirty List
• Hot buffer list LRU List
Buffer Cache
WorkArea Sets(X$KCBWDS)
NXT_REPLAX BH BH BH BH BH
PRV_REPLAX
Cold End
BH
• Was introduced in version 6 BH
• Took into the account the issue of
buffers accessed by FTS replacing the BH LRU Chain
entire LRU chain
• Was implemented with an additional BH
“window” in the LRU chain only meant BH
for the FTS buffers FTS
• _db_percent_hot_default=50
• _db_aging_hot_criteria=2
• _db_aging_stay_count=0
• _db_aging_cool_count=1
• _db_aging_touch_time=3
• _db_aging_freeze_cr=False
92
71
42 34
92
71 72
34
92 45
72
34 52
42
45
33
72
87
11 71
52
42
45
33
72
11 66
71
52
42
45
33
11 49
66
71
52
42
45
11
0 3
0 3
4
0 2
4 2
4
1 2
1
4 0
2
1 0
1
2
BH
TCH=0
• Tables can be cached using an explicit CACHE
clause BH
• Can be used with
• CREATE TABLE
BH LRU Chain
• ALTER TABLE BH
TCH=1
Mid Point
• HINT
• CACHE Clause does not really caches the tables BH
• Puts the buffers in the LRU_MAIN list directly BH
• Buffers are still replaceable despite being
“cached” BH
BH
LRU End
Aman Sharma|AIOUG-Hyd-Performance Tuning Day June 2018 40
Big Table Caching in 12c - Using Object Temperature
• Touch count based mechanism is for the block replacement
• From 12c(12.1) onwards, an object replacement mechanism is also
available based on the “temperature” of the objects
• Is maintained by having a sub-section in the default buffer cache-
Big Table Cache
• Is beneficial for scans of large objects which don’t fit in the default
cache in specific environments like DWH
• Is available for both single instance and RAC databases
• Works along with In-Memory parallel query
• Views
• V$BT_SCAN_CACHE
• V$BT_SCAN_OBJ_TEMPS
Touch Counter
Based
• Cache Buffer LRU Chain latch contention represents that excessive time is spent
on searching for the free buffers
• Increase the buffer cache size if not using AMM
• Cache Buffer Chain Latch contention represents that multiple processes are trying
to access the same hot buffer
• For Data blocks
• Mostly caused by inefficient design of application or sub-optimal SQL statements
• Demands application tuning
• For index block contention
• Create Reverse key index or Global Hash partitioned index
• Also can happen when the caller process is attempting to replace the buffers too
frequently
• Increase the buffer cache size
• https://www.amazon.com/Oracle-8i-Internal-Services-
Latches/dp/156592598X
• https://www.amazon.com/Oracle-Core-Essential-Internals-
Developers/dp/1430239549/
• http://www.ixora.com.au/
| @amansharmadb
| http://blog.aristadba.com
| amansharma@aristadba.com