Académique Documents
Professionnel Documents
Culture Documents
Kyle Hailey
Kyle_hailey@hotmail.com
http://perfvision.com/ftp/sb
#.2
Buffer Cache
Locks
Network
I/O
DBWR
User1
Data Files
Copyright 2006 Kyle Hailey
#.5
Standard Table/Index IO
1. db file sequential read
Single block read
Buffer Cache
The top wait
Single Block Read
Data via Index and/or Rowid
Rollback
Shadow
Index on emp.empno
Process
1) Search Buffer Cache for
the block by rowid
2) Fails Note: “sequential” means
3) Reads of disk A sequence like a
• File rowid
• Block
Shadow
Process 1) Search Buffer Cache for the
blocks Note: Scattered Means
2) Fails
Blocks are read and
3) Reads off disk
• File scattered throughout
• Block buffer cache
• Multi Block Read Count
Examples
Not contiguous multi block read
Index full or range scan
Where values in Select * from emp where
Shadow
Empno in (1,2,3,4,5,6);
Process
1) Search Buffer Cache for
the blocks
2) Fails
3) Reads that block off Disk
Copyright 2006 Kyle Hailey
#.9
Read by other Session
Buffer Cache
Multiple sessions reading the
same data that requires IO
Ex) to users doing a full table scan
at the same time
What SQL ?
What Object ?
NAME P1 P2 P3
----------------------- ----------- --------- --------
read by other session file# block# class#
db file sequential read file# block# blocks
db file scattered read file# block# blocks
direct path read file number first dba block cnt
direct path read temp file number first dba block cnt
direct path write file number first dba block cnt
direct path write temp file number first dba block cnt
db file parallel read files blocks requests
P1 and P2 are the same, file# , block#
We can use P1, P2, P3 from ASH to get more info
Exception:
db file parallel read – p1,p2,p3 not useful
Copyright 2006 Kyle Hailey
#.15
Elapsed: 00:00:41.25
Elapsed: 00:01:25.73
Elapsed: 00:00:01.03
#.23
IO Solutions
1. Check average read times per file
Should be between 5-20 ms
Data in Statspack under “File IO Stats”
2. Check Cache buffer Hit ratio
Check db_cache_advice 9i and higher
Data in Statspack under “Buffer Pool Advisory”
Want to optimize data caching
3. Tune High IO SQL
IO Solutions
Check
FileIO response times
Buffer Cache Hit Ratio
IO Configuration Issues
Unix Buffer Cache
Disk Spindles
Raid 5
Machine Memory
Unix File SGA
Cache
IO Throughput
IO Operations/Sec
150 IOPS/sec optimistic
Raid 5
http://www.miracleas.com/BAARF/BAARF2.html
B – Battle
A – Against
A – Any
R – Raid
F - Five
Direct I/O :
This mechanism lets the client bypass the buffer cache for
I/O intensive operations.
The disk blocks are written into and read from process
private memory.
direct path read :
Parallel Query
direct path write
sqlldr
loading/reading LOBs
parallel DMLs
create table as select
create index
direct path read temp , direct path write temp
Sorting
Direct IO
Shadow
Process
PGA
Sort Area Buffer Cache
Direct Path
PQO Reads
select
session_id sid,
QC_SESSION_ID qsid,
ash.p3,
CURRENT_OBJ#||' '||o.object_name objn,
o.object_type otype,
CURRENT_FILE# fn,
CURRENT_BLOCK# blockn,
ash.SQL_ID
from v$active_session_history ash,
all_objects o
where event like 'direct path read'
and o.object_id (+)= ash.CURRENT_OBJ#
Order by sample_time;
----- ----- ---- ----------- ------ -- ------
-------------
SID QSID P3 OBJN OTYPE FN BLOCKN SQL_ID
--- ---- -- ----- ------ -- ------ -------------
149 152 8 TOTO TABLE 1 194072 4gp8tg0b2s722
144 152 8 TOTO TABLE 1 192304 4gp8tg0b2s722
60 152 8 TOTO TABLE 1 190592 4gp8tg0b2s722
54 152 6 TOTO TABLE 1 201274 4gp8tg0b2s722
149 152 8 TOTO TABLE 1 198552
Copyright 2006 Kyle Hailey 4gp8tg0b2s722
#.41
PQO - ASH
select
ash.SQL_ID,
QC_SESSION_ID qsid,
count(*) cnt,
count (distinct session_id) deg,
nvl(o.object_name,to_char(CURRENT_OBJ#)) obj,
o.object_type otype,
decode(session_state, 'WAITING',event,'CPU') event
from v$active_session_history ash,
SQL_ID QSID CNT DEG OBJ OTYPE EVENT
all_objects o
where -------------
o.object_id (+)= ---- ---- --- ------------ -----
ash.CURRENT_OBJ#
--------------------------
and qc_session_id is not null 42
6rvy3wj2u0h6u 123 4 WAIT_OBJECTS TABLE direct path read
group by qc_session_id, 123
sql_id, o.object_name,
3 3 WAIT_OBJECTS TABLE CPU
o.object_type, CURRENT_OBJ#,
123 96 4 event,
0 session_state db file sequential read
Order by qc_session_id, 123
sql_id 9 4 0 read by other session
123 2 2 0 CPU
7p3jt75phub2d 144 386 4 WAIT_OBJECTS TABLE PX Deq Credit: send blkd
144 4 3 WAIT_OBJECTS TABLE PX qref latch
144 37 1 WAIT_OBJECTS TABLE db file sequential read
144 3 2 WAIT_OBJECTS TABLE direct path read
144 70 1 WAIT_OBJECTS TABLE CPU
144 21 4 0 PX Deq Credit: send blkd
#.42
Shadow DBWR
Process
PGA
DATA
Buffer Cache
Shadow
Process
PGA
TEMP DATA
Buffer Cache
Further investigation
“real time“ can use Select
su.username,
su.segtype,
s.sql_id,
Note: SQL_ID
doesn’t seem filled su.blocks
in for from v$sort_usage su,
v$sort_usage.sql_id v$session s
Where
s.saddr = su.session_addr and
s.serial# = su.session_num;
USERNAME SEGTYPE SQL_ID BLOCKS
--------- ------- ------------- ------
SYS SORT 3xp88dstadjs4 109440
Copyright 2006 Kyle Hailey
#.45
file identify
The time it takes to identify a file so that it can
be opened later.
Datafile should be identified just once
Logfiles are identified every checkpoint
Reduce checkpoints
Arguments
p1 fib
p2 filename
p3 opcode (1 test for create, 2 get details)
If a problem try
GTT
Reduce fast_start_mttr_target
Summary I/O
Buffer Cache IO
db file sequential read
db file scattered read
db file parallel read
Tune
I/O’s
should be 5-15ms
Check Buffer Cache Advisory
Tune SQL
IO Summary Other
sort segment request : SMON occupied
file open : log files or session reconnects
file identify : log files or session reconnects
local write wait –
Temp extensions
Truncates
data file init write – data file extension