odd trace output 10046
How can I get 24 seconds waited sqlnet client message if the total response time is 7 seconds. This seems to be a flaw in the 10046 metric timing route.OVERALL TOTALS FOR ALL NON-RECURSIVE STATEMENTS
call count cpu elapsed disk query current rows
------- ------ -------- ---------- ---------- ---------- ---------- ----------
Parse 3 0.00 0.00 0 0 0 0
Execute 4 0.01 0.00 0 0 0 2
Fetch 2 7.17 7.01 191184 198038 0 1
------- ------ -------- ---------- ---------- ---------- ---------- ----------
total 9 7.18 7.01 191184 198038 0 3
Misses in library cache during parse: 0
Elapsed times include waiting on following events:
Event waited on Times Max. Wait Total Waited
---------------------------------------- Waited ---------- ------------
SQL*Net message to client 5 0.00 0.00
SQL*Net message from client 5 22.10 24.73
db file scattered read 8277 0.00 2.70
db file sequential read 780 0.00 0.01
Try an experiement:
ALTER SESSION SET EVENTS '10046 TRACE NAME CONTEXT FOREVER, LEVEL 8';
SELECT SYSDATE FROM DUAL;
I then think about the situation, what happens if my DUAL table is slow... should I have tried this with a different version of the Oracle... anything to kill 45 seconds. Then, then run:
DISCONNECT ALL;
TKPROF output the following:
SELECT SYSDATE
FROM
DUAL
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.00 0.00 0 0 0 1
------- ------ -------- ---------- ---------- ---------- ---------- ----------
total 4 0.00 0.00 0 0 0 1
Misses in library cache during parse: 1
Optimizer mode: ALL_ROWS
Parsing user id: 46
Rows Row Source Operation
------- ---------------------------------------------------
1 FAST DUAL (cr=0 pr=0 pw=0 time=5 us)
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 45.75 45.75
0 seconds of CPU time, elapsed time 0 seconds and 45.75 in the SQL * Net message from the expectation of the client - waiting for the next request from the client computer. Note that the maximum wait is approximately the same Total expected - I think the same is true for you.
Let's look at the raw trace file:
PARSING IN CURSOR #1 len=24 dep=0 uid=46 oct=3 lid=46 tim=360672877551 hv=124468195 ad='7cb3df00'
SELECT SYSDATE FROM DUAL
END OF STMT
PARSE #1:c=0,e=487,p=0,cr=0,cu=0,mis=1,r=0,dep=0,og=1,tim=360672877548
EXEC #1:c=0,e=24,p=0,cr=0,cu=0,mis=0,r=0,dep=0,og=1,tim=360672877886
WAIT #1: nam='SQL*Net message to client' ela= 2 driver id=1413697536 #bytes=1 p3=0 obj#=10417 tim=360672878021
FETCH #1:c=0,e=17,p=0,cr=0,cu=0,mis=0,r=1,dep=0,og=1,tim=360672878117
WAIT #1: nam='SQL*Net message from client' ela= 147 driver id=1413697536 #bytes=1 p3=0 obj#=10417 tim=360672879450
FETCH #1:c=0,e=1,p=0,cr=0,cu=0,mis=0,r=0,dep=0,og=0,tim=360672879532
WAIT #1: nam='SQL*Net message to client' ela= 1 driver id=1413697536 #bytes=1 p3=0 obj#=10417 tim=360672879606
*** 2009-07-22 20:37:47.741
WAIT #1: nam='SQL*Net message from client' ela= 45757081 driver id=1413697536 #bytes=1 p3=0 obj#=10417 tim=360718636761
XCTEND rlbk=0, rd_only=1
STAT #1 id=1 cnt=1 pid=0 pos=1 obj=0 op='FAST DUAL (cr=0 pr=0 pw=0 time=5 us)'
Note the line: "SQL * Net client message' ela = 45757081 - that happened after the last extraction of calls."
In short, the wait is probably at the end, before writing to the trace file has been disabled.
Charles Hooper
IT Manager/Oracle DBA
K & M-making Machine, Inc.
Tags: Database
Similar Questions
-
trace event 10046 - missing privileges
Hello
Version 11201
Please notice what privileges are missing:
SQL > ALTER SESSION SET events 10046 trace name forever, context level 12';
ERROR:
ORA-01031: insufficient privileges
Thank youAllYourDataBase wrote:
I guess that the privilege of the "alter session".I would also say that, but I have the documentation to prove also good :)
http://download.Oracle.com/docs/CD/B19306_01/network.102/b14266/AppendixA.htm#CHDIBAJE
"
Note that the ALTER SESSION privilege is required to set events. Very few users of database should require the alter session privilege.SQL > ALTER SESSION SET EVENTS...
The alter session privilege is not required for other orders of alter session.
SQL > ALTER SESSION SET NLS_TERRITORY = FRANCE;
" -
Statistics 'Lines' of STAT in the trace event 10046, Oracle 11 g.
Hi all!
Why the statistical "Rows" in STAT are different for 10g and 11g?
I have two database with version 10g and 11g, with the same data.
I executed pl/sql code with 10046 trace level 8.
And I get different results when get a raw trace.
In 10g I get statistical lines for all executions - lines = 7.
11 g I get statistics lines first executions - lines = 1. Why?
See my example:
Result Tkprof to Oracle 10g:declare type t_name_tbl is table of varchar2(30) index by binary_integer; v_name_tbl t_name_tbl; v_len number := 10; begin execute immediate 'alter session set timed_statistics = true '; execute immediate 'alter session set statistics_level=all '; execute immediate 'alter session set max_dump_file_size = unlimited '; execute immediate 'alter session set events ''10046 trace name context forever,level 8'' '; loop select cour_name bulk collect into v_name_tbl from country t where length(t.cour_name) = v_len; exit when v_len = 0; v_len := v_len - 1; for i in 1 .. v_name_tbl.count loop dbms_output.put_line(v_name_tbl(i)); end loop; end loop; end;
Tkprof to Oracle 11g result:SELECT COUR_NAME FROM COUNTRY T WHERE LENGTH(T.COUR_NAME) = :B1 call count cpu elapsed disk query current rows ------- ------ -------- ---------- ---------- ---------- ---------- ---------- Parse 1 0.00 0.00 0 0 0 0 Execute 11 0.00 0.00 0 0 0 0 Fetch 11 0.01 0.00 0 44 0 7 ------- ------ -------- ---------- ---------- ---------- ---------- ---------- total 23 0.01 0.00 0 44 0 7 Misses in library cache during parse: 0 Optimizer mode: ALL_ROWS Parsing user id: 649 (recursive depth: 1) Rows Row Source Operation ------- --------------------------------------------------- 7 TABLE ACCESS FULL COUNTRY (cr=44 pr=0 pw=0 time=1576 us)
Can I read about it?SQL ID: 3kqmkg8jp5nwk Plan Hash: 1371235632 SELECT COUR_NAME FROM COUNTRY T WHERE LENGTH(T.COUR_NAME) = :B1 call count cpu elapsed disk query current rows ------- ------ -------- ---------- ---------- ---------- ---------- ---------- Parse 1 0.01 0.00 0 0 0 0 Execute 11 0.02 0.01 0 0 0 0 Fetch 11 0.00 0.01 3 44 0 7 ------- ------ -------- ---------- ---------- ---------- ---------- ---------- total 23 0.03 0.02 3 44 0 7 Misses in library cache during parse: 1 Misses in library cache during execute: 1 Optimizer mode: ALL_ROWS Parsing user id: 82 (recursive depth: 1) Rows Row Source Operation ------- --------------------------------------------------- 1 TABLE ACCESS FULL COUNTRY (cr=4 pr=3 pw=0 time=0 us cost=2 size=44 card=2)
Oracle 11g default written execution plan (lines in the raw trace STAT file) after the first execution of the SQL statement, while before 11 g, the execution plan is written when the slider is closed.
The behavior in 11g can be controlled by changing the parameter PLAN_STAT of the call that allows the monitoring of the default value of FIRST_EXECUTION to ALL_EXECUTIONS:
http://download.Oracle.com/docs/CD/B28359_01/AppDev.111/b28419/d_sessio.htm#i1010518Charles Hooper
Co-author of "Expert Oracle practices: Oracle Database Administration of the Oak Table.
http://hoopercharles.WordPress.com/
IT Manager/Oracle DBA
K & M-making Machine, Inc.Published by: Charles Hooper on August 9, 2010 15:33
The default value on 11g is FIRST_EXECUTION, while the behavior before 11 g is ALL_EXECUTIONS - fixed the incomplete sentence. -
redirect the trace() output to a text box
I have a flash app that works very well in local testing, but fails to load dynamic live on a site if I use the method around javascript "click it to activate the question»
What I want to do is to direct all the output of tracing in a text box, so I can test it in situ. Is this possible in AS2? I know there's the AS3 import flash.util.trace, but I use XP64 so AS3 won't install as he tells me that I don't have XP.
I'm basically looking for a type onTrace event. I know this is a long shot :)
Thank you very much
Ben.Try using firefox with the plugin flashTracer Alessandro Crugnola
https://addons.Mozilla.org/en-us/Firefox/addon/3469
-
When you run FlexUnit 4, I notice the trace messages that looks like this:
27/07/2009 10:58:41.009 [INFO] mx.messaging.Producer ' FDAD15E2-EEEE - 74 B 1-54 C 2 - BD5B98A7AD5A ' producer send message 'D8B2CCED-A9AA-25BB-2FE2-BD5D4071F875 '.
27/07/2009 10:58:41.424 [INFO] mx.messaging.Producer ' FDAD15E2-EEEE - 74 B 1-54 C 2 - BD5B98A7AD5A ' producer recognize "D8B2CCED-A9AA-25BB-2FE2-BD5D4071F875".
2009-07-27 mx.rpc.http.HTTPService 10:58:41.424 [INFO] response HTTPService decoding
Is there a way I can turn off these messages?
Thank you!
Brian
Yes, if you receive the latest news from the branch he won't do it again. You can also wait a day or 2 beta is, but a couple of days.
This is mainly because the logging level has been set to high and we were capture the log messages in the actual classes CPP of the Flex framework as well.
Mike
-
value of P1.y:-112.775; P1 is a Point object;
obj1.AB.HD2 value: 14.775. the HD2 type is number
SORRY ~ ~!, when I printed screen, I forgot remove Math.abs ();
the result is Math.abs ().
This is a test by me...
Sorry, don't look Math.abs ();
I want the result is (-98 >-98) has the false value, but the value is - 97.999999999, the result is true...
Thank you!!! very very very very very very very much!
round to a decimal places you need.
-
No output trace in my Flash Builder 4 Premium
I installed the Flash Builder 4 Premium last night. Updated the sdk for 4.1.0.15186
All right. But I don't have any trace() output.
Instance:
<?xml version="1.0" encoding="utf-8"?> <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" xmlns:mx="library://ns.adobe.com/flex/mx" initialize="trace('Hello World')"> </s:Application>
= > Outputs nothing in the Console window, except:
[SWF] C:\Users\Admin\Adobe Flash Builder 4\test\bin-debug\test.swf - 370,463 bytes after decompression [SWF] C:\Users\Admin\Adobe Flash Builder 4\test\bin-debug\test.swf - 650,528 bytes after decompression [SWF] C:\Users\Admin\Adobe Flash Builder 4\test\bin-debug\test.swf - 159,470 bytes after decompression [SWF] C:\Users\Admin\Adobe Flash Builder 4\test\bin-debug\test.swf - 2,306,258 bytes after decompression [SWF] C:\Users\Admin\Adobe Flash Builder 4\test\bin-debug\test.swf - 1,432,374 bytes after decompression [SWF] C:\Users\Admin\Adobe Flash Builder 4\test\bin-debug\test.swf - 441,362 bytes after decompression [SWF] C:\Users\Admin\Adobe Flash Builder 4\test\bin-debug\test.swf - 323,354 bytes after decompression
-Use the debug mode.
-the Flash Player is a debug version (contains debugger option in the menu)
I can pause the code and examine the issue, so I think it should be something like a "without a Trace" - framework.
I have not found any file mm.cfg on the computer. So I don't think that this could be the error.
Thank you
Jan
This happened to me, on / off power for about 5 months now with Flash Builder. I have not pin does what is the cause. At least in one case he took with my HTML wrapper. Either case, was the plugin Flash Player Debugger. In any case, I replaced (or regenerated) my wrapper at the same time to make it work. And the other time, I reinstalled the plugin.
I hope this helps.
-
Ask the events of trace sql result 10046 level 8 and 12
Hi all, I read the result of events to trace sql 10046 level 8 on
http://www.Oracle-base.com/articles/10G/SQLTrace10046TrcsessAndTkprof10g.php#trace_example
and I do the level of Event 10046 SQL trace 8 or 12. But the results were not even, plan of execution does not appear
How to make the execution plan appears?How to make the execution plan appears?
TKProf
trace_results.txt .trc explain = name of user and password -
Hi all
11.2.0.1 windows 2003
==============
I tried to trace a specific user activity:
HR/HR connection
connected.
SQL > alter session set sql_trace = true;
.. .run some apps deal with...
SQL > alter session set sql_trace = false; > > > to stop the tracing as it eats a lot of disk space.
My user_dump_dest and background_dump_dest points to the same folder C:\oracle\admin\prod\bdump\diag\rdbms\prod\prod\trace
But I had a lot of *.trm and *.trc it: (...) who we're for my track of HR/HR?
Thank you very muchOsama mustafa wrote:
output is written to the directory database UDUMP.
The default name for a trace file is INSTANCE_PID_ora_TRACEID.trc where:
INSTANCE is the name of the Oracle instance
PID is the process ID of the operating system (V$ PROCESS.) OSPID); and
TRACEID is a string of your choice.Output trace is not quite readable. However, Oracle provides a utility called TKProf, which can be used to format the trace output.
In fact, it's very readable, just very very detailed. Cary Milsap wrote a book detailing how read.
But yes, in general it should use tkprof to summarize and analyze.
-
Value display trace in the dynamic text box
Hey just work on an exercise and I can't understand the code to display the value of the trace in a dynamic text box.
The following code generates exactly where I am at this time.
Import 12345678910111213import;
import flash.text.TextField;
Basic color picker (based pixel)
var myColourBitmapData:BitmapData = new BitmapData (500 400, false, 0xFFFFFF * Math.random ());
var myColourBitmapImage:Bitmap = new Bitmap (myColourBitmapData);
Add to list
addChild (myColourBitmapImage); Add to the scene
Get colors
var pixelValue:uint = myColourBitmapData.getPixel (85,62); color of the pixel at X, Y
displayed in the output window
trace (pixelValue.toString (16)); toString (16) converts uint in a number of Hexadecimel format
Here are a few screens, I want the values of trace output to appear next to the text in the dynamic text box
I'm not sure of how to call the pixelValue to my text box, any help would be appreciated!
Before or after the line that begins with «trace...» ' set dynamicTextFieldInstanceName.text = pixelValue.toString (16); Replace dynamicTextFieldInstanceName with the actual name that you gave to the dynamic textfield.
There is an error in your output window. It seems that you have not integrated a font in the dynamic textField.
-
CS5 Trace can not see the distance?
Hi I just bought CS5 as a week ago.
I'm finally move to use it for the previous content and now my the trace output does not work for anything.
The output window opens, but nothing prints.
I also get TweenMax errors in something that I haven't touched in weeks.
Anyone had this happen?
Check your settings to make sure that the trace output is selected for publication. Click on the upper right of the Panel out and make sure that the filter of trace level is verbose.
-
Hello, all.
So, I'm a new in ODSI, in advance, my excuse to basic questions.
I would use the fn:trace () function. However, the following code does not send information either on AdminServer.log or Wokshop console. What is the reason?
declare the procedure tns:test() {}
declare $timeBefore as XS: date: = fn:current-date();
FN: trace($timeBefore, "My First test"); -> How to see the trace output?
Returns the value $timeBefore.
};
Here's what I have in the console AdminServer.log and workshop:
common/application {}
user: weblogic
name: testCase2
EventKind: update
Server: AdminServer
}
performance of the query / {}
compiletime: 93
}
common, session, request, invocation {}
time: Tue may 25 15:41:12 IDT 2010
Duration: 0
}
Update/service {}
procedure: test
arity: 0
DataService: ld:Logical/over_files/testCase_OverFiles.ds
script: declare ns0 namespace = "" ld: logic/over_files/testCase_OverFiles ";"
{return value ns0:test() ;}
}
{/ common time signature}
timestamp: Tue may 25 15:41:12 IDT 2010
Duration: 93
}
Best regards
Yuri.
Edited by: ygauchma may 25, 2010 05:59Because I'm not over your shoulder, it must be very clear on what you tried.
Your first post show you a procedure using the trace. Well, I tried this, and instructions (ODSI set to debug and WLS logging of debug level log level) and it worked. Have you tried that? Doing a job?
Now you're showing a function. Have you tried setting log levels?
Where are you looking for results? The will NOT in the Console for ODSI Studio Test view (I guess that's where you're looking). They will be in the WLS log file if you have configured the log WLS-> Log level = debug file. They will be in the WLS (stdout/stderr) console if you have configured this Log level = debug.
I believe that the trace function is implementation specific, then there is no such thing as a generic example.
-Mike
-
Help setting up a SQL query with poor performance
Hi all
Database version: 10.2.0.5
I'm working on a new report to view the top users by the number of calls. The table is truncated and filled again every month with records for the previous month; It contains approximately 400 000 records.
I created a view with the columns needed for the report; also, the two functions of view calls to determine if a phone number is assigned to multiple staffs or several departments.
It's full again table every month:
CREATE TABLE "VOIP"."MONTHLY_BILLING_DETAILS" ( "ID" NUMBER NOT NULL ENABLE, "CDRRECORDTYPE" NUMBER, "G_CALLMANAGERID" NUMBER, "G_CALLID" NUMBER, "O_LEGCALLIDENTIFIER" NUMBER, "DATETIMEORIGINATION" NUMBER, "O_NODEID" NUMBER, "O_SPAN" NUMBER, "O_IPADDR" NUMBER, "CALLINGPARTYNUMBER" VARCHAR2(50 BYTE) NOT NULL ENABLE, "CALLINGPARTY_USERID" VARCHAR2(128 BYTE), "O_CAUSE_LOCATION" NUMBER, "O_CAUSE_VALUE" NUMBER, "O_PRECEDENCELEVEL" NUMBER, "O_MEDIATRANSPORTADDR_IP" NUMBER, "O_MEDIATRANSPORTADDR_PORT" NUMBER, "O_MCAP_PAYLOADCAPABILITY" NUMBER, "O_MCAP_MAXFRAMESPERPACKET" NUMBER, "O_MCAP_G723BITRATE" NUMBER, "O_VCAP_CODEC" NUMBER, "O_VCAP_BANDWIDTH" NUMBER, "O_VCAP_RESOLUTION" NUMBER, "O_VIDEOTRANSPORTADDR_IP" NUMBER, "O_VIDEOTRANSPORTADDR_PORT" NUMBER, "O_RSVPAUDIOSTAT" VARCHAR2(64 BYTE), "O_RSVPVIDEOSTAT" VARCHAR2(64 BYTE), "DESTLEGIDENTIFIER" NUMBER, "DESTNODEID" NUMBER, "DESTSPAN" NUMBER, "DESTIPADDR" NUMBER, "ORIGINALCALLEDPARTYNUMBER" VARCHAR2(50 BYTE), "FINALC_PARTYNUMBER" VARCHAR2(50 BYTE), "FINALC_PARTY_USERID" VARCHAR2(128 BYTE), "DESTCAUSE_LOCATION" NUMBER, "DESTCAUSE_VALUE" NUMBER, "DESTPRECEDENCELEVEL" NUMBER, "DESTMEDIATRANSPORTADDR_IP" NUMBER, "DESTMEDIATRANSPORTADDR_PORT" NUMBER, "DESTMCAP_PAYLOADCAPABILITY" NUMBER, "DESTMCAP_MAXFRAMESPERPACKET" NUMBER, "DESTMCAP_G723BITRATE" NUMBER, "DV_CAP_CODEC" NUMBER, "DV_CAP_BANDWIDTH" NUMBER, "DV_CAP_RESOLUTION" NUMBER, "DV_TRANSPORTADDR_IP" NUMBER, "DV_TRANSPORTADDR_PORT" NUMBER, "DESTRSVPAUDIOSTAT" VARCHAR2(64 BYTE), "DESTRSVPVIDEOSTAT" VARCHAR2(64 BYTE), "DATETIMECONNECT" NUMBER, "DATETIMEDISCONNECT" NUMBER, "LASTREDIRECTDN" VARCHAR2(50 BYTE), "PKID" VARCHAR2(4000 BYTE), "O_INALCALLEDPARTYNUM_PARTITION" VARCHAR2(50 BYTE), "CALLINGPARTYNUM_PARTITION" VARCHAR2(50 BYTE), "FINALC_PARTYNUM_PARTITION" VARCHAR2(50 BYTE), "LASTREDIRECTDNPARTITION" VARCHAR2(50 BYTE), "DURATION" NUMBER, "O_DEVICENAME" VARCHAR2(129 BYTE), "DESTDEVICENAME" VARCHAR2(129 BYTE), "O_CALLTERMINATION_BEHALF" NUMBER, "DESTCALLTERMINATION_BEHALF" NUMBER, "O_CALLEDPARTYREDIRECT_BEHALF" NUMBER, "LASTREDIRECTREDIRECT_BEHALF" NUMBER, "O_CALLEDPARTYREDIRECTREASON" NUMBER, "LASTREDIRECTREDIRECTREASON" NUMBER, "DESTCONVERSATIONID" NUMBER, "G_CALLID_CLUSTERID" VARCHAR2(50 BYTE), "JOIN_BEHALF" NUMBER, "COMMENTS" VARCHAR2(2048 BYTE), "AUTHCODEDESCRIPTION" VARCHAR2(50 BYTE), "AUTHORIZATIONLEVEL" NUMBER, "CLIENTMATTERCODE" VARCHAR2(32 BYTE), "O_DTMFMETHOD" NUMBER, "DESTDTMFMETHOD" NUMBER, "CALLSECUREDSTATUS" NUMBER, "O_CONVERSATIONID" NUMBER, "O_MCAP_BANDWIDTH" NUMBER, "DESTMCAP_BANDWIDTH" NUMBER, "AUTHORIZATIONCODEVALUE" VARCHAR2(32 BYTE), "OUTPULSEDCALLINGPARTYNUMBER" VARCHAR2(50 BYTE), "OUTPULSEDCALLEDPARTYNUMBER" VARCHAR2(50 BYTE), "O_IPV4V6ADDR" VARCHAR2(64 BYTE), "DESTIPV4V6ADDR" VARCHAR2(64 BYTE), "O_VCAP_CODEC_CHAN2" NUMBER, "O_VCAP_BANDWIDTH_CHAN2" NUMBER, "O_VCAP_RESOLUTION_CHAN2" NUMBER, "O_V_TRANSPORTADDR_IP_CHAN2" NUMBER, "O_V_TRANSPORTADDR_PORT_CHAN2" NUMBER, "O_V_OCHANNEL_ROLE_CHAN2" NUMBER, "DV_CAP_CODEC_CHAN2" NUMBER, "DV_CAP_BANDWIDTH_CHAN2" NUMBER, "DV_CAP_RESOLUTION_CHAN2" NUMBER, "DV_TRANSPORTADDR_IP_CHAN2" NUMBER, "DV_TRANSPORTADDR_PORT_CHAN2" NUMBER, "DV_CHANNEL_ROLE_CHAN2" NUMBER, "DATE_CREATED" DATE, "DATETIME_CONNECT" DATE, "DATETIME_DISCONNECT" DATE, "USERID_EMAIL_ADDRESS" VARCHAR2(100 BYTE), "FROM_FULL_TELEPHONE" VARCHAR2(20 BYTE), "TO_FULL_TELEPHONE" VARCHAR2(20 BYTE), "FROM_EXCHANGE" VARCHAR2(7 BYTE), "TO_EXCHANGE" VARCHAR2(20 BYTE), "FROM_CITY" VARCHAR2(200 BYTE), "FROM_STATE" VARCHAR2(2 BYTE), "TO_CITY" VARCHAR2(200 BYTE), "TO_STATE" VARCHAR2(2 BYTE), "CALL_TYPE" VARCHAR2(10 BYTE), CONSTRAINT "MONTHLY_BILLING_PK" PRIMARY KEY ("ID") USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 3145728 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT) TABLESPACE "VOIPDATA" ENABLE ) PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING STORAGE(INITIAL 75497472 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT) TABLESPACE "VOIPDATA" ; CREATE INDEX "VOIP"."MONTHLY_BILL_INDEX1" ON "VOIP"."MONTHLY_BILLING_DETAILS" (TRUNC("DATETIME_CONNECT")) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 4194304 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT) TABLESPACE "VOIPDATA" ; CREATE INDEX "VOIP"."MONTHLY_BILL_INDEX10" ON "VOIP"."MONTHLY_BILLING_DETAILS" ("CALL_TYPE") PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 4194304 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT) TABLESPACE "VOIPDATA" ; CREATE INDEX "VOIP"."MONTHLY_BILL_INDEX2" ON "VOIP"."MONTHLY_BILLING_DETAILS" ("FROM_EXCHANGE") PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 3145728 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT) TABLESPACE "VOIPDATA" ; CREATE INDEX "VOIP"."MONTHLY_BILL_INDEX3" ON "VOIP"."MONTHLY_BILLING_DETAILS" ("FROM_FULL_TELEPHONE", TRUNC("DATETIME_CONNECT")) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT) TABLESPACE "VOIPDATA" ; CREATE INDEX "VOIP"."MONTHLY_BILL_INDEX4" ON "VOIP"."MONTHLY_BILLING_DETAILS" ("DATETIME_CONNECT", NVL("FROM_FULL_TELEPHONE","CALLINGPARTYNUMBER")) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 5242880 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT) TABLESPACE "VOIPDATA" ; CREATE INDEX "VOIP"."MONTHLY_BILL_INDEX5" ON "VOIP"."MONTHLY_BILLING_DETAILS" ("DATETIME_CONNECT", NVL("TO_FULL_TELEPHONE","ORIGINALCALLEDPARTYNUMBER")) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 5242880 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT) TABLESPACE "VOIPDATA" ; CREATE INDEX "VOIP"."MONTHLY_BILL_INDEX6" ON "VOIP"."MONTHLY_BILLING_DETAILS" (TO_CHAR("DATETIME_CONNECT",'fmMONTH YYYY')) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 4194304 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT) TABLESPACE "VOIPDATA" ; CREATE INDEX "VOIP"."MONTHLY_BILL_INDEX7" ON "VOIP"."MONTHLY_BILLING_DETAILS" ("TO_EXCHANGE") PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 3145728 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT) TABLESPACE "VOIPDATA" ; CREATE INDEX "VOIP"."MONTHLY_BILL_INDEX8" ON "VOIP"."MONTHLY_BILLING_DETAILS" (NVL("FROM_FULL_TELEPHONE","CALLINGPARTYNUMBER")) PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 4194304 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT) TABLESPACE "VOIPDATA" ; CREATE INDEX "VOIP"."MONTHLY_BILL_INDEX9" ON "VOIP"."MONTHLY_BILLING_DETAILS" ("DATETIME_CONNECT") PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 3145728 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT) TABLESPACE "VOIPDATA" ;
These are the functions to determine if a phone number is assigned to multiple staffs or departments:
FUNCTION GET_EMPLOYEE_NAME (P_FROM_FULL_TELEPHONE IN VARCHAR2) RETURN VARCHAR2 AS L_NAME EMPLOYEES.NAME%TYPE; BEGIN SELECT NAME INTO L_NAME FROM EMPLOYEES WHERE WORK_PHONE_1_FORMAT = P_FROM_FULL_TELEPHONE; RETURN L_NAME; EXCEPTION WHEN TOO_MANY_ROWS THEN L_NAME := 'Multiple Employees'; RETURN L_NAME; WHEN NO_DATA_FOUND THEN L_NAME := 'No Employee Assigned'; RETURN L_NAME; WHEN OTHERS THEN NULL; END;
FUNCTION GET_DEPARTMENT_NAME (P_FROM_FULL_TELEPHONE IN VARCHAR2) RETURN VARCHAR2 AS L_DEPT_DESCR EMPLOYEES.DEPT_DESCR%TYPE; BEGIN SELECT DEPT_DESCR INTO L_DEPT_DESCR FROM EMPLOYEES WHERE WORK_PHONE_1_FORMAT = P_FROM_FULL_TELEPHONE; RETURN L_DEPT_DESCR; EXCEPTION WHEN TOO_MANY_ROWS THEN L_DEPT_DESCR := 'Multiple Departments'; RETURN L_DEPT_DESCR; WHEN NO_DATA_FOUND THEN L_DEPT_DESCR := 'No Department Assigned'; RETURN L_DEPT_DESCR; WHEN OTHERS THEN NULL; END;
This is the point of view that I'll use in the report:
CREATE OR REPLACE FORCE VIEW "VOIP"."TOP_USERS_BY_CALLS_V" ("TOP_NO", "EMPLOYEE_NAME", "EMPLOYEE_DEPARTMENT", "PHONE_NUMBER", "QUANTITY_CALLS") AS SELECT ROWNUM, VOIP_PKG.GET_EMPLOYEE_NAME(FROM_FULL_TELEPHONE), VOIP_PKG.GET_DEPARTMENT_NAME(FROM_FULL_TELEPHONE), FROM_FULL_TELEPHONE, QUANTITY_CALLS FROM ( SELECT MBD.FROM_FULL_TELEPHONE, COUNT(1) QUANTITY_CALLS FROM MONTHLY_BILLING_DETAILS MBD WHERE MBD.FROM_FULL_TELEPHONE IS NOT NULL AND MBD.FROM_FULL_TELEPHONE <> '000-000-0000' AND LENGTH(MBD.FROM_FULL_TELEPHONE) = 12 AND LENGTH(MBD.TO_FULL_TELEPHONE) = 12 AND SUBSTR(MBD.TO_FULL_TELEPHONE,1,3) NOT IN (SELECT AREA_CODE FROM NYNJ_METRO_AREA_CODES) AND SUBSTR(MBD.TO_FULL_TELEPHONE,1,3) NOT IN ('800','822','833','844', '855','866','877','888') GROUP BY MBD.FROM_FULL_TELEPHONE ORDER BY QUANTITY_CALLS DESC ) WHERE ROWNUM <= 100;
Explain Plan output and Extended SQL Trace:
SQL> SQL> show parameter user_dump_dest NAME TYPE VALUE ------------------------------------ ----------- ------------------------------ user_dump_dest string D:\ORACLEHOMES\ADMIN\RTS9\UDUM P SQL> SQL> show parameter optimizer NAME TYPE VALUE ------------------------------------ ----------- ------------------------------ optimizer_dynamic_sampling integer 2 optimizer_features_enable string 10.2.0.5 optimizer_index_caching integer 0 optimizer_index_cost_adj integer 100 optimizer_mode string ALL_ROWS optimizer_secure_view_merging boolean TRUE SQL> SQL> show parameter db_file_multi NAME TYPE VALUE ------------------------------------ ----------- ------------------------------ db_file_multiblock_read_count integer 16 SQL> SQL> show parameter db_block_size NAME TYPE VALUE ------------------------------------ ----------- ------------------------------ db_block_size integer 8192 SQL> SQL> show parameter cursor_sharing NAME TYPE VALUE ------------------------------------ ----------- ------------------------------ cursor_sharing string EXACT SQL> SQL> column sname format a20 SQL> column pname format a20 SQL> column pval2 format a20 SQL> SQL> select 2 sname 3 , pname 4 , pval1 5 , pval2 6 from 7 sys.aux_stats$; SNAME PNAME PVAL1 PVAL2 -------------------- -------------------- ---------- -------------------- SYSSTATS_INFO STATUS COMPLETED SYSSTATS_INFO DSTART 02-09-2009 15:46 SYSSTATS_INFO DSTOP 02-09-2009 15:46 SYSSTATS_INFO FLAGS 1 SYSSTATS_MAIN CPUSPEEDNW 1259.6206 SYSSTATS_MAIN IOSEEKTIM 10 SYSSTATS_MAIN IOTFRSPEED 4096 SYSSTATS_MAIN SREADTIM SYSSTATS_MAIN MREADTIM SYSSTATS_MAIN CPUSPEED SYSSTATS_MAIN MBRC SYSSTATS_MAIN MAXTHR SYSSTATS_MAIN SLAVETHR 13 rows selected. Elapsed: 00:00:00.03 SQL> SQL> explain plan for 2 SELECT 3 TOP_NO, 4 EMPLOYEE_NAME, 5 EMPLOYEE_DEPARTMENT, 6 PHONE_NUMBER, 7 QUANTITY_CALLS 8 FROM 9 TOP_USERS_BY_CALLS_V 10 ORDER BY 11 QUANTITY_CALLS DESC; Explained. Elapsed: 00:00:00.18 SQL> SQL> select * from table(dbms_xplan.display); PLAN_TABLE_OUTPUT ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Plan hash value: 826236322 ---------------------------------------------------------------------------------------------------------------- | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time | ---------------------------------------------------------------------------------------------------------------- | 0 | SELECT STATEMENT | | 1 | 4042 | 1313 (1)| 00:00:16 | | 1 | SORT ORDER BY | | 1 | 4042 | 1313 (1)| 00:00:16 | | 2 | VIEW | TOP_USERS_BY_CALLS_V | 1 | 4042 | 1312 (1)| 00:00:16 | |* 3 | COUNT STOPKEY | | | | | | | 4 | VIEW | | 1 | 25 | 1312 (1)| 00:00:16 | |* 5 | SORT ORDER BY STOPKEY | | 1 | 26 | 1312 (1)| 00:00:16 | | 6 | HASH GROUP BY | | 1 | 26 | 1312 (1)| 00:00:16 | |* 7 | FILTER | | | | | | |* 8 | TABLE ACCESS BY INDEX ROWID| MONTHLY_BILLING_DETAILS | 1 | 26 | 1310 (1)| 00:00:16 | |* 9 | INDEX FULL SCAN | MONTHLY_BILL_INDEX3 | 934 | | 449 (1)| 00:00:06 | |* 10 | INDEX FULL SCAN | NYNJ_METRO_AREA_CODES_UK1 | 1 | 4 | 1 (0)| 00:00:01 | ---------------------------------------------------------------------------------------------------------------- Predicate Information (identified by operation id): --------------------------------------------------- 3 - filter(ROWNUM<=100) 5 - filter(ROWNUM<=100) 7 - filter( NOT EXISTS (SELECT 0 FROM VOIP."NYNJ_METRO_AREA_CODES" "NYNJ_METRO_AREA_CODES" WHERE LNNVL("AREA_CODE"<>SUBSTR(:B1,1,3)))) 8 - filter(LENGTH("MBD"."TO_FULL_TELEPHONE")=12 AND SUBSTR("MBD"."TO_FULL_TELEPHONE",1,3)<>'800' AND SUBSTR("MBD"."TO_FULL_TELEPHONE",1,3)<>'822' AND SUBSTR("MBD"."TO_FULL_TELEPHONE",1,3)<>'833' AND SUBSTR("MBD"."TO_FULL_TELEPHONE",1,3)<>'844' AND SUBSTR("MBD"."TO_FULL_TELEPHONE",1,3)<>'855' AND SUBSTR("MBD"."TO_FULL_TELEPHONE",1,3)<>'866' AND SUBSTR("MBD"."TO_FULL_TELEPHONE",1,3)<>'877' AND SUBSTR("MBD"."TO_FULL_TELEPHONE",1,3)<>'888') 9 - filter(LENGTH("MBD"."FROM_FULL_TELEPHONE")=12 AND "MBD"."FROM_FULL_TELEPHONE"<>'000-000-0000' AND "MBD"."FROM_FULL_TELEPHONE" IS NOT NULL) 10 - filter(LNNVL("AREA_CODE"<>SUBSTR(:B1,1,3))) 33 rows selected. Elapsed: 00:00:00.82 SQL> SQL> rollback; Rollback complete. Elapsed: 00:00:00.00 SQL> SQL> set autotrace traceonly arraysize 100 SQL> SQL> alter session set tracefile_identifier = 'mytrace1'; Session altered. Elapsed: 00:00:00.01 SQL> SQL> alter session set events '10046 trace name context forever, level 8'; Session altered. Elapsed: 00:00:00.15 SQL> SQL> SELECT 2 TOP_NO, 3 EMPLOYEE_NAME, 4 EMPLOYEE_DEPARTMENT, 5 PHONE_NUMBER, 6 QUANTITY_CALLS 7 FROM 8 TOP_USERS_BY_CALLS_V 9 ORDER BY 10 QUANTITY_CALLS DESC; 100 rows selected. Elapsed: 00:10:37.68 Execution Plan ---------------------------------------------------------- Plan hash value: 826236322 ---------------------------------------------------------------------------------------------------------------- | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time | ---------------------------------------------------------------------------------------------------------------- | 0 | SELECT STATEMENT | | 1 | 4042 | 1313 (1)| 00:00:16 | | 1 | SORT ORDER BY | | 1 | 4042 | 1313 (1)| 00:00:16 | | 2 | VIEW | TOP_USERS_BY_CALLS_V | 1 | 4042 | 1312 (1)| 00:00:16 | |* 3 | COUNT STOPKEY | | | | | | | 4 | VIEW | | 1 | 25 | 1312 (1)| 00:00:16 | |* 5 | SORT ORDER BY STOPKEY | | 1 | 26 | 1312 (1)| 00:00:16 | | 6 | HASH GROUP BY | | 1 | 26 | 1312 (1)| 00:00:16 | |* 7 | FILTER | | | | | | |* 8 | TABLE ACCESS BY INDEX ROWID| MONTHLY_BILLING_DETAILS | 1 | 26 | 1310 (1)| 00:00:16 | |* 9 | INDEX FULL SCAN | MONTHLY_BILL_INDEX3 | 934 | | 449 (1)| 00:00:06 | |* 10 | INDEX FULL SCAN | NYNJ_METRO_AREA_CODES_UK1 | 1 | 4 | 1 (0)| 00:00:01 | ---------------------------------------------------------------------------------------------------------------- Predicate Information (identified by operation id): --------------------------------------------------- 3 - filter(ROWNUM<=100) 5 - filter(ROWNUM<=100) 7 - filter( NOT EXISTS (SELECT 0 FROM VOIP."NYNJ_METRO_AREA_CODES" "NYNJ_METRO_AREA_CODES" WHERE LNNVL("AREA_CODE"<>SUBSTR(:B1,1,3)))) 8 - filter(LENGTH("MBD"."TO_FULL_TELEPHONE")=12 AND SUBSTR("MBD"."TO_FULL_TELEPHONE",1,3)<>'800' AND SUBSTR("MBD"."TO_FULL_TELEPHONE",1,3)<>'822' AND SUBSTR("MBD"."TO_FULL_TELEPHONE",1,3)<>'833' AND SUBSTR("MBD"."TO_FULL_TELEPHONE",1,3)<>'844' AND SUBSTR("MBD"."TO_FULL_TELEPHONE",1,3)<>'855' AND SUBSTR("MBD"."TO_FULL_TELEPHONE",1,3)<>'866' AND SUBSTR("MBD"."TO_FULL_TELEPHONE",1,3)<>'877' AND SUBSTR("MBD"."TO_FULL_TELEPHONE",1,3)<>'888') 9 - filter(LENGTH("MBD"."FROM_FULL_TELEPHONE")=12 AND "MBD"."FROM_FULL_TELEPHONE"<>'000-000-0000' AND "MBD"."FROM_FULL_TELEPHONE" IS NOT NULL) 10 - filter(LNNVL("AREA_CODE"<>SUBSTR(:B1,1,3))) Statistics ---------------------------------------------------------- 365 recursive calls 0 db block gets 689543 consistent gets 212906 physical reads 0 redo size 5984 bytes sent via SQL*Net to client 400 bytes received via SQL*Net from client 2 SQL*Net roundtrips to/from client 2 sorts (memory) 0 sorts (disk) 100 rows processed SQL> SQL> disconnect
Part of the automatic trace output:
SELECT TOP_NO, EMPLOYEE_NAME, EMPLOYEE_DEPARTMENT, PHONE_NUMBER, QUANTITY_CALLS FROM TOP_USERS_BY_CALLS_V ORDER BY QUANTITY_CALLS DESC call count cpu elapsed disk query current rows ------- ------ -------- ---------- ---------- ---------- ---------- ---------- Parse 1 0.00 0.43 0 0 0 0 Execute 1 0.00 0.00 0 0 0 0 Fetch 2 24.70 635.81 212587 631823 0 100 ------- ------ -------- ---------- ---------- ---------- ---------- ---------- total 4 24.70 636.25 212587 631823 0 100 Misses in library cache during parse: 1 Optimizer mode: ALL_ROWS Parsing user id: 148 Rows Row Source Operation ------- --------------------------------------------------- 100 SORT ORDER BY (cr=689531 pr=212900 pw=0 time=636823070 us) 100 VIEW TOP_USERS_BY_CALLS_V (cr=689531 pr=212900 pw=0 time=642681672 us) 100 COUNT STOPKEY (cr=631823 pr=212587 pw=0 time=635667026 us) 100 VIEW (cr=631823 pr=212587 pw=0 time=635666810 us) 100 SORT ORDER BY STOPKEY (cr=631823 pr=212587 pw=0 time=635666493 us) 2512 HASH GROUP BY (cr=631823 pr=212587 pw=0 time=635666125 us) 27112 FILTER (cr=631823 pr=212587 pw=0 time=519230237 us) 315563 TABLE ACCESS BY INDEX ROWID MONTHLY_BILLING_DETAILS (cr=381523 pr=212587 pw=0 time=580209555 us) 394473 INDEX FULL SCAN MONTHLY_BILL_INDEX3 (cr=2679 pr=2679 pw=0 time=26793918 us)(object id 206675) 226627 INDEX FULL SCAN NYNJ_METRO_AREA_CODES_UK1 (cr=250300 pr=0 pw=0 time=3575488 us)(object id 206605) 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 db file sequential read 212587 0.20 611.67 SQL*Net message from client 2 0.00 0.00 SQL*Net more data to client 2 0.00 0.00 ********************************************************************************
DBMS_XPLAN. Output DISPLAY_CURSOR:
SQL> SQL> select * from table(dbms_xplan.display_cursor(null, null, 'ALLSTATS LAST')); PLAN_TABLE_OUTPUT ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- SQL_ID 1ut636vt58jdw, child number 0 ------------------------------------- SELECT /*+ gather_plan_statistics */ TOP_NO, EMPLOYEE_NAME, EMPLOYEE_DEPARTMENT, PHONE_NUMBER, QUANTITY_CALLS FROM TOP_USERS_BY_CALLS_V ORDER BY QUANTITY_CALLS DESC Plan hash value: 826236322 -------------------------------------------------------------------------------------------------------------------------------------------------------------- | Id | Operation | Name | Starts | E-Rows | A-Rows | A-Time | Buffers | Reads | OMem | 1Mem | Used-Mem | -------------------------------------------------------------------------------------------------------------------------------------------------------------- | 0 | SELECT STATEMENT | | 1 | | 100 |00:09:56.06 | 689K| 210K| | | | | 1 | SORT ORDER BY | | 1 | 1 | 100 |00:09:56.06 | 689K| 210K| 13312 | 13312 |12288 (0)| | 2 | VIEW | TOP_USERS_BY_CALLS_V | 1 | 1 | 100 |00:10:04.98 | 689K| 210K| | | | |* 3 | COUNT STOPKEY | | 1 | | 100 |00:09:54.89 | 631K| 210K| | | | | 4 | VIEW | | 1 | 1 | 100 |00:09:54.89 | 631K| 210K| | | | |* 5 | SORT ORDER BY STOPKEY | | 1 | 1 | 100 |00:09:54.88 | 631K| 210K| 6144 | 6144 | 6144 (0)| | 6 | HASH GROUP BY | | 1 | 1 | 2512 |00:09:54.88 | 631K| 210K| 821K| 821K| 1153K (0)| |* 7 | FILTER | | 1 | | 27112 |00:08:58.57 | 631K| 210K| | | | |* 8 | TABLE ACCESS BY INDEX ROWID| MONTHLY_BILLING_DETAILS | 1 | 1 | 315K|00:08:57.07 | 381K| 210K| | | | |* 9 | INDEX FULL SCAN | MONTHLY_BILL_INDEX3 | 1 | 934 | 394K|00:00:23.02 | 2679 | 2679 | | | | |* 10 | INDEX FULL SCAN | NYNJ_METRO_AREA_CODES_UK1 | 250K| 1 | 226K|00:00:03.47 | 250K| 0 | | | | -------------------------------------------------------------------------------------------------------------------------------------------------------------- Predicate Information (identified by operation id): --------------------------------------------------- 3 - filter(ROWNUM<=100) 5 - filter(ROWNUM<=100) 7 - filter( IS NULL) 8 - filter((LENGTH("MBD"."TO_FULL_TELEPHONE")=12 AND SUBSTR("MBD"."TO_FULL_TELEPHONE",1,3)<>'800' AND SUBSTR("MBD"."TO_FULL_TELEPHONE",1,3)<>'822' AND SUBSTR("MBD"."TO_FULL_TELEPHONE",1,3)<>'833' AND SUBSTR("MBD"."TO_FULL_TELEPHONE",1,3)<>'844' AND SUBSTR("MBD"."TO_FULL_TELEPHONE",1,3)<>'855' AND SUBSTR("MBD"."TO_FULL_TELEPHONE",1,3)<>'866' AND SUBSTR("MBD"."TO_FULL_TELEPHONE",1,3)<>'877' AND SUBSTR("MBD"."TO_FULL_TELEPHONE",1,3)<>'888')) 9 - filter((LENGTH("MBD"."FROM_FULL_TELEPHONE")=12 AND "MBD"."FROM_FULL_TELEPHONE"<>'000-000-0000' AND "MBD"."FROM_FULL_TELEPHONE" IS NOT NULL)) 10 - filter(LNNVL("AREA_CODE"<>SUBSTR(:B1,1,3))) 35 rows selected. Elapsed: 00:00:00.50 SQL> SQL> spool off
Any help will be greatly appreciated. Please let me know if you need additional information.
Thank you
Erick
ediazjorge wrote:
Please let me know if you need additional information or do additional tests.
Thanks again!
Erick
It's to you if you are satisfied or interested in improvements (if possible).
If so the first thing I would like if you had your refreshed perspective as advised. According to expected area_code table cardinalities I doubt.
So, if not cool off with dbms_stats.gather_table_stats on two tables, area_codes and MONTHLY_BILLING_DETAILS.
Bottlenecks are now obviously the full table of MONTHLY_BILLING_DETAILS as well as the ANTI of LOOPS IMBRIQUEES scan.
At the moment I don't think that an index of MONTHLY_BILLING_DETAILS will help a lot, because most of the lines will pass filter predicates, and because we need some columns in it, I have now I there will be gain a full index scan.
I was surprissed that the optimizer pushes the substr <> predicates to both tables.
So depending on your data, you might try
1 make a factory of subquery select the two MONTHLY_BILLING_DETAILS columns that all directly apply predicates of membership and use it directly in the join instead of the table.
or
2. If all subtr to so are part of the table area_code choose in it using a subquery (or inline view) plant excluding these values.
Both are attempts to get rid of the substr excluding as filters of join predicates.
In fact, I was expecting a hash join anti as shown in the plan to explain instead of the nested loops anti, I expect to be more effective in this case.
Perhaps with correct cardinalities the optimizier would understand himself.
Just to test it, you can try the use_hash hint in the join:
Select / * + USE_HASH (MBD, one) * /.
..
OF MONTHLY_BILLING_DETAILS MBD,.
NYNJ_METRO_AREA_CODES one
(It's a good habit anyway usually use aliases and precede the names of columns. In the, it is easier to read queries are only trivial).
-
Query in Oracle 10 fast but slow in Oracle 11
Hi all
We have a query that runs smoothly in Oracle 10 g. It takes less then a second. We installed a second server and import/export to create the same 11g database. On this 11g database query takes a long time (like 8 seconds or more).
Here are the details. Maybe someone can tell us the reason why this happens.
We are talking about this statement:
Version of database is 11.2.0.1.0Select nvl(sum(BM_OPENST_D - BM_OPENST_CR),0) from bh.bh123gh where F123_AR_NR>='4400000000' and F123_AR_NR<='4404000000' and F123_KL_LEV_AR_NR='0631001000' and SRT_REK=2 and F123_BKJR>=0000 and F123_BKJR<=2011 and F123_FIRMA=2;
The trace output:SQL> SQL> show parameter optimizer NAME TYPE VALUE ------------------------------------ ----------- ------------------------------ optimizer_capture_sql_plan_baselines boolean FALSE optimizer_dynamic_sampling integer 2 optimizer_features_enable string 11.2.0.1 optimizer_index_caching integer 0 optimizer_index_cost_adj integer 100 optimizer_mode string ALL_ROWS optimizer_secure_view_merging boolean TRUE optimizer_use_invisible_indexes boolean FALSE optimizer_use_pending_statistics boolean FALSE optimizer_use_sql_plan_baselines boolean TRUE SQL> SQL> show parameter db_file_multi NAME TYPE VALUE ------------------------------------ ----------- ------------------------------ db_file_multiblock_read_count integer 6 SQL> SQL> show parameter db_block_size NAME TYPE VALUE ------------------------------------ ----------- ------------------------------ db_block_size integer 8192 SQL> SQL> show parameter cursor_sharing NAME TYPE VALUE ------------------------------------ ----------- ------------------------------ cursor_sharing string EXACT SQL> SQL> column sname format a20 SQL> column pname format a20 SQL> column pval2 format a20 SQL> SQL> select sname 2 , pname 3 , pval1 4 , pval2 5 from 6 sys.aux_stats$; SNAME PNAME PVAL1 PVAL2 -------------------- -------------------- ---------- -------------------- SYSSTATS_INFO STATUS COMPLETED SYSSTATS_INFO DSTART 03-30-2010 11:05 SYSSTATS_INFO DSTOP 03-30-2010 11:05 SYSSTATS_INFO FLAGS 1 SYSSTATS_MAIN CPUSPEEDNW 1183.90219 SYSSTATS_MAIN IOSEEKTIM 10 SYSSTATS_MAIN IOTFRSPEED 4096 SYSSTATS_MAIN SREADTIM SYSSTATS_MAIN MREADTIM SYSSTATS_MAIN CPUSPEED SYSSTATS_MAIN MBRC SYSSTATS_MAIN MAXTHR SYSSTATS_MAIN SLAVETHR 13 rows selected. Elapsed: 00:00:00.03 SQL> SQL> explain plan for 2 Select nvl(sum(BM_OPENST_DEB - BM_OPENST_CR),0) 3 from bh.bh123gh 4 where 5 F123_AR_NR>='4400000000' and 6 F123_AR_NR<='4404000000' and 7 F123_KL_LEV_AR_NR='0631001000' and 8 SRT_REK=2 and 9 F123_BKJR>=0000 and 10 F123_BKJR<=2011 and 11 F123_FIRMA=2; Explained. Elapsed: 00:00:00.10 SQL> SQL> select * from table(dbms_xplan.display); PLAN_TABLE_OUTPUT ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Plan hash value: 3488495774 ------------------------------------------------------------------------------------------------- | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time | ------------------------------------------------------------------------------------------------- | 0 | SELECT STATEMENT | | 1 | 38 | 1792 (1)| 00:00:22 | | 1 | SORT AGGREGATE | | 1 | 38 | | | |* 2 | TABLE ACCESS BY INDEX ROWID| BH123GH | 5059 | 187K| 1792 (1)| 00:00:22 | |* 3 | INDEX RANGE SCAN | I_BH123GH_ISABEL | 5059 | | 145 (0)| 00:00:02 | ------------------------------------------------------------------------------------------------- Predicate Information (identified by operation id): --------------------------------------------------- 2 - filter("F123_BKJR">=0000 AND "F123_BKJR"<=2011) 3 - access("F123_FIRMA"=2 AND "SRT_REK"=2 AND "F123_KL_LEV_AR_NR"='0631001000' AND "F123_AR_NR">='4400000000' AND "F123_AR_NR"<='4404000000') filter("F123_AR_NR"<='4404000000' AND "F123_AR_NR">='4400000000') 18 rows selected. Elapsed: 00:00:00.20 SQL> SQL> rollback; Rollback complete. Elapsed: 00:00:00.01 SQL> SQL> rem Set the ARRAYSIZE according to your application SQL> set autotrace traceonly arraysize 100 SQL> SQL> alter session set tracefile_identifier = 'mytrace1'; Session altered. Elapsed: 00:00:00.01 SQL> SQL> rem if you're using bind variables SQL> rem define them here SQL> SQL> rem variable b_var1 number SQL> rem variable b_var2 varchar2(20) SQL> SQL> rem and initialize them SQL> SQL> rem exec :b_var1 := 1 SQL> rem exec :b_var2 := 'DIAG' SQL> SQL> alter session set events '10046 trace name context forever, level 8'; Session altered. Elapsed: 00:00:00.03 SQL> SQL> -- put your statement here SQL> Select nvl(sum(BM_OPENST_D - BM_OPENST_CR),0) 2 from bh.bh123gh 3 where 4 F123_AR_NR>='4400000000' and 5 F123_AR_NR<='4404000000' and 6 F123_KL_LEV_AR_NR='0631001000' and 7 SRT_REK=2 and 8 F123_BKJR>=0000 and 9 F123_BKJR<=2011 and 10 F123_FIRMA=2; Elapsed: 00:00:09.92 Execution Plan ---------------------------------------------------------- Plan hash value: 3488495774 ------------------------------------------------------------------------------------------------- | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time | ------------------------------------------------------------------------------------------------- | 0 | SELECT STATEMENT | | 1 | 38 | 1792 (1)| 00:00:22 | | 1 | SORT AGGREGATE | | 1 | 38 | | | |* 2 | TABLE ACCESS BY INDEX ROWID| BH123GH | 5059 | 187K| 1792 (1)| 00:00:22 | |* 3 | INDEX RANGE SCAN | I_BH123GH_ISABEL | 5059 | | 145 (0)| 00:00:02 | ------------------------------------------------------------------------------------------------- Predicate Information (identified by operation id): --------------------------------------------------- 2 - filter("F123_BKJR">=0000 AND "F123_BKJR"<=2011) 3 - access("F123_FIRMA"=2 AND "SRT_REK"=2 AND "F123_KL_LEV_AR_NR"='0631001000' AND "F123_AR_NR">='4400000000' AND "F123_AR_NR"<='4404000000') filter("F123_AR_NR"<='4404000000' AND "F123_AR_NR">='4400000000') Statistics ---------------------------------------------------------- 1 recursive calls 0 db block gets 11104 consistent gets 9434 physical reads 0 redo size 574 bytes sent via SQL*Net to client 519 bytes received via SQL*Net from client 2 SQL*Net roundtrips to/from client 0 sorts (memory) 0 sorts (disk) 1 rows processed SQL> SQL> disconnect Disconnected from Oracle Database 11g Release 11.2.0.1.0 - 64bit Production SQL> SQL> spool off
DBMS_XPLAN. Output DISPLAY_CURSOR:TKPROF: Release 11.2.0.1.0 - Development on Tue Nov 22 13:58:33 2011 Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved. Trace file: C:\Oracle\diag\rdbms\oravopak\oravopak\trace\oravopak_ora_7352_mytrace1.trc Sort options: default ******************************************************************************** count = number of times OCI procedure was executed cpu = cpu time in seconds executing elapsed = elapsed time in seconds executing disk = number of physical reads of buffers from disk query = number of buffers gotten for consistent read current = number of buffers gotten in current mode (usually for update) rows = number of rows processed by the fetch or execute call ******************************************************************************** Select nvl(sum(BM_OPENST_D - BM_OPENST_CR),0) from bh.bh123gh where F123_AR_NR>='4400000000' and F123_AR_NR<='4404000000' and F123_KL_LEV_AR_NR='0631001000' and SRT_REK=2 and F123_BKJR>=0000 and F123_BKJR<=2011 and F123_FIRMA=2 call count cpu elapsed disk query current rows ------- ------ -------- ---------- ---------- ---------- ---------- ---------- Parse 1 0.01 0.00 0 0 0 0 Execute 1 0.00 0.00 0 0 0 0 Fetch 2 0.03 9.86 9434 11104 0 1 ------- ------ -------- ---------- ---------- ---------- ---------- ---------- total 4 0.04 9.87 9434 11104 0 1 Misses in library cache during parse: 1 Optimizer mode: ALL_ROWS Parsing user id: SYS Rows Row Source Operation ------- --------------------------------------------------- 1 SORT AGGREGATE (cr=11104 pr=9434 pw=0 time=0 us) 67250 TABLE ACCESS BY INDEX ROWID BH123GH (cr=11104 pr=9434 pw=0 time=10500177 us cost=1792 size=192242 card=5059) 67250 INDEX RANGE SCAN I_BH123GH_ISABEL (cr=526 pr=550 pw=0 time=44363 us cost=145 size=0 card=5059)(object id 75061) 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 1 0.00 0.00 db file sequential read 8893 0.10 9.26 db file scattered read 7 0.01 0.05 db file parallel read 1 0.02 0.02 SQL*Net message from client 2 0.00 0.00 ********************************************************************************
SQL> SQL> select * from table(dbms_xplan.display_cursor(null, null, 'ALLSTATS LAST')); PLAN_TABLE_OUTPUT ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- SQL_ID g6pkv639sdfgw, child number 0 ------------------------------------- Select /*+ gather_plan_statistics */ nvl(sum(BM_OPENST_DEB - BM_OPENST_CR),0) from bh.bh123gh where F123_AR_NR>='4400000000' and F123_AR_NR<='4404000000' and F123_KL_LEV_AR_NR='0631001000' and SRT_REK=2 and F123_BKJR>=0000 and F123_BKJR<=2011 and F123_FIRMA=2 Plan hash value: 3488495774 -------------------------------------------------------------------------------------------------------------------- | Id | Operation | Name | Starts | E-Rows | A-Rows | A-Time | Buffers | Reads | -------------------------------------------------------------------------------------------------------------------- | 0 | SELECT STATEMENT | | 1 | | 1 |00:00:08.07 | 11104 | 13531 | | 1 | SORT AGGREGATE | | 1 | 1 | 1 |00:00:08.07 | 11104 | 13531 | |* 2 | TABLE ACCESS BY INDEX ROWID| BH123GH | 1 | 5059 | 67250 |00:00:10.90 | 11104 | 13531 | |* 3 | INDEX RANGE SCAN | I_BH123GH_ISABEL | 1 | 5059 | 67250 |00:00:00.05 | 526 | 550 | -------------------------------------------------------------------------------------------------------------------- Predicate Information (identified by operation id): --------------------------------------------------- 2 - filter(("F123_BKJR">=0 AND "F123_BKJR"<=2011)) 3 - access("F123_FIRMA"=2 AND "SRT_REK"=2 AND "F123_KL_LEV_AR_NR"='0631001000' AND "F123_AR_NR">='4400000000' AND "F123_AR_NR"<='4404000000') filter(("F123_AR_NR"<='4404000000' AND "F123_AR_NR">='4400000000')) 27 rows selected. Elapsed: 00:00:01.15 SQL> SQL> spool off
Addition to other boards who has been submitted, a few more suggestions:
* It seems that your DB_FILE_MULTIBLOCK_READ_COUNT parameter has been manually set to a value of 6 (or you have the SESSIONS parameter set to a high value with a small CMS). As a general rule, this should only be set under Oracle database 10.2 and higher. See:
http://jonathanlewis.WordPress.com/2007/05/20/system-stats-strategy/* You have statistics of the noworkload system - it will not necessarily change things for the better for this SQL query special, but you might consider to collect statistics of the workload when the system is covered by a typical to high load. See:
http://hoopercharles.WordPress.com/2011/05/04/how-to-collect-statistics/* As Toon mentioned, single block reads dominate the running time. On average, they are quick to 0.001 seconds (1 ms), but many of them are. What is the buffer cache?
* The SQL statement uses the predicates like this WHERE clause: "F123_AR_NR > = ' F123_AR_NR «»<=", which="" i="" believe="" would="" be="" treated="" differently="" in="" cardinality="" calculations="" (2="" unbounded="" ranges)when="" compared="" to="" a="" where="" clause="" that="" uses="" between="" syntax="" (a="" single="" bounded="" range).="" the="" query="" optimizer="" will="" actually="" transform="" the="" between="" syntax="" into="" two="" unbounded="" ranges,="" but="" if="" i="" remember="" correctly,="" it="" will="" remember="" that="" the="" ranges="" are="" bounded="" when="" performing="" the="" cardinality="">=",>
* The DBMS_XPLAN. DISPLAY_CURSOR output shows that the number of blocks read from disk is 13 531 but you get only 11 104 consistent. The number of physical blocks read must be generally less number of becomes coherent. If I remember correctly, the number of readings of physical blocks can be higher if index preloading takes place, or if the intermediate results must be written for the temp tablespace. In this case, it seems that the index preloading takes place.
* It seems that because this query has been run at least 3 times in succession fast, already read of the disk blocks should remain in the buffer cache. This suggests that the buffer cache is too small. Are the BH123GH table and its indexes defined to use the buffer pool KEEP or RECYCLE, yet these buffer pools are not defined?
Charles Hooper
http://hoopercharles.WordPress.com/
IT Manager/Oracle DBA
K & M-making Machine, Inc. -
libnipalu.so, failed to initialize
Greetings,
We have installed NI - VISA 15.0 on RHEL 7.2 (release attached). When our application running, the following error message appears and the program interrupted. Abandonment occurs when the first call to viOpenDefaultRM().
libnipalu.so, failed to initialize
Maybe you need to run updateNIDrivers
Quit (core dumped)
We ran updateNIDrivers (release attached), which does not seem to change the installed RPM packages (also attached to the command "rpm - qa |") ("grep ^ nor"). But the problem persisted. Previously we tried to uninstall/install with no luck. I looked around the forum and saw this message appear elsewhere, but without a solution to this particular problem. Any suggestions would be greatly appreciated.
Note: I work in a closed area and have to trace output as those attached files. If the output of niSystemReport would be useful, please let me know what I could grep for :-)
Additional info:
//--------------------------------------------
OS - RHEL 7.2, 4 GB RAM
//--------------------------------------------
> uname - r
3.10.0 - 327.EL7.x86_64
//--------------------------------------------------------------------------
Application - simple C++ program with dependencies
//--------------------------------------------------------------------------
Linux - gate.so.1-online (0xf76f7000)
-Online /lib/libnsl.so.1 (0xf76bb000) libnsl.so.1
libvisa.so-online /usr/local/lib/libvisa.so (0xf7672000)
libstdc ++. so.6-online /lib/libstdc++.so.6 (0xf7586000)
libm.so.6-online /lib/libm.so.6 (0xf7543000)
libgcc_s.so.1-online /lib/libgcc_s.so.1 (0xf7527000)
libc.so.6-online /lib/libc.so.6 (0xf736a000)
-Online /lib/libdl.so.2 (0xf7365000) libdl.so.2
-Online /lib/libpthread.so.0 (0xf734b000) libpthread.so.0
/lib/ld-linux.so.2 (0xf76f8000)Kemens thanks for the reply and pointing me to the form of discussion. A brief tutorial, using NI-VISA with Arch Linux (or Ubuntu 14.04), which breaks down some of the install steps and highlights of the things to look for is more useful to this Council.
The issue was the process OR native (nipple, nipxirmu, nisvcloc, etc.) do not bind to the boot. When the box is restarted, these processes are not running which causes the application to abort (during the first call of service VISA). Once they started, everything went well.
There is a workaround for this problem/solution hackaround. See the doc attached for instructions with an example for the nipxirmu.
Maybe you are looking for
-
Hello, following code in Internet explorer, Google Chrome and old Firefox open a new window, but in the new Firefox open a new tab, how can I solve this problem? Thank you. < an onclick = "o = window.open; o" ('test.html ', 'popup',' width is 800, he
-
No matter who else I wondered about this? Someone else with w/32-bit XP, downloaded the new update Java in plugins and you're running OK? I want to update my Java plugin, but wait and see if others with XP, 32 bit have updated and how it works for th
-
I'm writing a program in labview using USB 6211 as my Daq card to achieve the following objectives: I need a constant voltage DC 5 V output if my input voltage is lower than 3. Exit - 5 if my contribution is greater than 7. even out as before if an e
-
How long is the deleted file hotmail?
Hello, I want to know how long the hotmail file is removed from the network. justicestats
-
Vista Basic - Windows error recovery
My friend bought a Toshiba Satellite L305 S5931 at a Best Buy in California, which didn't come with the installation program, startup or recovery disks. Last week his system froze, he forced closed by holding the power button. When it rebooted the l