Direct path api ?
Hi,
how can I use the direct path api to speed up the unload tables
process. export uses it so there IS a direct path api.
Can we use it, were is it documented, is it valid for 7.3.4 as
wel as for 8 ?
thanks for the input,
Ronald.
null
Do you have support.oracle.com access?
If you check the Ora-600 lookup tool it seems that there are various known oracle bugs that cause this error, related to the use of synonyms in the direct path loading API, or possibly to do with CLOBS over database links.
From what you've said it looks likely to be related to the use of synonyms. Oddly, it seems to be in both 10.2.0.3 and 10.2.0.5 so I'm not sure why you'd hit it on upgrade. Did you change your client side driver at the same time? or make any database changes?
Similar Messages
-
Programatically detecting uniqueness constraint violations when using Direct Path API
I'm developing an application that bulk loads data into the
database using the DirectPath API.
According to the DirectPath API documentation uniqueness
constraints must be disabled prior to importing data using the
DirectPath API, then the constraints must be re-enabled.
If duplicate data is inserted when the constraints are disabled,
enabling the constraints results in the constraint's underlying
index being left in an "unusable" state.
The SQL*Loader tool (which also uses the DirectPath API) somehow
manages to deal with this.
It can successfully detect which data causes the constraint
violation, and politely writes the offending data to a bad rows
file.
If SQL*Loader also uses the DirectPath API - how does it detect
which data causes a constraint violation.
The mere fact that SQL*Loader can do this in DirectPath mode,
shows that it is possible.
Any ideas how to detect which data causes a constraint violation
when using the DirectPath API ?
- AndyI'm developing an application that bulk loads data into the
database using the DirectPath API.
According to the DirectPath API documentation uniqueness
constraints must be disabled prior to importing data using the
DirectPath API, then the constraints must be re-enabled.
If duplicate data is inserted when the constraints are disabled,
enabling the constraints results in the constraint's underlying
index being left in an "unusable" state.
The SQL*Loader tool (which also uses the DirectPath API) somehow
manages to deal with this.
It can successfully detect which data causes the constraint
violation, and politely writes the offending data to a bad rows
file.
If SQL*Loader also uses the DirectPath API - how does it detect
which data causes a constraint violation.
The mere fact that SQL*Loader can do this in DirectPath mode,
shows that it is possible.
Any ideas how to detect which data causes a constraint violation
when using the DirectPath API ?
- Andy -
Direct Path Loading Issues with Global Temporary Tables - OCI & OCILib
I am writing some code to import data into a warehouse from a CPU grid which computes risk data. Due to the fact a computing grid is used there will be many clients which can load the data concurrently and at any point in time.
Currently the import uses Binding in OCCI and chunking with a prepared statement to import the data into a global temporary table in a staging area after which a stored procedure is called within the same session which will process the data and load the data into a star schema.
The GTT has the advantage that if any clients have issues no dirty data will be left and each client only sees their own instance of the data.
I have been looking at using direct path loading to increase the performance of the load and have written some OCI code to perform the same task. I have manged to import the data into a regular heap based table using the OCI direct path apis. However when I try and use the same code to import against a Global Temporary Table I get an OCI Error (ORA-00600: internal error code, arguments: [6979], [16], [1], [1318528], [], [], [], [], [], [], [], [])
I get error when the function OCIDirPathPrepare is executed. The same issue occurs in both OCI and OCILib.
Is it not possible to use Direct Path Loading against a Global Temporry Table ? Because you can use the /*+ APPEND */ hint and load global temporary tables this way from tools like SQL Devloper / toad which is surely informing the SQL Engine to use Direct Path ?
Looking at the table USER_OBJECTS I can see that for a Global Temporary Table the DATA_OBJECT_ID is null. Does this mean that it is impossible to us a direct path load into Global Temporary Tables ?
Any ideas / suggestions would be really appreciated. If this means redesigning the application then I would appreciate suggestions which would allow many client to quick write processes in a parallel fashion. If this means creating a new parition in a Heap Table for each writer and direct path loading into this table then so be it.
Thanks
H
Edited by: 813640 on 19-Nov-2010 11:08Replying to my own message in case anyone else is interested.
I have now managed to successfully load data using direct path into a global temporary table with OCI. There appears to be no reason why this approach will not work.
I loaded data into the temporary table and then issued a select count(*) on the table from within the session and from a new session. The results were as expected.
The resaon for the ORA-006000 error was due to the fact that I had enabled table level parallel loading
ie
OCIAttrSet((dvoid *) context, (ub4) OCI_HTYPE_DIRPATH_CTX, *(ub1) 1*, (ub4)0, (ub4) OCI_ATTR_DIRPATH_PARALLEL, errhp)
When loading a Global Temporary Table the OCI_ATTR_DIRPATH_PARALLEL attribute needs to be zero
This makes sense, since the temp table does not have any partitions so it would not be possible to write in parallel to multiple paritions.
Edited by: 813640 on 22-Nov-2010 08:42 -
What is the diff b/w Conventional Path and Direct Path?
What is the diff b/w Conventional Path and Direct Path?
While doing exp/imp
which one is best in peroformance Conventional Or Direct
consider my Oracle is 9i (9.2.0) and Os is Solaris 9
Could you please clarify.....
Thankshttp://download.oracle.com/docs/cd/B10501_01/server.920/a96652/ch01.htm#1005685
-
I'm looking to go from 8.1.1 to 9.0.1 Is this a direct path upgrade or do I have to go from 8.1.1 to 8.6.X . I've been able to find docmentatin called Upgrade Guide for PowerCenter 8.5.x and
8.6.x, but can't find any on Upgrade Guide for PowerCenter 8.1.1 .
Any help is appreciated.Hi,
I think there is no direct path available and you need to upgrade from 8.1.1 to 8.6.x and upon from 8.6.x to 9.1 version.
Thanks,
Navin Kumar Bolla -
Insert /*+ Append */ and direct-path INSERT
Hi Guys
Does insert /*+ Append */ into hint cause Oracle 10G to use direct-path INSERT?
and if insert /*+ Append */ into hint does cause Oracle to use direct-path INSERT, does insert /*+ Append */ is subject to the same restrictions as direct-path such as "The target table cannot have any triggers or referential integrity constraints defined on it."
ThanksDear,
Here below a simple example showing the effet of existing trigger on the append hint
mhouri@mhouri> select * from v$version where rownum=1;
BANNER
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
mhouri@mhouri> create table b as select * from all_objects where 1 = 2;
Table créée.
mhouri@mhouri> insert /*+ append */ into b
2 select * from all_objects;
70986 ligne(s) créée(s).
mhouri@mhouri> select * from b;
select * from b
ERREUR à la ligne 1 :
ORA-12838: impossible de lire/modifier un objet après modification en parallèle
mhouri@mhouri> rollback;
Annulation (rollback) effectuée.The direct path took place as far as I can't select from the table before I commit
mhouri@mhouri> create trigger b_trg before insert on b
2 for each row
3 begin
4 null;
5 end;
6 /
Déclencheur créé.
mhouri@mhouri> insert /*+ append */ into b
2 select * from all_objects;
70987 ligne(s) créée(s).
424 ligne(s) sélectionnée(s).
mhouri@mhouri> select count(1) from b;
COUNT(1)
70987 While in the presence of this trigger on the table, the append hint has been silently ignored by Oracle. The fact that I can select from the table immediately afte the insert has finished is the indication that the table has not be inserted using direct path load
Best Regards
Mohamed Houri -
Serial table scan with direct path read compared to db file scattered read
Hi,
The environment
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit
8K block size
db_file_multiblock_read_count is 128
show sga
Total System Global Area 1.6702E+10 bytes
Fixed Size 2219952 bytes
Variable Size 7918846032 bytes
Database Buffers 8724152320 bytes
Redo Buffers 57090048 bytes
16GB of SGA with 8GB of db buffer cache.
-- database is built on Solid State Disks
-- SQL trace and wait events
DBMS_MONITOR.SESSION_TRACE_ENABLE ( waits=>true )
-- The underlying table is called tdash. It has 1.7 Million rows based on data in all_objects. NO index
TABLE_NAME Rows Table Size/MB Used/MB Free/MB
TDASH 1,729,204 15,242 15,186 56
TABLE_NAME Allocated blocks Empty blocks Average space/KB Free list blocks
TDASH 1,943,823 7,153 805 0
Objectives
To show that when serial scans are performed on database built on Solid State Disks (SSD) compared to Magnetic disks (HDD), the performance gain is far less compared to random reads with index scans on SSD compared to HDD
Approach
We want to read the first 100 rows of tdash table randomly into buffer, taking account of wait events and wait times generated. The idea is that on SSD the wait times will be better compared to HDD but not that much given the serial nature of table scans.
The code used
ALTER SESSION SET TRACEFILE_IDENTIFIER = 'test_with_tdash_ssdtester_noindex';
DECLARE
type array is table of tdash%ROWTYPE index by binary_integer;
l_data array;
l_rec tdash%rowtype;
BEGIN
SELECT
a.*
,RPAD('*',4000,'*') AS PADDING1
,RPAD('*',4000,'*') AS PADDING2
BULK COLLECT INTO
l_data
FROM ALL_OBJECTS a;
DBMS_MONITOR.SESSION_TRACE_ENABLE ( waits=>true );
FOR rs IN 1 .. 100
LOOP
BEGIN
SELECT * INTO l_rec FROM tdash WHERE object_id = l_data(rs).object_id;
EXCEPTION
WHEN NO_DATA_FOUND THEN NULL;
END;
END LOOP;
END;
/Server is rebooted prior to any tests
Whern run as default, the optimizer (although some attribute this to the execution engine) chooses direct path read into PGA in preference to db file scattered read.
With this choice it takes 6,520 seconds to complete the query. The results are shown below
SQL ID: 78kxqdhk1ubvq
Plan Hash: 1148949653
SELECT *
FROM
TDASH WHERE OBJECT_ID = :B1
call count cpu elapsed disk query current rows
Parse 1 0.01 0.00 2 47 0 0
Execute 100 0.00 0.00 1 51 0 0
Fetch 100 10.88 6519.89 194142802 194831012 0 100
total 201 10.90 6519.90 194142805 194831110 0 100
Misses in library cache during parse: 1
Optimizer mode: ALL_ROWS
Parsing user id: 96 (SSDTESTER) (recursive depth: 1)
Rows Row Source Operation
1 TABLE ACCESS FULL TDASH (cr=1948310 pr=1941430 pw=0 time=0 us cost=526908 size=8091 card=1)
Rows Execution Plan
0 SELECT STATEMENT MODE: ALL_ROWS
1 TABLE ACCESS MODE: ANALYZED (FULL) OF 'TDASH' (TABLE)
Elapsed times include waiting on following events:
Event waited on Times Max. Wait Total Waited
---------------------------------------- Waited ---------- ------------
Disk file operations I/O 3 0.00 0.00
db file sequential read 2 0.00 0.00
direct path read 1517504 0.05 6199.93
asynch descriptor resize 196 0.00 0.00
DECLARE
type array is table of tdash%ROWTYPE index by binary_integer;
l_data array;
l_rec tdash%rowtype;
BEGIN
SELECT
a.*
,RPAD('*',4000,'*') AS PADDING1
,RPAD('*',4000,'*') AS PADDING2
BULK COLLECT INTO
l_data
FROM ALL_OBJECTS a;
DBMS_MONITOR.SESSION_TRACE_ENABLE ( waits=>true );
FOR rs IN 1 .. 100
LOOP
BEGIN
SELECT * INTO l_rec FROM tdash WHERE object_id = l_data(rs).object_id;
EXCEPTION
WHEN NO_DATA_FOUND THEN NULL;
END;
END LOOP;
END;
call count cpu elapsed disk query current rows
Parse 0 0.00 0.00 0 0 0 0
Execute 1 3.84 4.03 320 48666 0 1
Fetch 0 0.00 0.00 0 0 0 0
total 1 3.84 4.03 320 48666 0 1
Misses in library cache during parse: 0
Misses in library cache during execute: 1
Optimizer mode: ALL_ROWS
Parsing user id: 96 (SSDTESTER)
Elapsed times include waiting on following events:
Event waited on Times Max. Wait Total Waited
---------------------------------------- Waited ---------- ------------
SQL*Net message to client 1 0.00 0.00
SQL*Net message from client 1 0.00 0.00
SQL ID: 9babjv8yq8ru3
Plan Hash: 0
BEGIN DBMS_OUTPUT.GET_LINES(:LINES, :NUMLINES); END;
call count cpu elapsed disk query current rows
Parse 1 0.00 0.00 0 0 0 0
Execute 1 0.00 0.00 0 0 0 1
Fetch 0 0.00 0.00 0 0 0 0
total 2 0.00 0.00 0 0 0 1
Misses in library cache during parse: 0
Optimizer mode: ALL_ROWS
Parsing user id: 96 (SSDTESTER)
Elapsed times include waiting on following events:
Event waited on Times Max. Wait Total Waited
---------------------------------------- Waited ---------- ------------
SQL*Net message to client 1 0.00 0.00
SQL*Net message from client 1 0.00 0.00
OVERALL TOTALS FOR ALL NON-RECURSIVE STATEMENTS
call count cpu elapsed disk query current rows
Parse 1 0.00 0.00 0 0 0 0
Execute 2 3.84 4.03 320 48666 0 2
Fetch 0 0.00 0.00 0 0 0 0
total 3 3.84 4.03 320 48666 0 2
Misses in library cache during parse: 0
Misses in library cache during execute: 1
Elapsed times include waiting on following events:
Event waited on Times Max. Wait Total Waited
---------------------------------------- Waited ---------- ------------
SQL*Net message to client 2 0.00 0.00
SQL*Net message from client 2 0.00 0.00
log file sync 1 0.00 0.00
OVERALL TOTALS FOR ALL RECURSIVE STATEMENTS
call count cpu elapsed disk query current rows
Parse 9 0.01 0.00 2 47 0 0
Execute 129 0.01 0.00 1 52 2 1
Fetch 140 10.88 6519.89 194142805 194831110 0 130
total 278 10.91 6519.91 194142808 194831209 2 131
Misses in library cache during parse: 9
Misses in library cache during execute: 8
Elapsed times include waiting on following events:
Event waited on Times Max. Wait Total Waited
---------------------------------------- Waited ---------- ------------
db file sequential read 5 0.00 0.00
Disk file operations I/O 3 0.00 0.00
direct path read 1517504 0.05 6199.93
asynch descriptor resize 196 0.00 0.00
102 user SQL statements in session.
29 internal SQL statements in session.
131 SQL statements in session.
1 statement EXPLAINed in this session.
Trace file: mydb_ora_16394_test_with_tdash_ssdtester_noindex.trc
Trace file compatibility: 11.1.0.7
Sort options: default
1 session in tracefile.
102 user SQL statements in trace file.
29 internal SQL statements in trace file.
131 SQL statements in trace file.
11 unique SQL statements in trace file.
1 SQL statements EXPLAINed using schema:
ssdtester.plan_table
Schema was specified.
Table was created.
Table was dropped.
1531657 lines in trace file.
6520 elapsed seconds in trace file.I then force the query not to use direct path read by invoking
ALTER SESSION SET EVENTS '10949 trace name context forever, level 1' -- No Direct path read ;In this case the optimizer uses db file scattered read predominantly and the query takes 4,299 seconds to finish which is around 34% faster than using direct path read (default).
The report is shown below
SQL ID: 78kxqdhk1ubvq
Plan Hash: 1148949653
SELECT *
FROM
TDASH WHERE OBJECT_ID = :B1
call count cpu elapsed disk query current rows
Parse 1 0.00 0.00 2 47 0 0
Execute 100 0.00 0.00 2 51 0 0
Fetch 100 143.44 4298.87 110348670 194490912 0 100
total 201 143.45 4298.88 110348674 194491010 0 100
Misses in library cache during parse: 1
Optimizer mode: ALL_ROWS
Parsing user id: 96 (SSDTESTER) (recursive depth: 1)
Rows Row Source Operation
1 TABLE ACCESS FULL TDASH (cr=1944909 pr=1941430 pw=0 time=0 us cost=526908 size=8091 card=1)
Rows Execution Plan
0 SELECT STATEMENT MODE: ALL_ROWS
1 TABLE ACCESS MODE: ANALYZED (FULL) OF 'TDASH' (TABLE)
Elapsed times include waiting on following events:
Event waited on Times Max. Wait Total Waited
---------------------------------------- Waited ---------- ------------
Disk file operations I/O 3 0.00 0.00
db file sequential read 129759 0.01 17.50
db file scattered read 1218651 0.05 3770.02
latch: object queue header operation 2 0.00 0.00
DECLARE
type array is table of tdash%ROWTYPE index by binary_integer;
l_data array;
l_rec tdash%rowtype;
BEGIN
SELECT
a.*
,RPAD('*',4000,'*') AS PADDING1
,RPAD('*',4000,'*') AS PADDING2
BULK COLLECT INTO
l_data
FROM ALL_OBJECTS a;
DBMS_MONITOR.SESSION_TRACE_ENABLE ( waits=>true );
FOR rs IN 1 .. 100
LOOP
BEGIN
SELECT * INTO l_rec FROM tdash WHERE object_id = l_data(rs).object_id;
EXCEPTION
WHEN NO_DATA_FOUND THEN NULL;
END;
END LOOP;
END;
call count cpu elapsed disk query current rows
Parse 0 0.00 0.00 0 0 0 0
Execute 1 3.92 4.07 319 48625 0 1
Fetch 0 0.00 0.00 0 0 0 0
total 1 3.92 4.07 319 48625 0 1
Misses in library cache during parse: 0
Misses in library cache during execute: 1
Optimizer mode: ALL_ROWS
Parsing user id: 96 (SSDTESTER)
Elapsed times include waiting on following events:
Event waited on Times Max. Wait Total Waited
---------------------------------------- Waited ---------- ------------
SQL*Net message to client 1 0.00 0.00
SQL*Net message from client 1 0.00 0.00
SQL ID: 9babjv8yq8ru3
Plan Hash: 0
BEGIN DBMS_OUTPUT.GET_LINES(:LINES, :NUMLINES); END;
call count cpu elapsed disk query current rows
Parse 1 0.00 0.00 0 0 0 0
Execute 1 0.00 0.00 0 0 0 1
Fetch 0 0.00 0.00 0 0 0 0
total 2 0.00 0.00 0 0 0 1
Misses in library cache during parse: 0
Optimizer mode: ALL_ROWS
Parsing user id: 96 (SSDTESTER)
Elapsed times include waiting on following events:
Event waited on Times Max. Wait Total Waited
---------------------------------------- Waited ---------- ------------
SQL*Net message to client 1 0.00 0.00
SQL*Net message from client 1 0.00 0.00
OVERALL TOTALS FOR ALL NON-RECURSIVE STATEMENTS
call count cpu elapsed disk query current rows
Parse 1 0.00 0.00 0 0 0 0
Execute 2 3.92 4.07 319 48625 0 2
Fetch 0 0.00 0.00 0 0 0 0
total 3 3.92 4.07 319 48625 0 2
Misses in library cache during parse: 0
Misses in library cache during execute: 1
Elapsed times include waiting on following events:
Event waited on Times Max. Wait Total Waited
---------------------------------------- Waited ---------- ------------
SQL*Net message to client 2 0.00 0.00
SQL*Net message from client 2 0.00 0.00
log file sync 1 0.00 0.00
OVERALL TOTALS FOR ALL RECURSIVE STATEMENTS
call count cpu elapsed disk query current rows
Parse 9 0.01 0.00 2 47 0 0
Execute 129 0.00 0.00 2 52 2 1
Fetch 140 143.44 4298.87 110348674 194491010 0 130
total 278 143.46 4298.88 110348678 194491109 2 131
Misses in library cache during parse: 9
Misses in library cache during execute: 8
Elapsed times include waiting on following events:
Event waited on Times Max. Wait Total Waited
---------------------------------------- Waited ---------- ------------
db file sequential read 129763 0.01 17.50
Disk file operations I/O 3 0.00 0.00
db file scattered read 1218651 0.05 3770.02
latch: object queue header operation 2 0.00 0.00
102 user SQL statements in session.
29 internal SQL statements in session.
131 SQL statements in session.
1 statement EXPLAINed in this session.
Trace file: mydb_ora_26796_test_with_tdash_ssdtester_noindex_NDPR.trc
Trace file compatibility: 11.1.0.7
Sort options: default
1 session in tracefile.
102 user SQL statements in trace file.
29 internal SQL statements in trace file.
131 SQL statements in trace file.
11 unique SQL statements in trace file.
1 SQL statements EXPLAINed using schema:
ssdtester.plan_table
Schema was specified.
Table was created.
Table was dropped.
1357958 lines in trace file.
4299 elapsed seconds in trace file.I note that there are 1,517,504 waits with direct path read with total time of nearly 6,200 seconds. In comparison with no direct path read, there are 1,218,651 db file scattered read waits with total wait time of 3,770 seconds. My understanding is that direct path read can use single or multi-block read into the PGA. However db file scattered reads do multi-block read into multiple discontinuous SGA buffers. So it is possible given the higher number of direct path waits that the optimizer cannot do multi-block reads (contigious buffers within PGA) and hence has to revert to single blocks reads which results in more calls and more waits?.
Appreciate any advise and apologies for being long winded.
Thanks,
MichHi Charles,
I am doing your tests for t1 table using my server.
Just to clarify my environment is:
I did the whole of this test on my server. My server has I7-980 HEX core processor with 24GB of RAM and 1 TB of HDD SATA II for test/scratch backup and archive. The operating system is RHES 5.2 64-bit installed on a 120GB OCZ Vertex 3 Series SATA III 2.5-inch Solid State Drive.
Oracle version installed was 11g Enterprise Edition Release 11.2.0.1.0 -64bit. The binaries were created on HDD. Oracle itself was configured with 16GB of SGA, of which 7.5GB was allocated to Variable Size and 8GB to Database Buffers.
For Oracle tablespaces including SYS, SYSTEM, SYSAUX, TEMPORARY, UNDO and redo logs, I used file systems on 240GB OCZ Vertex 3 Series SATA III 2.5-inch Solid State Drive. With 4K Random Read at 53,500 IOPS and 4K Random Write at 56,000 IOPS (manufacturer’s figures), this drive is probably one of the fastest commodity SSDs using NAND flash memory with Multi-Level Cell (MLC). Now my T1 table created as per your script and has the following rows and blocks (8k block size)
SELECT
NUM_ROWS,
BLOCKS
FROM
USER_TABLES
WHERE
TABLE_NAME='T1';
NUM_ROWS BLOCKS
12000000 178952which is pretty identical to yours.
Then I run the query as brelow
set timing on
ALTER SESSION SET TRACEFILE_IDENTIFIER = 'test_bed_T1';
ALTER SESSION SET EVENTS '10046 TRACE NAME CONTEXT FOREVER, LEVEL 8';
SELECT
COUNT(*)
FROM
T1
WHERE
RN=1;
which gives
COUNT(*)
60000
Elapsed: 00:00:05.29
tkprof output shows
call count cpu elapsed disk query current rows
Parse 1 0.00 0.00 0 0 0 0
Execute 1 0.00 0.00 0 0 0 0
Fetch 2 0.02 5.28 178292 178299 0 1
total 4 0.02 5.28 178292 178299 0 1
Compared to yours:
Fetch 2 0.60 4.10 178493 178498 0 1
It appears to me that my CPU utilisation is by order of magnitude better but my elapsed time is worse!
Now the way I see it elapsed time = CPU time + wait time. Further down I have
Rows Row Source Operation
1 SORT AGGREGATE (cr=178299 pr=178292 pw=0 time=0 us)
60000 TABLE ACCESS FULL T1 (cr=178299 pr=178292 pw=0 time=42216 us cost=48697 size=240000 card=60000)
Rows Execution Plan
0 SELECT STATEMENT MODE: ALL_ROWS
1 SORT (AGGREGATE)
60000 TABLE ACCESS MODE: ANALYZED (FULL) OF 'T1' (TABLE)
Elapsed times include waiting on following events:
Event waited on Times Max. Wait Total Waited
---------------------------------------- Waited ---------- ------------
SQL*Net message to client 3 0.00 0.00
SQL*Net message from client 3 0.00 0.00
Disk file operations I/O 3 0.00 0.00
direct path read 1405 0.00 4.68
Your direct path reads are
direct path read 1404 0.01 3.40Which indicates to me you have faster disks compared to mine, whereas it sounds like my CPU is faster than yours.
With db file scattered read I get
Elapsed: 00:00:06.95
call count cpu elapsed disk query current rows
Parse 1 0.00 0.00 0 0 0 0
Execute 1 0.00 0.00 0 0 0 0
Fetch 2 1.22 6.93 178293 178315 0 1
total 4 1.22 6.94 178293 178315 0 1
Rows Row Source Operation
1 SORT AGGREGATE (cr=178315 pr=178293 pw=0 time=0 us)
60000 TABLE ACCESS FULL T1 (cr=178315 pr=178293 pw=0 time=41832 us cost=48697 size=240000 card=60000)
Rows Execution Plan
0 SELECT STATEMENT MODE: ALL_ROWS
1 SORT (AGGREGATE)
60000 TABLE ACCESS MODE: ANALYZED (FULL) OF 'T1' (TABLE)
Elapsed times include waiting on following events:
Event waited on Times Max. Wait Total Waited
---------------------------------------- Waited ---------- ------------
SQL*Net message to client 2 0.00 0.00
Disk file operations I/O 3 0.00 0.00
db file sequential read 1 0.00 0.00
db file scattered read 1414 0.00 5.36
SQL*Net message from client 2 0.00 0.00
compared to your
db file scattered read 1415 0.00 4.16On the face of it with this test mine shows 21% improvement with direct path read compared to db scattered file read. So now I can go back to re-visit my original test results:
First default with direct path read
call count cpu elapsed disk query current rows
Parse 1 0.01 0.00 2 47 0 0
Execute 100 0.00 0.00 1 51 0 0
Fetch 100 10.88 6519.89 194142802 194831012 0 100
total 201 10.90 6519.90 194142805 194831110 0 100
CPU ~ 11 sec, elapsed ~ 6520 sec
wait stats
Event waited on Times Max. Wait Total Waited
---------------------------------------- Waited ---------- ------------
direct path read 1517504 0.05 6199.93
roughly 0.004 sec for each I/ONow with db scattered file read I get
call count cpu elapsed disk query current rows
Parse 1 0.00 0.00 2 47 0 0
Execute 100 0.00 0.00 2 51 0 0
Fetch 100 143.44 4298.87 110348670 194490912 0 100
total 201 143.45 4298.88 110348674 194491010 0 100
CPU ~ 143 sec, elapsed ~ 4299 sec
and waits:
Event waited on Times Max. Wait Total Waited
---------------------------------------- Waited ---------- ------------
db file sequential read 129759 0.01 17.50
db file scattered read 1218651 0.05 3770.02
roughly 17.5/129759 = .00013 sec for single block I/O and 3770.02/1218651 = .0030 for multi-block I/ONow my theory is that the improvements comes from the large buffer cache (8320MB) inducing it to do some read aheads (async pre-fetch). Read aheads are like quasi logical I/Os and they will be cheaper compared to physical I/O. When there is large buffer cache and read aheads can be done then using buffer cache is a better choice than PGA?
Regards,
Mich -
Direct Path Read waits are not showing in Elapsed time
Hi,
I'm having a question regarding interpretation of a SQL trace file. I'm on Oracle 11.2.0.1 HP/UX 64 bit.
Following is only the overall result of the trace (it is quite big).
My question is about the Direct Path Read waits which are totallizing 268s of wait but are not showing in the fetch elapsed time (49.58s) and are not showing anywhere in the trace except in the overall result.
I do not understand why it is not part of the Elapsed time...
For info, the trace is for the specific session that was performing all the required queries to display an online report. The database is accessed by the Java application using Hybernate.
The trace was obtained by the following SQL:
exec sys.dbms_monitor.serv_mod_act_trace_enable(service_name=>'SYS$USERS',waits=>true,binds=>true);Then I query the sessions to find the one created by the application.
OVERALL TOTALS FOR ALL NON-RECURSIVE STATEMENTS
call count cpu elapsed disk query current rows
Parse 36 0.43 0.51 0 5 0 0
Execute 62 0.01 0.01 0 0 0 0
Fetch 579 4.01 49.06 3027 153553 0 5516
total 677 4.45 49.58 3027 153558 0 5516
Misses in library cache during parse: 29
Misses in library cache during execute: 2
Elapsed times include waiting on following events:
Event waited on Times Max. Wait Total Waited
---------------------------------------- Waited ---------- ------------
SQL*Net message to client 32754 0.00 0.03
SQL*Net message from client 32753 2.33 232.01
Disk file operations I/O 179 0.00 0.02
db file sequential read 2979 0.54 45.72
SQL*Net more data to client 133563 0.04 5.30
direct path read 34840 0.94 268.21
SQL*Net more data from client 1075 0.00 0.02
db file scattered read 6 0.03 0.11
asynch descriptor resize 52 0.00 0.00
OVERALL TOTALS FOR ALL RECURSIVE STATEMENTS
call count cpu elapsed disk query current rows
Parse 25 0.00 0.02 0 0 0 0
Execute 58 0.05 0.04 0 0 0 0
Fetch 126 0.00 0.04 4 161 0 123
total 209 0.05 0.11 4 161 0 123
Misses in library cache during parse: 3
Misses in library cache during execute: 3
Elapsed times include waiting on following events:
Event waited on Times Max. Wait Total Waited
---------------------------------------- Waited ---------- ------------
Disk file operations I/O 1 0.00 0.00
db file sequential read 4 0.01 0.03
asynch descriptor resize 1 0.00 0.00
37 user SQL statements in session.
57 internal SQL statements in session.
94 SQL statements in session.
Trace file: oxd1ta00_ora_16542.trc
Trace file compatibility: 11.1.0.7
Sort options: default
1 session in tracefile.
37 user SQL statements in trace file.
57 internal SQL statements in trace file.
94 SQL statements in trace file.
57 unique SQL statements in trace file.
241517 lines in trace file.
568 elapsed seconds in trace file.Thanks
ChristopheChristophe Lize wrote:
Closing this thread even if it's not answered...Sorry, I don't have time to test this myself now, but you shouldn't mark this thread as answered if it is not, because other people might find it and think they find an answer if they have a similar question.
I suggest you try the following to narrow down things:
1. Open the RAW trace file and check the cursor numbers of the "direct path reads" - check if you can find any references for those cursor numbers manually. The cursor numbers are those numbers behind the WAIT #<xx>, and you can check if you find any other entry unequal to WAIT #<xx> with the same #<xx>, for example EXEC #<xx> or FETCH #<xx>
A short primer on how to interpret the raw trace file can also be found in MOS document 39817.1
2. Run the RAW trace file through alternative free trace file analyzers like SQLDeveloper (yes it can process raw trace files), OraSRP or Christian Antognini's TVD$XTAT. If you have My Oracle Support access you can also try Oracle's own extended Trace Analyzer (TRCA / TRCANLZR). See MOS Note 224270.1
Check if these tools tell you more about your specific wait event and oddities with the trace file in general.
Regards,
Randolf
Oracle related stuff blog:
http://oracle-randolf.blogspot.com/
Co-author of the "OakTable Expert Oracle Practices" book:
http://www.apress.com/book/view/1430226684
http://www.amazon.com/Expert-Oracle-Practices-Database-Administration/dp/1430226684 -
Sql functions in sqlldr direct path
Hi
I am using oracle 9i(9.2) database,
What are the sql functions you can use in sqlldr direct path?
Thanks
MMAs far as I know there is no restriction, why do you ask?
-
Errors when using sql loader direct path with a nvl functin on a date field
I thought I read in 10g that all sql functions now work in direct path mode.
the following function works without direct path mode. When we turn direct path mode on the load fails. When we take the function out in direct path mode it works.
mydate DATE "YYYY-MM-DD" "nvl(:mydatedate,to_date('9999-01-01','YYYY-MM-DD'))"
with direct path mode I get:
EVERY record gets rejected with this error.
Record 10: Rejected - Error on table MYTABLE
ORA-00604: error occurred at recursive SQL level 1
ORA-01861: literal does not match format string
again works fine without direct=true, works fine with direct=true if i get rid of the function.
any ideas?
Message was edited by:
Guess2
Message was edited by:
Guess2like usual your posts are completely useless daniel.
I could have swarn that oracle advertised that you can use functions with 9i or 10g release in the new features guys or the first releases. -
Problems with Direct Entitlement API ( problems to download the issuenumbers and others)
Hi there.
Here we are using the last version of Direct Entitlement API , we had download on this url : http://www.adobe.com/devnet/digitalpublishingsuite/articles/direct-entitlement-starter-kit .html
But We are getting some problems
With https://dev01.cartacapital.com.br/adobe/api/entitlements.php?authToken=0fc82ad9b9c11703ad5 c8dee47d7ee26&appVersion=1.3.1&appId=468573252
This api is modificated to show only the issuenumbers that I have the right to read.
I'm getting this results
<result httpResponseCode="200">
<entitlements>
<productId>com.editoraconfianca.revistacartacapital.edicao753</productId>
<productId>com.editoraconfianca.revistacartacapital.edicao754</productId>
<productId>com.editoraconfianca.revistacartacapital.edicao755</productId>
<productId>com.editoraconfianca.revistacartacapital.edicao756</productId>
<productId>com.editoraconfianca.revistacartacapital.edicao757</productId>
<productId>com.editoraconfianca.revistacartacapital.edicao758</productId>
<productId>com.editoraconfianca.revistacartacapital.edicao759</productId>
<productId>com.editoraconfianca.revistacartacapital.edicao760</productId>
<productId>com.editoraconfianca.revistacartacapital.edicao761</productId>
<productId>com.editoraconfianca.revistacartacapital.edicao762</productId>
<productId>com.editoraconfianca.revistacartacapital.edicao763</productId>
<productId>com.editoraconfianca.revistacartacapital.edicao764</productId>
</entitlements>
</result>
That's ok
But on my Ipad ( for testing only) , show this entitlement on a first place, on top of my screen.
1) Why does the app is showing others entitlements too, like ( com.editoraconfianca.revistacartacapital.edicao752, 751 ... ) ?
2) When I try to download all the result in my xml , is not allowed to donwload, but the ( com.editoraconfianca.revistacartacapital.edicao752, 751 ... ) is allowed to download
When I verify if I can download the issue ( https://dev01.cartacapital.com.br/adobe/api/verifyEntitlement.php?authToken=0fc82ad9b9c117 03ad5c8dee47d7ee26&appId=com.editoraconfianca.revistacartacapital&productId=com.editoracon fianca.revistacartacapital.edicao753&appVersion=1.0.34 )
show this result
<result httpResponseCode="200">
<entitled>true</entitled>
</result>
But I can't do the download.
Help Please.There is no license or serial number for the DVD installer.
If you can get access to a Mac with a working DVD Drive, make the DVD into a .dmg file in Disk Utility and then copy the .dmg file onto a USB key and install onto your Mac from that.
Peter -
A lot of messages "direct path write temp" and "direct path read temp"
Hello, all
Please, understand me, what is going on in my system (DB: Oracle database 11.2.0.3, OS: Windows 2008 R2).
In AWR report (1 hour) I see next:
Foreground Wait Events
Avg
%Time Total Wait wait Waits % DB
Event Waits -outs Time (s) (ms) /txn time
direct path write temp 132,627 0 1,056 8 0.8 21.7
direct path read temp 308,969 0 565 2 2.0 11.6
log file sync 19,228 0 241 13 0.1 5.0
direct path write 17,698 0 135 8 0.1 2.8
db file sequential read 21,149 0 94 4 0.1 1.9
SQL*Net message from dblin 59 0 5 86 0.0 .1
Segments by Direct Physical Reads DB/Inst: SGRE/sgre Snaps: 1039-1040
-> Total Direct Physical Reads: 392,273
-> Captured Segments account for 94.7% of Total
Tablespace Subobject Obj. Direct
Owner Name Object Name Name Type Reads %Total
** MISSING TEMP ** TRANSIENT: 437734 MISSING ** UNDEF 38,290 9.76
DBSNMP TEMP MGMT_TEMPT_SQL TABLE 38,242 9.75
** MISSING TEMP ** TRANSIENT: 438784 MISSING ** UNDEF 37,790 9.63
** MISSING TEMP ** TRANSIENT: 437312 MISSING ** UNDEF 37,661 9.60
** MISSING TEMP ** TRANSIENT: 439257 MISSING ** UNDEF 37,477 9.55Some selects:
SELECT S.sid,
T.blocks * TBS.block_size / 1024 / 1024 mb_used, T.tablespace, T.SEGTYPE
FROM v$sort_usage T, v$session S, v$sqlarea Q, dba_tablespaces TBS
WHERE T.session_addr = S.saddr
AND T.sqladdr = Q.address (+)
AND T.tablespace = TBS.tablespace_name
AND S.sid = 732
ORDER BY S.username, S.sid;
SID MB_USED TABLESPACE SEGTYPE
732 2 TEMP LOB_DATA
732 1 TEMP INDEX
732 1 TEMP DATA
732 1 TEMP INDEX
732 1 TEMP DATA
732 1 TEMP INDEX
732 1 TEMP DATA
732 1 TEMP INDEX
732 1 TEMP INDEX
732 1 TEMP DATA
732 1 TEMP INDEX
732 1 TEMP INDEX
732 1 TEMP DATA
732 1 TEMP INDEX
732 1 TEMP INDEX
732 1 TEMP DATA
732 1 TEMP INDEX
732 1 TEMP INDEX
732 1 TEMP DATA
732 1 TEMP INDEX
732 1 TEMP INDEX
732 1 TEMP DATA
732 1 TEMP INDEX
732 1 TEMP INDEX
732 1 TEMP DATA
732 1 TEMP INDEX
732 1 TEMP INDEX
732 1 TEMP DATA
732 1 TEMP INDEX
732 1 TEMP LOB_INDEX
select st.sid, sn.name, st.VALUE
from V$statname sn, v$sesstat st
where st.STATISTIC# = sn.STATISTIC#
and (sn.name like 'sorts%')
and st.sid in (select sid from v$session_wait where event like '%direct path write temp%')
order by st.sid
SID NAME VALUE
732 sorts (memory) 591408
732 sorts (rows) 102126
732 sorts (disk) 0Why I do not see any disk sorts? If TEMP is used for no sort operations, then for which operations?
How I can see that? How can I decrease direct path write temp without tuning SQL?
Additional information:
PGA_AGGREGATE_TARGET is set to big value - 6GB (3GB enough due to advisory recommendation)
Please, help.
Regards, user12103911.user12103911 wrote:
SELECT optimal_count, round(optimal_count*100/total, 2) optimal_perc,
onepass_count, round(onepass_count*100/total, 2) onepass_perc,
multipass_count, round(multipass_count*100/total, 2) multipass_perc
FROM
(SELECT decode(sum(total_executions), 0, 1, sum(total_executions)) total,
sum(OPTIMAL_EXECUTIONS) optimal_count,
sum(ONEPASS_EXECUTIONS) onepass_count,
sum(MULTIPASSES_EXECUTIONS) multipass_count
FROM v$sql_workarea_histogram);
OPTIMAL_COUNT OPTIMAL_PERC ONEPASS_COUNT ONEPASS_PERC MULTIPASS_COUNT MULTIPASS_PERC
13150685 100 0 0 0 0No n-pass executions.That's a pretty convincing display - given that your AWR manages to NAME an object that is in the TEMP tablespace, an obvious point to follow up is global temporary tables. If you have any declared as "on commit preserve" (duration = 'SYS$SESSION') then you could have code which does "insert /*+ append */ into gtt", and if you then query this in parallel (or - since you're on 11.2.0.3 - the data volume is large enough) Oracle could choose to do direct path writes to load the GTT and direct path reads to read it back.
Regards
Jonathan Lewis -
Wait events 'direct path write' and 'direct path read'
Hi,
We have a query which is taking more that 2 min. It's a 9.2.0.7 database. We took the trace/tkprof of the query,and identified that there are so manay 'direct path write' and 'direct path read' wait events in the trace file.
WAIT #3: nam='direct path write' ela= 5 p1=201 p2=70710 p3=15
WAIT #3: nam='direct path read' ela= 170 p1=201 p2=71719 p3=15
In the above, "p1=201" is a file_id, but we could not find any data file, temp file, control file with that id# 201.
Can you please let us know what's "p1=201" here, how to identify the file which is causing the issue.
Thanks
SravanWhat does:
show parameter db_filesreturn? My guess, is that it returns 200.
The direct file read and direct file write events are reads and writes to TEMP tablespace. In those wait events, the file# is reported as db_files+temp file id. So, 201 means temp file #1.
Now, as to your actual performance problem.
Without seeing the SQL and the corresponding execution plan, it's impossible to be sure. However, the most common causes of temp writes are sort operations and group by operations.
If you decide to post your SQL and execution plan, please be sure to make it readable by formatting it. Information on how to do so can be found here.
Hope that helps,
-Mark
Edited by: mbobak on May 1, 2011 1:50 AM -
Query Tuning (sequential read + direct path read/write temp)
Following query takes nearly 10 minutes under 10.2.0.2 on WIN2K3 to execute but I am sure there would be an alternate to tune it further.
Major waits are 'db file sequential read' and 'direct path read temp' in addition to 'direct path write temp'
Increasing/tuning the work_area_policy/sort_area_size would help? moving the tables to faster disk would reduce PIO causing sequential read, query re-writing would prove to be helpful?.
Below is the tkprof:
SELECT
P.PER_ID
, CL.DESCR
, P.ENG_NAME
, P.ARA_NAME
, P.NATION
, P.ADDR
, ('Mob:' || NVL(P.MOB, '') || ', Home:' || NVL(P.HOME, '') || ', Bus.:' || NVL(P.BUS, '') || ', Fax:' || NVL(P.FAX, '')) PHONE
, SUM(CASE
WHEN FT.FT_TYPE_FLG IN ('BS','BX','AD','AX') THEN FT.CUR_AMT
ELSE 0
END) BILL
, SUM(CASE
WHEN FT.FT_TYPE_FLG IN ('PS','PX') THEN FT.CUR_AMT * -1
ELSE 0
END) PAY
, SUM(FT.CUR_AMT) DUE
, SUM(CASE
WHEN FT.FREEZE_DTTM > '03-JUN-08' THEN
CASE WHEN FT.FT_TYPE_FLG IN ('PS','PX') THEN FT.CUR_AMT * -1
ELSE 0
END
ELSE 0
END) PAY_02JUN
FROM
CI_FT FT
, CI_SA SA
, CI_ACCT_CHAR AC
, CI_CUST_CL_L CL
, CI_ACCT A
, CI_ACCT_PER AP
SELECT
P.PER_ID
, (P.CITY || ', ' || P.STATE || ',' || P.COUNTRY) ADDR
, MAX(DECODE(PP.PHONE_TYPE_CD, 'MOB ', PP.PHONE)) MOB
, MAX(DECODE(PP.PHONE_TYPE_CD, 'BUSN ', PP.PHONE)) BUS
, MAX(DECODE(PP.PHONE_TYPE_CD, 'HOME ', PP.PHONE)) HOME
, MAX(DECODE(PP.PHONE_TYPE_CD, 'FAX ', PP.PHONE)) FAX
, MAX(DECODE(PN.NAME_TYPE_FLG, 'PRIM', PN.ENTITY_NAME)) ENG_NAME
, MAX(DECODE(PN.NAME_TYPE_FLG, 'ALT ', PN.ENTITY_NAME)) ARA_NAME
, MAX(DECODE(PC.CHAR_TYPE_CD, 'NATION ', PC.CHAR_VAL)) NATION
FROM
CI_PER P
, CI_PER_PHONE PP
, CI_PER_NAME PN
, CI_PER_CHAR PC
WHERE
P.PER_ID = PP.PER_ID (+)
AND P.PER_ID = PN.PER_ID (+)
AND P.PER_ID = PC.PER_ID (+)
GROUP BY
P.PER_ID
, (P.CITY || ', ' || P.STATE || ',' || P.COUNTRY)
) P
WHERE
P.PER_ID = AP.PER_ID
AND AP.ACCT_ID = AC.ACCT_ID
AND AP.ACCT_ID = SA.ACCT_ID
AND AP.MAIN_CUST_SW = 'Y'
AND A.ACCT_ID = SA.ACCT_ID
AND A.ACCT_ID = AP.ACCT_ID
AND AC.CHAR_TYPE_CD = 'ACCTYPE'
AND AC.CHAR_VAL IN ('UOS', 'DEFAULT')
AND AC.ACCT_ID = SA.ACCT_ID
AND CL.LANGUAGE_CD = 'ENG'
AND A.ACCT_ID = AC.ACCT_ID
AND A.CUST_CL_CD = CL.CUST_CL_CD
AND SA.SA_ID = FT.SA_ID
AND FT.FREEZE_DTTM IS NOT NULL
GROUP BY
P.PER_ID
, CL.DESCR
, P.ENG_NAME
, P.ARA_NAME
, P.NATION
, P.ADDR
, ('Mob:' || NVL(P.MOB, '') || ', Home:' || NVL(P.HOME, '') || ', Bus.:' || NVL(P.BUS, '') || ', Fax:' || NVL(P.FAX, ''))
HAVING
SUM(FT.CUR_AMT) > 0
call count cpu elapsed disk query current rows
Parse 1 0.64 0.64 0 0 0 0
Execute 1 0.00 0.00 0 0 0 0
Fetch 304 353.09 430.04 21720 52997832 0 4543
total 306 353.73 430.69 21720 52997832 0 4543
Misses in library cache during parse: 1
Optimizer mode: CHOOSE
Parsing user id: 79 (CISADM)
Rows Row Source Operation
4543 FILTER (cr=52997832 pr=21720 pw=10311 time=430019418 us)
5412 HASH GROUP BY (cr=52997832 pr=21720 pw=10311 time=430015729 us)
199471 VIEW (cr=52997832 pr=21720 pw=10311 time=423392346 us)
199471 HASH GROUP BY (cr=52997832 pr=21720 pw=10311 time=423192867 us)
4013304 TABLE ACCESS BY INDEX ROWID CI_FT (cr=52997832 pr=11409 pw=0 time=140469508 us)
17717785 NESTED LOOPS (cr=49295470 pr=8987 pw=0 time=407554071 us)
13704480 NESTED LOOPS (cr=21818135 pr=7655 pw=0 time=287797921 us)
2782119 NESTED LOOPS OUTER (cr=3915432 pr=2950 pw=0 time=38953485 us)
571492 NESTED LOOPS OUTER (cr=2545763 pr=2711 pw=0 time=7433194 us)
286061 NESTED LOOPS OUTER (cr=2253263 pr=2671 pw=0 time=26607373 us)
123411 NESTED LOOPS (cr=1989056 pr=2642 pw=0 time=22711194 us)
123411 NESTED LOOPS (cr=1864959 pr=2642 pw=0 time=20860026 us)
123411 NESTED LOOPS (cr=1494040 pr=1754 pw=0 time=15553373 us)
243088 NESTED LOOPS (cr=29540 pr=1754 pw=0 time=10213331 us)
13227 TABLE ACCESS FULL CI_PER (cr=251 pr=49 pw=0 time=43331 us)
243088 INDEX RANGE SCAN XM150S1 (cr=29289 pr=1705 pw=0 time=6178159 us)(object id 97173)
123411 INLIST ITERATOR (cr=1464500 pr=0 pw=0 time=7220251 us)
123411 INDEX RANGE SCAN CM064S0 (cr=1464500 pr=0 pw=0 time=5631936 us)(object id 108631)
123411 TABLE ACCESS BY INDEX ROWID CI_ACCT (cr=370919 pr=888 pw=0 time=7241286 us)
123411 INDEX UNIQUE SCAN XM148P0 (cr=247508 pr=0 pw=0 time=1198649 us)(object id 97147)
123411 TABLE ACCESS BY INDEX ROWID CI_CUST_CL_L (cr=124097 pr=0 pw=0 time=1391837 us)
123411 INDEX UNIQUE SCAN XC523P0 (cr=686 pr=0 pw=0 time=595005 us)(object id 97745)
283749 TABLE ACCESS BY INDEX ROWID CI_PER_PHONE (cr=264207 pr=29 pw=0 time=3549713 us)
283749 INDEX RANGE SCAN XM172P0 (cr=125886 pr=4 pw=0 time=1307395 us)(object id 98733)
571492 INDEX RANGE SCAN XM171S2 (cr=292500 pr=40 pw=0 time=2976807 us)(object id 98728)
2777066 TABLE ACCESS BY INDEX ROWID CI_PER_CHAR (cr=1369669 pr=239 pw=0 time=23084761 us)
2777066 INDEX RANGE SCAN XM168P0 (cr=596156 pr=53 pw=0 time=7394319 us)(object id 98719)
13704480 TABLE ACCESS BY INDEX ROWID CI_SA (cr=17902703 pr=4705 pw=0 time=163320548 us)
13704480 INDEX RANGE SCAN XM199S1 (cr=5688247 pr=104 pw=0 time=51063061 us)(object id 98973)
4013304 INDEX RANGE SCAN CM112S1 (cr=27477335 pr=1332 pw=0 time=124063022 us)(object id 116797)
Elapsed times include waiting on following events:
Event waited on Times Max. Wait Total Waited
---------------------------------------- Waited ---------- ------------
SQL*Net message to client 304 0.00 0.00
db file sequential read 11366 0.34 65.63
direct path write temp 1473 0.06 2.91
latch: cache buffers chains 17 0.00 0.00
db file scattered read 7 0.01 0.03
read by other session 2 0.00 0.00
direct path read temp 1473 0.03 6.85
SQL*Net message from client 304 0.02 2.74
SQL*Net more data to client 292 0.00 0.00
********************************************************************************Luckys
I've just realised that I mis-read part of your plan:
199471 HASH GROUP BY (cr=52997832 pr=21720 pw=10311 time=423192867 us)
4013304 TABLE ACCESS BY INDEX ROWID CI_FT (cr=52997832 pr=11409 pw=0 time=140469508 us)
17717785 NESTED LOOPS (cr=49295470 pr=8987 pw=0 time=407554071 us)The time component for a line is the time it supplies, plus the sum of the time from its direct descendents.
In this case I looked at the HASH GROUP BY and TABLE ACCESS and got a difference of about 283 seconds. In fact I should have taken more notice of the other lines in the plan - comparing the HASH GROUP BY with the NESTED LOOP for a difference of about 16 seconds and assuming that the time in the TABLE ACCESS line was not to be trusted. (See http://jonathanlewis.wordpress.com/2007/04/26/heisenberg/ for a couple of comments on the timing issue).
So the grouping is responsible for relatively little of the excess time - most of the time goes into the nested loop.
I shall be using the Hints as advised, when we say we
have to "rewrite the query"
given the current context excluding the HINTS, what
exactly should I be
considering in terms of query rewrite, what
additional intelligence I can add to the
query in question so that CBO produces a different
plan.
The main consideration is what the query is supposed to report. Compare this with the way the optimizer is running the query and see if it makes sense.
When are talking about high intermediate rows
processing are we referring to this
section of the plan?;
4013304 TABLE ACCESS BY INDEX ROWID CI_FT
(cr=52997832 pr=11409 pw=0 time=140469508 us)
17717785 NESTED LOOPS (cr=49295470 pr=8987
pw=0 time=407554071 us)
13704480 NESTED LOOPS (cr=21818135 pr=7655
pw=0 time=287797921 us)
2782119 NESTED LOOPS OUTER (cr=3915432
pr=2950 pw=0 time=38953485 us)
2777066 TABLE ACCESS BY INDEX ROWID
CI_PER_CHAR (cr=1369669 pr=239 pw=0 time=23084761
us)
2777066 INDEX RANGE SCAN XM168P0 (cr=596156
pr=53 pw=0 time=7394319 us)(object id 98719)
13704480 TABLE ACCESS BY INDEX ROWID CI_SA
(cr=17902703 pr=4705 pw=0 time=163320548 us)
13704480 INDEX RANGE SCAN XM199S1
(cr=5688247 pr=104 pw=0 time=51063061 us)(object id
98973)
4013304 INDEX RANGE SCAN CM112S1 (cr=27477335
pr=1332 pw=0 time=124063022 us)(object id 116797)
Correct - one of the nested loops returns 2.78M rows - but as you run the next join you end up collecting 13.7M entires from the next index and table. That step is responsible for quite a lot of your work and time (as is the following step where you USE the 13.7M rows to probe the next index/table combination). If the optimizer had not grown the data set by merging the P view earlier on, the data sizes would be significantly smaller at that point.
Your inline view looks as if it is trying to turn rows into columns (the max(decode()) trick) - which is why I think it might be a good idea to stop Oracle from merging the view. So, as I suggested, look at the query withouth that bit of complexity and work out a sensible way to walk through the tables - bearing in mind the statistics below and the available indexes, and the amount of data your predicates identify at each stage.
Moreover tables have been analyzed:
CI_ACCT 243068
CI_ACCT_CHAR 222320
CI_ACCT_PER 242971
CI_FT 794510
CI_PER 13227
CI_PER_CHAR 42555
CI_PER_PHONE 18488
CI_SA 1082301
Parameters:
optimizer_features_enable string 10.2.0.2
optimizer_index_caching integer 100
optimizer_index_cost_adj integer 1
Unless you've been given strict instructions by a 3rd-part supplier, those settings for the optimizer_index_caching and optimizer_index_cost_adj are particularly bad - especially in 10g. With those settings, the optimizer is quite likely to choose stupid plans with excessive use of indexes - and pick the wrong index while doing it.
It's not appropriate to fiddle with system parameters to address one query - but at some stage you need to rethink your entire set of parameter settings to do things the 10g way. See this note from the Optimizer Group: http://www.oracle.com/technology/products/bi/db/10g/pdf/twp_bidw_optimizer_10gr2_0208.pdf
Regards
Jonathan Lewis
http://jonathanlewis.wordpress.com
http://www.jlcomp.demon.co.uk
"The greatest enemy of knowledge is not ignorance,
it is the illusion of knowledge." Stephen Hawking. -
Oracle direct path read IO size
Hello!
I am confused a little with IO size. I am running 11.2.0.3 on Oracle Linux x64 6.2. Block_size=8K, MULTIBOCK_READ_COUNT=128
Database is Single Instance and is using ASM grid. ASM AU =1M
As a test I am running a simple query against large table with 1.5Bln rows.
select /*+ PARALLEL (STOCK_DAY 10) */ count(*) from stock_day where cstast='NA'
STAT #140582923121480 id=1 cnt=0 pid=0 pos=1 obj=0 op='SORT AGGREGATE (cr=0 pr=0 pw=0 time=0 us)'
STAT #140582923121480 id=2 cnt=0 pid=1 pos=1 obj=0 op='PX COORDINATOR (cr=0 pr=0 pw=0 time=0 us)'
STAT #140582923121480 id=3 cnt=0 pid=2 pos=1 obj=0 op='PX SEND QC (RANDOM) :TQ10000 (cr=0 pr=0 pw=0 time=0 us)'
STAT #140582923121480 id=4 cnt=0 pid=3 pos=1 obj=0 op='SORT AGGREGATE (cr=0 pr=0 pw=0 time=27 us)'
STAT #140582923121480 id=5 cnt=2301843 pid=4 pos=1 obj=0 op='PX PARTITION LIST ALL PARTITION: 1 762 (cr=68020 pr=68393 pw=0 time=29346414 us cost=303766 size=669864369 card=223288123)'
STAT #140582923121480 id=6 cnt=2301843 pid=5 pos=1 obj=1464816 op='TABLE ACCESS FULL STOCK_DAY PARTITION: 1 762 (cr=68020 pr=68393 pw=0 time=24376609 us cost=303766 size=669864369 card=223288123)'
when I am trying to measure disk io statistics with iostat it shows that Oracle is issuing a 32K direct path read requests to ASM LUNs. Why? Why not 1M?
Thank you in advance!
Regards,
Kirill
Edited by: Kirill.Boyko on Jan 31, 2013 12:53 PMThis is a kind of histogram for one parallel session wait events
select session_state,event,p3,count(1) from V$active_session_history ash where ash.session_id=1904 and ash.session_serial#=24381
group by session_state,event,p3
order by session_state,event,p3
session
state event P3 COUNT
ON CPU 5 1
ON CPU 9 8
ON CPU 15 1
ON CPU 115 10
ON CPU 123 1
ON CPU 124 2
ON CPU 126 23
ON CPU 128 77
ON CPU 512 1
WAITING direct path read 5 2
WAITING direct path read 8 2
WAITING direct path read 9 7
WAITING direct path read 15 3
WAITING direct path read 67 1
WAITING direct path read 101 1
WAITING direct path read 115 18
WAITING direct path read 124 5
WAITING direct path read 126 35
WAITING direct path read 127 1
WAITING direct path read 128 97
in fact as you can see almost all direct path reads are done with io size > 900K. Total size of information read by process~160M
strace shows a lot of calls to read function. If we divide 160M/78000 reads we will get about 2K per request which is strange
% time seconds usecs/call calls errors syscall
98.61 0.212144 3 78356 read
0.93 0.002000 32 63 58 semtimedop
0.29 0.000624 208 3 munmap
0.12 0.000263 0 7407 gettimeofday
according to iostat we see that we are reading from each LUN with requests of 32K
Device: rrqm/s wrqm/s r/s w/s rMB/s wMB/s avgrq-sz avgqu-sz await svctm %util
xvda 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
xvdb 4.00 0.00 2946.00 1.00 92.01 0.00 63.94 90.60 30.93 0.33 96.00
xvde 1.00 0.00 2466.00 0.00 77.00 0.00 63.95 49.84 20.64 0.33 80.90
xvdf 5.00 0.00 2694.00 1.00 84.15 0.01 63.95 69.68 25.37 0.32 87.20
xvdg 2.00 0.00 2798.00 0.00 87.41 0.00 63.98 91.95 33.81 0.35 97.40
xvdj 3.00 0.00 2676.00 1.00 83.45 0.03 63.87 38.83 14.72 0.31 82.10
xvdk 4.00 0.00 2951.00 0.00 92.14 0.00 63.95 100.21 32.42 0.31 91.00
xvdl 3.00 0.00 2735.00 1.00 85.45 0.03 63.98 56.04 21.14 0.32 86.50
Why linux is splitting Oracle requests and how to avoid that?
Regards,
Kirill
Maybe you are looking for
-
Hello, I want to come up with a Query to track pricing changes done for items on the A/P Invoice before it's added. For instance: in the GRPO, Bread = 2$ in the target A/P invoice, Bread = 3$ At times, the users have to change the
-
I am unable to export page in Iscrapbook
I purchased Iscrapbook less than a year ago, I used it to create amazing montages, xmas card and all. i use to be able to export each page and save them as a jpeg format but nowiscrapbook freezes everytime I try to export anything. Any idea of what
-
Tablespace not showing in the backup
hi all. working on oracle 10g v1 , windows i have taken full backup of my database but it is not showing in the backup => list backup of tablespace sonu; could not translate tablespace sonu can any1 help me because i have to recover my database till
-
Hi tried to update several apps at once and now they are stuck on installing.I can't open or delete them. Any suggestions ?
-
Client Pre-Install Check Script
I recently installed SCCM 2012 in our environment. Most of our computers have the client installed. I was wondering if anyone has written a script to that can be run on a workstation to see if it has all the Pre-reqs for the SCCM client and outputs w