Tuning of the Query
Hi, can anyone help me to tune the below Query. Or can this Query be re written in simpler way.
OPEN OCUR_APPOINTMENT FOR
SELECT DISTINCT AP.APPOINTMENTID,
PKG_UTILITYFUNCTIONS.F_GETESSTATUSNAME(AP.STATUSCHECK) APPSTATUS,
AP.STARTDATETIME APPOINTMENT_DATE,
(CASE PM.BILLINGTYPEID
WHEN 1 THEN
'Cash'
WHEN 2 THEN
'Credit'
END) BILLINGSTATUS,
(CASE AP.BOOKING_TYPE
WHEN 0 THEN
'Walkin'
WHEN 1 THEN
'Schedule'
END) BOOKINGTYPE,
AP.RESOURCEID,
AP.REGISTRATIONTYPE,
AP.REGISTRATIONNUMBER,
AP.PATIENTNAME,
AP.CONTACTNUMBER,
(SELECT COA.LEVELDETAILNAME
FROM EHIS.COA_STRUCT_DETAILS COA
WHERE COA.CHARTID = AP.LOCATIONID
AND ROWNUM = 1) AS LOCATIONNAME,
TM.TITLETYPE || EMD.FIRSTNAME || EMD.LASTNAME DOCTOR_NAME,
EMD.EMPLOYEEID,
(SELECT DIO.REASON
FROM PR_T_DOCTORINANDOUT DIO
WHERE DIO.DOCTORNAMEID = EMD.EMPLOYEEID
AND TRUNC(SYSDATE) BETWEEN TRUNC(DIO.STARTDATE) AND
TRUNC(DIO.ENDDATE)
AND DIO.STATUS = 1) DRCOMMENTS,
(SELECT S.STATUSNAME
FROM ES.ES_STATUS S
WHERE S.STATUSID = AP.STATUSCHECK
AND S.STATUS = 1) ES_STATUS,
AP.SERVICENAME,
(PKG_UTILITYFUNCTIONS.F_GETSPECIALITY_DOCID(AP.RESOURCEID)) DOCSPECIALITY,
(PKG_UTILITYFUNCTIONS.F_GETLOVDETAILVALUE(PKG_UTILITYFUNCTIONS.F_GETCALLSTATUS(PKG_UTILITYFUNCTIONS.
F_GETLATESTAPPOINTMENT(T.APPOINTMENTSTATUS)))) CALLSTATUS,
AP.STATUSCHECK,
(PKG_UTILITYFUNCTIONS.F_GETPREFERREDDATE(T.APPOINTMENTSTATUS)) PREFERREDDATE
FROM ES.ES_APPOINTMENTS AP
LEFT OUTER JOIN BILLING.PATIENTPOLICYMASTER PM
ON AP.REGISTRATIONNUMBER = PM.REGISTRATIONNO
JOIN HR.EMPLOYEE_MAIN_DETAILS EMD
ON EMD.EMPLOYEEID = AP.RESOURCEID
JOIN EHIS.TITLEMASTER TM
ON TM.TITLEID = EMD.TITLEID
LEFT OUTER JOIN PR_T_APPOINTMENTFOLLOWUP T
ON T.APPOINTMENTSTATUS = TO_CHAR(AP.APPOINTMENTID)
WHERE AP.SITEID = 1
AND AP.STATUSCHECK != 235
AND (AP.LOCATIONID = IN_LOCATIONID OR AP.LOCATIONID IS NULL)
AND (TRUNC(AP.STARTDATETIME) = IN_APPOINTMENTDATE OR
TRUNC(AP.STARTDATETIME) IS NULL)
AND (IN_STATUS IS NULL OR T.CALLSTATUS = IN_STATUS)
AND (IN_DCOTORID IS NULL OR T.DOCTORID = IN_DCOTORID)
AND (T.CALLSTATUS IS NULL OR T.CALLSTATUS != V_CALLSTATUS);
END P_GETAPPOINTMENTS;Thanks in advance.
Edited by: BluShadow on 11-Feb-2013 09:27
added {noformat}{noformat} tags to format the code. Read: {message:id=9360002} to learn how to do this.
979892 wrote:
Hi,
I don undrstand whats wrong in my Question. The answer for each n evry post by me is the same. This forum is not meant for giving suggestion I guess. or atleast I stop posting my Queries in this forum. Till now I have posted around 10 and Hardly for 1 or 2 I got the answers..The rest of them are the same bloody suggestions instead of answers.
So, better if I google instead of wasting my time in posting and waiting for this nonsense answers.Such a nice reply to someone who was trying to help you. It seems though that you're incapable of reading.
You said you had a problem formatting your code on the forum and Karthick pointed you to the FAQ: {message:id=9360002} which details how you make code appear formatted on the forums, yet you choose to ignore that and say that Karthick's response is just another 'bloody suggestion' (so polite and professional of you).
Karthick also pointed you to the FAQ: {message:id=9360003} which links to a couple of very informative threads detailing what information you will need to provide so that people can help you to tune your query, as just posting a query itself is not enough for people to help you. Again you choose to ignore that advice.
You say you've posted around 10 questions and only really got answers for 1 or 2 of them... is that the fault of the experts trying to help you, or the fault of the poor way the question has been asked?
People, many of them very good experts in Oracle, volunteer their own time here to help people with their questions, and typically, if the person has posted good information about what their issue is then the experts will certainly be able to offer the best advice and way forward to help that person. In some cases though people don't post enough information and expect the volunteers to be mind readers or guess what the issue actually is... and then those people claim that they're not getting any good help...
So, all you have to do is ask your question properly. It's not difficult. Either that or you can go away and google for help elsewhere, and perhaps pick up some of the old, outdated or bad advice that's out there on the web, and not learn from the experts. It's your choice, and not a concern of the experts here. We only try and help where we can.
Similar Messages
-
Need Help in tuning of the query
Hi all,
Can any body help me how we can rewrite this query in
optimized way.
SELECT A.C1 AS COLUMN_1, B.C2 AS COLUMN_2
FROM A,B
WHERE A.C1 IN (
SELECT COLUMN_1 FROM(
(SELECT A.C1 AS COLUMN_1,
COUNT(C1) AS COUNT,
RANK() OVER (ORDER BY COUNT(C1) DESC) AS RANK
FROM A, B, C
WHERE A.C1 = B.C3
AND B.C2 = C.C1
AND <other conditions>
GROUP BY A.C1)
WHERE RANK <= 10)
AND A.C1 = B.C3
AND <other conditions>
ORDER BY A.C1
I am using <other conditions> are same in outer query and inner query also.
Thanks in Advance,Hi,
Yes exactly I am looking TOP-10 results the query is like this
SELECT A.C1 AS COLUMN_1, B.C2 AS COLUMN_2
FROM A,B
WHERE B.C2 IN (
SELECT COLUMN_1 FROM(
(SELECT B.C2 AS COLUMN_1,
COUNT(A.C1) AS COUNT,
RANK() OVER (ORDER BY COUNT(C1) DESC) AS RANK
FROM A, B, C
WHERE A.C1 = B.C3
AND B.C2 = C.C1
AND <other conditions>
GROUP BY B.C2)
WHERE RANK <= 10)
AND A.C1 = B.C3
AND <other conditions>
ORDER BY B.C2
Thanks -
Performance tuning for the query
CURSOR c_exercise_list IS
SELECT
DECODE(v_mfd_mask_id ,'Y',' ',o.opt_id) opt_id,
DECODE(v_mfd_mask_id ,'Y',' ',o.soc_sec) soc_sec,
P.plan_id plan_id, E.exer_id exer_id, E.exer_num,
DECODE(G.sar_flag, 0, DECODE(G.plan_type, 0, '1', 1, '2', 2, '3', 3, ' ', 4,'5', 5, '6', 6, '7', 7, '8', 8, '9', '0'), ' ') option_type,
TO_CHAR(G.grant_dt, 'YYYYMMDD') grant_dt, TO_CHAR(E.exer_dt, 'YYYYMMDD') exer_dt,
E.opts_exer opts_exer,
E.mkt_prc mkt_prc,
E.swap_prc swap_prc,
E.shrs_swap shrs_swap, decode(e.exer_type,2,decode(xe.cash_partial,'Y','A','2'),TO_CHAR(E.exer_type)) exer_type,
E.sar_shrs sar_shrs,
NVL(ROUND(((xe.sar_shrs_withld_optcost - (e.opts_exer * g.opt_prc) / e.mkt_prc) * e.mkt_prc),2),0)+e.sar_cash sar_cash,
NVL(f.fixed_fee1,0) fixed_fee1,
NVL(f.fixed_fee2,0) fixed_fee2,
NVL(f.fixed_fee3,0) fixed_fee3,
NVL(f.commission,0) commission,
NVL(f.sec_fee,0) sec_fee,
NVL(f.fees_paid,0) fees_paid,
NVL(ct.amount,0) cash_tend,
E.shrs_tend shrs_tend, G.grant_id grant_id, NVL(G.grant_cd, ' ') grant_cd,
NVL(xg.child_symbol,' ') child_symbol,
NVL(xg.opt_gain_deferred_flag,'N') defer_flag,
o.opt_num opt_num,
--XO.new_ssn,
DECODE(v_mfd_mask_id ,'Y',' ',xo.new_ssn) new_ssn,
xo.use_new_ssn
,xo.tax_verification_eligible tax_verification_eligible
,(SELECT TO_CHAR(MIN(settle_dt),'YYYYMMDD') FROM tb_ml_exer_upload WHERE exer_num = E.exer_num AND user_id=E.user_id AND NVL(settle_dt,TO_DATE('19000101','YYYYMMDD'))>=E.exer_dt) AS settle_dt
,xe.rsu_type AS rsu_type
,xe.trfbl_det_name AS trfbl_det_name
,o.user_txt1,o.user_txt2,xo.user_txt3,xo.user_txt4,xo.user_txt5,xo.user_txt6,xo.user_txt7
,xo.user_txt8,xo.user_txt9,xo.user_txt10,xo.user_txt11,
xo.user_txt12,
xo.user_txt13,
xo.user_txt14,
xo.user_txt15,
xo.user_txt16,
xo.user_txt17,
xo.user_txt18,
xo.user_txt19,
xo.user_txt20,
xo.user_txt21,
xo.user_txt22,
xo.user_txt23,
xo.user_dt2,
xo.adj_dt_hire_vt_svc,
xo.adj_dt_hire_vt_svc_or,
xo.adj_dt_hire_vt_svc_or_dt,
xo.severance_plan_code,
xo.severance_begin_dt,
xo.severance_end_dt,
xo.retirement_bridging_dt
,NVL(xg.pu_var_price ,0) v_pu_var_price
,NVL(xe.ficamed_override,'N') v_ficmd_ovrride
,NVL(xe.vest_shrs,0) v_vest_shrs
,NVL(xe.client_exer_id,' ') v_client_exer_id
,(CASE WHEN xg.re_tax_flag = 'Y' THEN pk_xop_reg_outbound.Fn_GetRETaxesWithheld(g.grant_num, E.exer_num, g.plan_type)
ELSE 'N'
END) re_tax_indicator -- 1.5V
,xe.je_bypass_flag
,xe.sar_shrs_withld_taxes --Added for SAR july 2010 release
,xe.sar_shrs_withld_optcost --Added for SAR july 2010 release
FROM
(SELECT exer.* FROM exercise exer WHERE NOT EXISTS (SELECT s.exer_num FROM suspense s
WHERE s.exer_num = exer.exer_num AND s.user_id = exer.user_id AND exer.mkt_prc = 0))E,
grantz G, xop_grantz xg, optionee o, xop_optionee xo, feeschgd f, cashtendered ct, planz P,xop_exercise xe
WHERE
E.grant_num = G.grant_num
AND E.user_id = G.user_id
AND E.opt_num = o.opt_num
AND E.user_id = o.user_id
AND (G.grant_num = xg.grant_num(+) AND G.user_id=xg.user_id(+))
AND (o.opt_num = xo.opt_num(+) AND o.user_id=xo.user_id(+))
AND E.plan_num = P.plan_num
AND E.user_id = P.user_id
AND E.exer_num = f.exer_num(+)
AND E.user_id = ct.user_id(+)
AND E.exer_num = ct.exer_num(+)
AND E.user_id = ct.user_id(+)
AND E.exer_num=xe.exer_num(+)
AND E.user_id=xe.user_id(+)
AND G.user_id = USER
AND NOT EXISTS (
SELECT tv.exer_num
FROM tb_xop_tax_verification tv--,exercise ex
WHERE tv.exer_num = e.exer_num
AND tv.user_id = e.user_id
AND tv.user_id = v_cms_user
AND tv.status_flag IN (0,1,3,4, 5)) -- Not Processed
;how to tune the query to impropve the performance, any1 help me ..thanks in advance
Edited by: BluShadow on 21-Feb-2013 08:14
corrected {noformat}{noformat} tags. Please read {message:id=9360002} and learn how to post code correctly.i got CPU cost: 458.50 Elapsed time: 1542.90 so anything can tune to improve the performance, but there is no full table scan applied for none of the mentioned table. . and most of the columns are unique index scan takes place.. anybody can help me to find the solution
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bi
PL/SQL Release 10.2.0.4.0 - Production
CORE 10.2.0.4.0 Production
TNS for Solaris: Version 10.2.0.4.0 - Production
NLSRTL Version 10.2.0.4.0 - Production
Edited by: 956684 on Feb 22, 2013 4:09 AM -
Query is Very Slow but after using sql tuning advisor the Query is fine
Currently we have Query which takes ages to retrieve small data set of 30 seconds.So i used the sql advisor and applied the profile now the same query comes in msec.This was tested on Test enviorement.
Metadata for Table: TIBEX_PARTICIPANT
CREATE TABLE "TST_PRE_EOD"."TIBEX_PARTICIPANT"
( "PARTICIPANTID" VARCHAR2(25) NOT NULL ENABLE,
"PARTICIPANTTYPE" NUMBER(4,0),
"PARTICIPANTSUBTYPE" VARCHAR2(5),
"PARTICIPANTSTATUS" NUMBER(4,0),
"PARTICIPANTNAMESHORT" VARCHAR2(15),
"PARTICIPANTNAME" VARCHAR2(60),
"ROOTPARTICIPANTID" VARCHAR2(25),
"PARENTPARTICIPANTID" VARCHAR2(25),
"SFAREPORTING" CHAR(1),
"ADDRESSOFFICENAME" VARCHAR2(30),
"ADDRESSLINE1" VARCHAR2(60),
"ADDRESSLINE2" VARCHAR2(40),
"ADDRESSLINE3" VARCHAR2(50),
"ADDRESSLINE4" VARCHAR2(50),
"ADDRESSCOUNTRY" VARCHAR2(50),
"WEBURL" VARCHAR2(100),
"PHONENO" VARCHAR2(20),
"FAXNO" VARCHAR2(20),
"CONTACTNAME" VARCHAR2(50),
"CONTACTTITLE" VARCHAR2(30),
"CONTACTEMAIL" VARCHAR2(35),
"CURRENTOPENVAL" FLOAT(126) NOT NULL ENABLE,
"OPENVALLIMIT" FLOAT(126) NOT NULL ENABLE,
"TIMESTAMP" NUMBER(20,0) NOT NULL ENABLE,
"ORDERVALLIMIT" FLOAT(126) NOT NULL ENABLE,
"NOTE" VARCHAR2(50),
"PARTICIPANTINDEX" NUMBER(4,0),
"AUTOROUTETOCLEARING" CHAR(1),
"CREDITID" VARCHAR2(25),
"ISCPTRDDETAILS" CHAR(1) NOT NULL ENABLE,
"PRIMARY_BIC" VARCHAR2(11),
"QSID" VARCHAR2(10) NOT NULL ENABLE,
"INTERNALISEDTRADES" CHAR(1) NOT NULL ENABLE,
CONSTRAINT "XPKTIBEX_PARTICIPANT" PRIMARY KEY ("PARTICIPANTID")
USING INDEX 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 "TST_PRE_EOD" ENABLE
) PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
TABLESPACE "TST_PRE_EOD" ;
Back to Metadata
Back to Top
Metadata for Table: TIBEX_QUOTE
CREATE TABLE "TST_PRE_EOD"."TIBEX_QUOTE"
( "QUOTEID" CHAR(20) NOT NULL ENABLE,
"USERORDERID" VARCHAR2(25),
"QUOTESTATUS" NUMBER(4,0) NOT NULL ENABLE,
"INDICATIVE" CHAR(1),
"BOARDID" VARCHAR2(10),
"INSTRUMENTID" VARCHAR2(50) NOT NULL ENABLE,
"SELLPRICE" FLOAT(126),
"SELLQTY" NUMBER(10,0),
"BUYPRICE" FLOAT(126),
"BUYQTY" NUMBER(10,0),
"PARTICIPANTID" VARCHAR2(25),
"ACCOUNTNO" VARCHAR2(50),
"LASTINSTRESULT" VARCHAR2(50),
"LASTINSTMESSAGESEQUENCE" NUMBER(20,0) NOT NULL ENABLE,
"BUYQUOTEMINSIZE" NUMBER(10,0),
"LASTEXECUTIONID" CHAR(20),
"SELLQUOTEMINSIZE" NUMBER(10,0),
"TICKMOVECOUNT" NUMBER(10,0),
"TIMESTAMP" NUMBER(20,0) NOT NULL ENABLE,
"SELLQTYFILLED" NUMBER(10,0),
"BUYQTYFILLED" NUMBER(10,0),
"MEID" VARCHAR2(10) NOT NULL ENABLE,
"LASTINSTREJECTCODE" VARCHAR2(10),
"LASTEXECPRICE" FLOAT(126),
"LASTEXECQTY" NUMBER(10,0),
"LASTEXECSIDE" NUMBER(4,0),
"LASTINSTTYPE" NUMBER(4,0),
"LASTEXECUTIONCOUNTERPARTY" VARCHAR2(25),
"BIDTIMESTAMP" NUMBER(20,0),
"OFFERTIMESTAMP" NUMBER(20,0),
"LASTEXECCLEARINGAGENCY" VARCHAR2(11),
"LASTEXECACCOUNTNO" VARCHAR2(50),
"LASTEXECCPCLEARINGAGENCY" VARCHAR2(11),
"LASTEXECBOARDID" VARCHAR2(10),
"MESSAGESEQUENCE" NUMBER(20,0) NOT NULL ENABLE,
"LASTINSTUSERALIAS" CHAR(4) NOT NULL ENABLE,
"PARTNEREXID" CHAR(20),
"LASTSETTLEMENTCYCLE" NUMBER(4,0),
"LASTEXECPOSTTRADEVENUETYPE" NUMBER(4,0),
"PRICELEVELPOSITION" NUMBER(4,0),
"MATCHTYPE" NUMBER(4,0),
"LASTEXECUTIONROLE" VARCHAR2(4),
"REFERENCEID" VARCHAR2(25),
"BUYMDENTRYID" VARCHAR2(13),
"SELLMDENTRYID" VARCHAR2(13),
"HALTREASON" NUMBER(4,0),
"LASTINSTFIXSEQUENCE" NUMBER(20,0)
) PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
TABLESPACE "TST_PRE_EOD" ;
Back to Metadata
Back to Top
Metadata for Table: TIBEX_QUOTESTATUSENUM
CREATE TABLE "TST_PRE_EOD"."TIBEX_QUOTESTATUSENUM"
( "QUOTESTATUS" NUMBER(4,0) NOT NULL ENABLE,
"SHORTDESC" VARCHAR2(32) NOT NULL ENABLE,
"DESCRIPTION" VARCHAR2(50),
CONSTRAINT "XPKTIBEX_QUOTESTATUSENUM" PRIMARY KEY ("QUOTESTATUS")
USING INDEX 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 "TST_PRE_EOD" ENABLE
) PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
TABLESPACE "TST_PRE_EOD" ;
Back to Metadata
Back to Top
Metadata for Index: IX_QUOTEBOOK
CREATE INDEX "TST_PRE_EOD"."IX_QUOTEBOOK" ON "TST_PRE_EOD"."TIBEX_QUOTE" ("QUOTEID", "MESSAGESEQUENCE", "QUOTESTATUS")
PCTFREE 10 INITRANS 2 MAXTRANS 255 NOLOGGING COMPUTE STATISTICS
STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
TABLESPACE "TST_PRE_EOD" ;
Back to Metadata
Back to Top
Metadata for Index: IX_QUOTE_TIMESTAMP
CREATE INDEX "TST_PRE_EOD"."IX_QUOTE_TIMESTAMP" ON "TST_PRE_EOD"."TIBEX_QUOTE" ("TIMESTAMP")
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 "TST_PRE_EOD" ;
Back to Metadata
Back to Top
Metadata for Index: TIBEX_PARTICIPANTQSID
CREATE INDEX "TST_PRE_EOD"."TIBEX_PARTICIPANTQSID" ON "TST_PRE_EOD"."TIBEX_PARTICIPANT" ("QSID")
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 "TST_PRE_EOD" ;
Back to Metadata
Back to Top
Metadata for Index: TIBEX_QUOTE_IDX_QLT
CREATE INDEX "TST_PRE_EOD"."TIBEX_QUOTE_IDX_QLT" ON "TST_PRE_EOD"."TIBEX_QUOTE" ("LASTINSTUSERALIAS", "TIMESTAMP")
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 "TST_PRE_EOD" ;
Back to Metadata
Back to Top
Metadata for Index: XPKTIBEX_PARTICIPANT
CREATE UNIQUE INDEX "TST_PRE_EOD"."XPKTIBEX_PARTICIPANT" ON "TST_PRE_EOD"."TIBEX_PARTICIPANT" ("PARTICIPANTID")
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 "TST_PRE_EOD" ;
Back to Metadata
Back to Top
Metadata for Index: XPKTIBEX_QUOTESTATUSENUM
CREATE UNIQUE INDEX "TST_PRE_EOD"."XPKTIBEX_QUOTESTATUSENUM" ON "TST_PRE_EOD"."TIBEX_QUOTESTATUSENUM" ("QUOTESTATUS")
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 "TST_PRE_EOD" ;
Back to Metadata
Back to Top
Metadata for View: TIBEX_QUOTESBYQSIDVIEW
CREATE OR REPLACE FORCE VIEW "TST_PRE_EOD"."TIBEX_QUOTESBYQSIDVIEW" ("QUOTEID", "USERORDERID", "QUOTESTATUS", "INDICATIVE", "BOARDID", "INSTRUMENTID", "SELLPRICE", "SELLQTY", "BUYPRICE", "BUYQTY", "PARTICIPANTID", "ACCOUNTNO", "LASTINSTRESULT", "LASTINSTMESSAGESEQUENCE", "BUYQUOTEMINSIZE", "LASTEXECUTIONID", "SELLQUOTEMINSIZE", "TICKMOVECOUNT", "TIMESTAMP", "SELLQTYFILLED", "BUYQTYFILLED", "MEID", "LASTINSTREJECTCODE", "LASTEXECPRICE", "LASTEXECQTY", "LASTEXECSIDE", "LASTINSTTYPE", "LASTEXECUTIONCOUNTERPARTY", "BIDTIMESTAMP", "OFFERTIMESTAMP", "LASTEXECCLEARINGAGENCY", "LASTEXECACCOUNTNO", "LASTEXECCPCLEARINGAGENCY", "LASTEXECBOARDID", "MESSAGESEQUENCE", "LASTINSTUSERALIAS", "PARTNEREXID", "LASTSETTLEMENTCYCLE", "LASTEXECPOSTTRADEVENUETYPE", "PRICELEVELPOSITION", "MATCHTYPE", "LASTEXECUTIONROLE", "REFERENCEID", "BUYMDENTRYID", "SELLMDENTRYID", "HALTREASON", "LASTINSTFIXSEQUENCE", "QSID") AS
SELECT a.QUOTEID, a.USERORDERID, a.QUOTESTATUS, a.INDICATIVE, a.BOARDID,
a.INSTRUMENTID, a.SELLPRICE, a.SELLQTY, a.BUYPRICE, a.BUYQTY,
a.PARTICIPANTID, a.ACCOUNTNO, a.LASTINSTRESULT,
a.LASTINSTMESSAGESEQUENCE, a.BUYQUOTEMINSIZE, a.LASTEXECUTIONID,
a.SELLQUOTEMINSIZE, a.TICKMOVECOUNT, a.TIMESTAMP,
a.SELLQTYFILLED, a.BUYQTYFILLED, a.MEID, a.LASTINSTREJECTCODE,
a.LASTEXECPRICE, a.LASTEXECQTY, a.LASTEXECSIDE, a.LASTINSTTYPE,
a.LASTEXECUTIONCOUNTERPARTY, a.BIDTIMESTAMP, a.OFFERTIMESTAMP,
a.LASTEXECCLEARINGAGENCY, a.LASTEXECACCOUNTNO,
a.LASTEXECCPCLEARINGAGENCY, a.LASTEXECBOARDID,
a.MESSAGESEQUENCE, a.LASTINSTUSERALIAS, a.PARTNEREXID,
a.LASTSETTLEMENTCYCLE, a.LASTEXECPOSTTRADEVENUETYPE,
a.PRICELEVELPOSITION, a.MATCHTYPE, a.LASTEXECUTIONROLE,
a.referenceID, a.BuyMDEntryID, a.SellMDEntryID, a.haltReason,
a.lastInstFixSequence, b.QSID
FROM tibex_quote A,
tibex_Participant b
WHERE a.participantID = b.participantID
AND (A.MessageSequence, A.QuoteID) IN (
SELECT max(C.MessageSequence), C.quoteID
FROM tibex_quote C
WHERE LastInstRejectCode = 'OK'
GROUP By C.QuoteID
AND a.QuoteStatus IN (
SELECT QuoteStatus
FROM tibex_quoteStatusEnum
WHERE ShortDesc IN (
'QUO_ONMKT', 'QUO_OFFMKT', 'QUO_PREOPN'
);Tkprof in Next postTkprof Details
TKPROF: Release 10.2.0.4.0 - Production on Thu Jan 28 14:38:44 2010
Copyright (c) 1982, 2007, Oracle. All rights reserved.
Trace file: mifex3_ora_2598_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
BEGIN DBMS_OUTPUT.GET_LINES(:LINES, :NUMLINES); END;
call count cpu elapsed disk query current rows
Parse 2 0.00 0.00 0 0 0 0
Execute 2 0.00 0.00 0 0 0 2
Fetch 0 0.00 0.00 0 0 0 0
total 4 0.00 0.00 0 0 0 2
Misses in library cache during parse: 0
Optimizer mode: ALL_ROWS
Parsing user id: 163
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
select text
from
view$ where rowid=:1
call count cpu elapsed disk query current rows
Parse 2 0.00 0.00 0 0 0 0
Execute 2 0.00 0.02 0 0 0 0
Fetch 2 0.00 0.00 0 4 0 2
total 6 0.00 0.02 0 4 0 2
Misses in library cache during parse: 1
Misses in library cache during execute: 1
Optimizer mode: CHOOSE
Parsing user id: SYS (recursive depth: 1)
Rows Row Source Operation
1 TABLE ACCESS BY USER ROWID VIEW$ (cr=1 pr=0 pw=0 time=18 us)
SELECT quoteid, lastexecposttradevenuetype, lastexecqty, matchtype,
haltreason, buyquoteminsize, meid, lastinstuseralias, boardid,
userorderid, buymdentryid, indicative, lastinsttype, lastexecprice,
buyprice, partnerexid, lastinstresult, pricelevelposition,
lastinstrejectcode, TIMESTAMP, buyqtyfilled, referenceid,
lastexecboardid, bidtimestamp, tickmovecount, lastexecside,
offertimestamp, sellprice, participantid, lastexecutioncounterparty,
lastexecaccountno, sellmdentryid, accountno, buyqty, messagesequence,
lastexecutionid, lastexeccpclearingagency, sellqty,
lastexecclearingagency, sellquoteminsize, lastinstfixsequence,
quotestatus, lastinstmessagesequence, instrumentid, sellqtyfilled,
lastexecutionrole, lastsettlementcycle
FROM tibex_quotesbyqsidview
WHERE participantid = 'NITE'
call count cpu elapsed disk query current rows
Parse 1 0.01 0.02 0 0 0 0
Execute 1 0.00 0.00 0 0 0 0
Fetch 6 21.43 20.94 1125 2405864 0 468
total 8 21.44 20.97 1125 2405864 0 468
Misses in library cache during parse: 1
Optimizer mode: ALL_ROWS
Parsing user id: 163
Rows Row Source Operation
468 FILTER (cr=2405864 pr=1125 pw=1125 time=20927185 us)
24523 HASH GROUP BY (cr=2405864 pr=1125 pw=1125 time=21171165 us)
2994085 TABLE ACCESS BY INDEX ROWID TIBEX_QUOTE (cr=2405864 pr=0 pw=0 time=8983645 us)
3076661 NESTED LOOPS (cr=87651 pr=0 pw=0 time=3092729 us)
24523 HASH JOIN (cr=18276 pr=0 pw=0 time=173004 us)
3 NESTED LOOPS (cr=8 pr=0 pw=0 time=81 us)
1 INDEX UNIQUE SCAN XPKTIBEX_PARTICIPANT (cr=1 pr=0 pw=0 time=18 us)(object id 168573)
3 TABLE ACCESS FULL TIBEX_QUOTESTATUSENUM (cr=7 pr=0 pw=0 time=55 us)
24523 TABLE ACCESS FULL TIBEX_QUOTE (cr=18268 pr=0 pw=0 time=122762 us)
3052137 INDEX RANGE SCAN IX_QUOTEBOOK (cr=69375 pr=0 pw=0 time=195648 us)(object id 168590)
Elapsed times include waiting on following events:
Event waited on Times Max. Wait Total Waited
---------------------------------------- Waited ---------- ------------
SQL*Net message to client 6 0.00 0.00
SQL*Net more data to client 46 0.00 0.00
direct path write temp 75 0.00 0.04
SQL*Net message from client 6 0.00 0.00
direct path read temp 75 0.00 0.00
DELETE FROM PLAN_TABLE
WHERE
STATEMENT_ID=:1
call count cpu elapsed disk query current rows
Parse 2 0.00 0.00 0 0 0 0
Execute 2 0.00 0.04 0 9 16 11
Fetch 0 0.00 0.00 0 0 0 0
total 4 0.00 0.04 0 9 16 11
Misses in library cache during parse: 1
Misses in library cache during execute: 1
Optimizer mode: ALL_ROWS
Parsing user id: 163
Rows Row Source Operation
0 DELETE PLAN_TABLE$ (cr=4 pr=0 pw=0 time=33 us)
0 TABLE ACCESS FULL PLAN_TABLE$ (cr=4 pr=0 pw=0 time=30 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 0.01 0.02
SELECT /* OPT_DYN_SAMP */ /*+ ALL_ROWS IGNORE_WHERE_CLAUSE
NO_PARALLEL(SAMPLESUB) opt_param('parallel_execution_enabled', 'false')
NO_PARALLEL_INDEX(SAMPLESUB) NO_SQL_TUNE */ NVL(SUM(C1),0), NVL(SUM(C2),0)
FROM
(SELECT /*+ IGNORE_WHERE_CLAUSE NO_PARALLEL("PLAN_TABLE") FULL("PLAN_TABLE")
NO_PARALLEL_INDEX("PLAN_TABLE") */ 1 AS C1, CASE WHEN
"PLAN_TABLE"."STATEMENT_ID"=:B1 THEN 1 ELSE 0 END AS C2 FROM
"SYS"."PLAN_TABLE$" "PLAN_TABLE") SAMPLESUB
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 1 0.00 0.00 0 4 0 1
total 3 0.00 0.00 0 4 0 1
Misses in library cache during parse: 1
Misses in library cache during execute: 1
Optimizer mode: ALL_ROWS
Parsing user id: 163 (recursive depth: 1)
Rows Row Source Operation
1 SORT AGGREGATE (cr=4 pr=0 pw=0 time=56 us)
0 TABLE ACCESS FULL PLAN_TABLE$ (cr=4 pr=0 pw=0 time=43 us)
EXPLAIN PLAN SET STATEMENT_ID='PLUS8205116' FOR SELECT quoteid, lastexecposttradevenuetype, lastexecqty, matchtype,
haltreason, buyquoteminsize, meid, lastinstuseralias, boardid,
userorderid, buymdentryid, indicative, lastinsttype, lastexecprice,
buyprice, partnerexid, lastinstresult, pricelevelposition,
lastinstrejectcode, TIMESTAMP, buyqtyfilled, referenceid,
lastexecboardid, bidtimestamp, tickmovecount, lastexecside,
offertimestamp, sellprice, participantid, lastexecutioncounterparty,
lastexecaccountno, sellmdentryid, accountno, buyqty, messagesequence,
lastexecutionid, lastexeccpclearingagency, sellqty,
lastexecclearingagency, sellquoteminsize, lastinstfixsequence,
quotestatus, lastinstmessagesequence, instrumentid, sellqtyfilled,
lastexecutionrole, lastsettlementcycle
FROM tibex_quotesbyqsidview
WHERE participantid = 'NITE'
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 0 0.00 0.00 0 0 0 0
total 2 0.01 0.01 0 0 0 0
Misses in library cache during parse: 1
Optimizer mode: ALL_ROWS
Parsing user id: 163
Rows Row Source Operation
0 FILTER (cr=0 pr=0 pw=0 time=0 us)
0 HASH GROUP BY (cr=0 pr=0 pw=0 time=0 us)
0 TABLE ACCESS BY INDEX ROWID TIBEX_QUOTE (cr=0 pr=0 pw=0 time=0 us)
0 NESTED LOOPS (cr=0 pr=0 pw=0 time=0 us)
0 HASH JOIN (cr=0 pr=0 pw=0 time=0 us)
0 NESTED LOOPS (cr=0 pr=0 pw=0 time=0 us)
0 INDEX UNIQUE SCAN XPKTIBEX_PARTICIPANT (cr=0 pr=0 pw=0 time=0 us)(object id 168573)
0 TABLE ACCESS FULL TIBEX_QUOTESTATUSENUM (cr=0 pr=0 pw=0 time=0 us)
0 TABLE ACCESS FULL TIBEX_QUOTE (cr=0 pr=0 pw=0 time=0 us)
0 INDEX RANGE SCAN IX_QUOTEBOOK (cr=0 pr=0 pw=0 time=0 us)(object id 168590)
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
insert into plan_table (statement_id, timestamp, operation, options,
object_node, object_owner, object_name, object_instance, object_type,
search_columns, id, parent_id, position, other,optimizer, cost, cardinality,
bytes, other_tag, partition_start, partition_stop, partition_id,
distribution, cpu_cost, io_cost, temp_space, access_predicates,
filter_predicates, projection, time, qblock_name, object_alias, plan_id,
depth, remarks, other_xml )
values
(:1,:2,:3,:4,:5,:6,:7,:8,:9,:10,:11,:12,:13,:14,:15,:16,:17,:18,:19,:20,:21,
:22,:23,:24,:25,:26,:27,:28,:29,:30,:31,:32,:33,:34,:35,:36)
call count cpu elapsed disk query current rows
Parse 1 0.00 0.00 0 0 0 0
Execute 11 0.00 0.03 0 4 16 11
Fetch 0 0.00 0.00 0 0 0 0
total 12 0.00 0.03 0 4 16 11
Misses in library cache during parse: 1
Misses in library cache during execute: 3
Optimizer mode: ALL_ROWS
Parsing user id: 163 (recursive depth: 1)
SELECT ORA_PLAN_ID_SEQ$.NEXTVAL
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 1 0.00 0.00 0 0 0 1
total 3 0.00 0.00 0 0 0 1
Misses in library cache during parse: 1
Optimizer mode: CHOOSE
Parsing user id: SYS (recursive depth: 1)
Rows Row Source Operation
1 SEQUENCE ORA_PLAN_ID_SEQ$ (cr=0 pr=0 pw=0 time=18 us)
1 FAST DUAL (cr=0 pr=0 pw=0 time=2 us)
SELECT PLAN_TABLE_OUTPUT
FROM
TABLE(DBMS_XPLAN.DISPLAY('PLAN_TABLE', :1))
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 117 0 0
Fetch 2 0.00 0.00 0 0 0 28
total 4 0.00 0.00 0 117 0 28
Misses in library cache during parse: 1
Misses in library cache during execute: 1
Optimizer mode: ALL_ROWS
Parsing user id: 163
Rows Row Source Operation
28 COLLECTION ITERATOR PICKLER FETCH DISPLAY (cr=202 pr=0 pw=0 time=19391 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 0.00 0.00
SQL*Net more data to client 1 0.00 0.00
select u.name, o.name, a.interface_version#, o.obj#
from
association$ a, user$ u, obj$ o where a.obj# = :1
and a.property = :2
and a.statstype# = o.obj# and
u.user# = o.owner#
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 1 0.00 0.00 0 1 0 0
total 3 0.00 0.00 0 1 0 0
Misses in library cache during parse: 1
Misses in library cache during execute: 1
Optimizer mode: CHOOSE
Parsing user id: SYS (recursive depth: 1)
Rows Row Source Operation
0 NESTED LOOPS (cr=1 pr=0 pw=0 time=32 us)
0 NESTED LOOPS (cr=1 pr=0 pw=0 time=30 us)
0 TABLE ACCESS BY INDEX ROWID ASSOCIATION$ (cr=1 pr=0 pw=0 time=27 us)
0 INDEX RANGE SCAN ASSOC1 (cr=1 pr=0 pw=0 time=23 us)(object id 387)
0 TABLE ACCESS BY INDEX ROWID OBJ$ (cr=0 pr=0 pw=0 time=0 us)
0 INDEX UNIQUE SCAN I_OBJ1 (cr=0 pr=0 pw=0 time=0 us)(object id 36)
0 TABLE ACCESS CLUSTER USER$ (cr=0 pr=0 pw=0 time=0 us)
0 INDEX UNIQUE SCAN I_USER# (cr=0 pr=0 pw=0 time=0 us)(object id 11)
SELECT /* OPT_DYN_SAMP */ /*+ ALL_ROWS IGNORE_WHERE_CLAUSE
NO_PARALLEL(SAMPLESUB) opt_param('parallel_execution_enabled', 'false')
NO_PARALLEL_INDEX(SAMPLESUB) NO_SQL_TUNE */ NVL(SUM(C1),:"SYS_B_0"),
NVL(SUM(C2),:"SYS_B_1")
FROM
(SELECT /*+ NO_PARALLEL("PLAN_TABLE") FULL("PLAN_TABLE")
NO_PARALLEL_INDEX("PLAN_TABLE") */ :"SYS_B_2" AS C1, :"SYS_B_3" AS C2 FROM
"SYS"."PLAN_TABLE$" "PLAN_TABLE") SAMPLESUB
call count cpu elapsed disk query current rows
Parse 2 0.00 0.00 0 0 0 0
Execute 2 0.00 0.00 0 0 0 0
Fetch 2 0.00 0.00 0 8 0 2
total 6 0.00 0.00 0 8 0 2
Misses in library cache during parse: 1
Misses in library cache during execute: 1
Optimizer mode: ALL_ROWS
Parsing user id: 163 (recursive depth: 2)
Rows Row Source Operation
1 SORT AGGREGATE (cr=4 pr=0 pw=0 time=55 us)
11 TABLE ACCESS FULL PLAN_TABLE$ (cr=4 pr=0 pw=0 time=44 us)
select /*+ opt_param('parallel_execution_enabled',
'false') EXEC_FROM_DBMS_XPLAN */ * from PLAN_TABLE where 1=0
call count cpu elapsed disk query current rows
Parse 1 0.00 0.00 0 1 0 0
Execute 1 0.00 0.00 0 0 0 0
Fetch 0 0.00 0.00 0 0 0 0
total 2 0.00 0.00 0 1 0 0
Misses in library cache during parse: 1
Optimizer mode: ALL_ROWS
Parsing user id: 163 (recursive depth: 1)
Rows Row Source Operation
0 FILTER (cr=0 pr=0 pw=0 time=1 us)
0 TABLE ACCESS FULL PLAN_TABLE$ (cr=0 pr=0 pw=0 time=0 us)
SELECT /*+ opt_param('parallel_execution_enabled', 'false') */
/* EXEC_FROM_DBMS_XPLAN */ id, position, depth, operation, options, object_name, cardinality, bytes, temp_space, cost, io_cost, cpu_cost , time, partition_start, partition_stop, object_node, other_tag, distribution, projection, access_predicates, filter_predicates , other, qblock_name, object_alias, nvl(other_xml, remarks), null, null, null, null, null, null, null,
null, null, null, null, null,
null, null, null, null from PLAN_TABLE where plan_id = (select max(plan_id)
from PLAN_TABLE where id=0 and statement_id = :stmt_id)
order by id
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 2 0 0
Fetch 12 0.00 0.00 0 8 7 11
total 14 0.00 0.00 0 10 7 11
Misses in library cache during parse: 1
Misses in library cache during execute: 1
Optimizer mode: ALL_ROWS
Parsing user id: 163 (recursive depth: 2)
Rows Row Source Operation
11 SORT ORDER BY (cr=8 pr=0 pw=0 time=239 us)
11 TABLE ACCESS FULL PLAN_TABLE$ (cr=8 pr=0 pw=0 time=117 us)
1 SORT AGGREGATE (cr=4 pr=0 pw=0 time=30 us)
1 TABLE ACCESS FULL PLAN_TABLE$ (cr=4 pr=0 pw=0 time=21 us)
SELECT /* OPT_DYN_SAMP */ /*+ ALL_ROWS IGNORE_WHERE_CLAUSE
NO_PARALLEL(SAMPLESUB) opt_param('parallel_execution_enabled', 'false')
NO_PARALLEL_INDEX(SAMPLESUB) NO_SQL_TUNE */ NVL(SUM(C1),0), NVL(SUM(C2),0)
FROM
(SELECT /*+ IGNORE_WHERE_CLAUSE NO_PARALLEL("PLAN_TABLE") FULL("PLAN_TABLE")
NO_PARALLEL_INDEX("PLAN_TABLE") */ 1 AS C1, CASE WHEN "PLAN_TABLE"."ID"=0
AND "PLAN_TABLE"."STATEMENT_ID"=:B1 THEN 1 ELSE 0 END AS C2 FROM
"SYS"."PLAN_TABLE$" "PLAN_TABLE") SAMPLESUB
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 1 0.00 0.00 0 4 0 1
total 3 0.00 0.00 0 4 0 1
Misses in library cache during parse: 1
Misses in library cache during execute: 1
Optimizer mode: ALL_ROWS
Parsing user id: 163 (recursive depth: 2)
Rows Row Source Operation
1 SORT AGGREGATE (cr=4 pr=0 pw=0 time=57 us)
11 TABLE ACCESS FULL PLAN_TABLE$ (cr=4 pr=0 pw=0 time=44 us)
SELECT PLAN_TABLE_OUTPUT
FROM
TABLE(CAST(DBMS_XPLAN.PREPARE_RECORDS(:B1 , :B2 ) AS
SYS.DBMS_XPLAN_TYPE_TABLE))
call count cpu elapsed disk query current rows
Parse 0 0.00 0.00 0 0 0 0
Execute 1 0.00 0.00 0 0 0 0
Fetch 1 0.00 0.00 0 5 5 28
total 2 0.00 0.00 0 5 5 28
Misses in library cache during parse: 0
Optimizer mode: ALL_ROWS
Parsing user id: 163 (recursive depth: 1)
SELECT /*+ opt_param('parallel_execution_enabled', 'false') */
extractvalue(xmlval, '/*/info[@type = "sql_profile"]'), extractvalue(xmlval,
'/*/info[@type = "outline"]'), extractvalue(xmlval, '/*/info[@type =
"dynamic_sampling"]'), extractvalue(xmlval, '/*/info[@type =
"row_shipping"]'), extractvalue(xmlval, '/*/info[@type = "index_size"]'),
extractvalue(xmlval,'/*/info[@type = "plan_hash"]')
from
(select xmltype(:v_other_xml) xmlval 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 150 0 0
Fetch 1 0.00 0.00 0 24 0 1
total 3 0.01 0.01 0 174 0 1
Misses in library cache during parse: 1
Misses in library cache during execute: 1
Optimizer mode: ALL_ROWS
Parsing user id: 163 (recursive depth: 2)
Rows Row Source Operation
1 FAST DUAL (cr=0 pr=0 pw=0 time=3 us)
OVERALL TOTALS FOR ALL NON-RECURSIVE STATEMENTS
call count cpu elapsed disk query current rows
Parse 7 0.01 0.03 0 0 0 0
Execute 7 0.01 0.04 0 126 16 13
Fetch 8 21.43 20.94 1125 2405864 0 496
total 22 21.46 21.02 1125 2405990 16 509
Misses in library cache during parse: 4
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 14 0.00 0.00
SQL*Net message from client 14 0.01 0.03
SQL*Net more data to client 47 0.00 0.00
direct path write temp 75 0.00 0.04
direct path read temp 75 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 12 0.00 0.00 0 1 0 0
Execute 23 0.01 0.07 0 156 16 11
Fetch 22 0.00 0.00 0 58 12 47
total 57 0.02 0.08 0 215 28 58
Misses in library cache during parse: 10
Misses in library cache during execute: 10
16 user SQL statements in session.
4 internal SQL statements in session.
20 SQL statements in session.
Trace file: mifex3_ora_2598_mytrace1.trc
Trace file compatibility: 10.01.00
Sort options: default
4 sessions in tracefile.
35 user SQL statements in trace file.
9 internal SQL statements in trace file.
20 SQL statements in trace file.
16 unique SQL statements in trace file.
493 lines in trace file.
21 elapsed seconds in trace file. -
Help with performance SQL tuning - Rewriting the query
Hi
I have serious performance issues with some 8 update queries
These were earlier taking 5 mins . Now taking 2.5 hours
This is one of the culprit UPDATE statement (These are 7 such other update statements on different tables but same logic)
We have change the update to MERGE and used PARALLEL hints but have not got desired results
There are appropriate indexes on the tables
Is there a way to rewrite the UPDATE statement in a better way to improve the performance
update TABLE_dob
set key_act =
(select skey from table_subs
where sub_act = sub_num)
where exists
(select 1 from table_subs
where sub_act = sub_num);
Table_DOB has 37 million records
Table_subs has 20 million recordsaashoo_5 wrote:
Hi
I have serious performance issues with some 8 update queries
These were earlier taking 5 mins . Now taking 2.5 hours
This is one of the culprit UPDATE statement (These are 7 such other update statements on different tables but same logic)
We have change the update to MERGE and used PARALLEL hints but have not got desired results
There are appropriate indexes on the tables
Is there a way to rewrite the UPDATE statement in a better way to improve the performance
update TABLE_dob
set key_act =
(select skey from table_subs
where sub_act = sub_num)
where exists
(select 1 from table_subs
where sub_act = sub_num);
Table_DOB has 37 million records
Table_subs has 20 million recordsThread: HOW TO: Post a SQL statement tuning request - template posting
HOW TO: Post a SQL statement tuning request - template posting -
Hi ,
I have a Query that needs to be tuned.
The query joins two views with some filter condition.
While running the individual view query with the filter condition i can able to get the results quickly within a seconds.
But while joining the views conditions of the same criteria which i have used for the individual query takes more than 30 minute.
i am struggling to tuning this query which was written using the views.
Note :
My problem is while checking the explain plan unique sort is taking more cost.
is that i can reduce the time by giving some optimizer hints to reduce the unique sort cost for query using views?
Thanks & regards,
Senthur pandi MHi,
BluShadow wrote:
957595 wrote:
Hi ,
I have a Query that needs to be tuned.
The query joins two views with some filter condition.
While running the individual view query with the filter condition i can able to get the results quickly within a seconds.
But while joining the views conditions of the same criteria which i have used for the individual query takes more than 30 minute.
i am struggling to tuning this query which was written using the views.
Note :
My problem is while checking the explain plan unique sort is taking more cost.Cost in not necessarily a good comparison to use. The cost is a figure determined on a per-query basis,The problem with cost is that it's a prediction made by the optimizer, rather than the actual measure of query performance. Optimizer often makes mistakes about expected query performance. Ironically, people normally look at query cost when it needs tuning, i.e. when the chance that optimizer made a mistake is especially high.
In many internet forums one can see claims that cost estimates are meaningless across different queries. Such claims are unfounded. When calculated correctly, cost is quite meaningful, and in such cases there is nothing wrong about comparing cost not only for different queries, but also for different databases (if they have same optimizer settings and system stats).
is that i can reduce the time by giving some optimizer hints to reduce the unique sort cost for query using views?Hints are not the way to improve performance. That's an overstatement. The sad truth is that in many cases there is no viable alternative to using hints. Rather than always avoid hints no matter what cost, it's better to understand how hints affect optimizer behavior, and when it's safe to use them.
They are great for identifying where the cause of a performance issue is, but shouldn't be used in production code, as it would be like saying that you know better than Oracle how to retrieve the data, not just now, but in the future as more
data is added and as data is deleted and replaced with new data etc. By adding hints you are effectively forcing the optimizer to execute the query in a particular way, which may be fast now, but in the future may be worse than what the optimizer can determine itself.Hints that force the optimizer to use a specific access path or a specific join method are dangerous -- because the only lock-in one part of the plan, but not the entire plan (e.g. INDEX hint only ensures that an index is used if possible, but it cannot ensure INDEX UNIQUE/RANGE SCAN, so you may end up in a situation when the optimizer is doing an expensive and meaningless INDEX FULL SCAN because of the hint that was indended to force a different, more selective, access method).
Hints that don't do that, but rather prevent the optimizer from trying to be smart when it's better to keep things simple, are relatively safe.
So, use the hints to identify where there are issues in the SQL or in the database design, and fix those issues, rather than leave hints in production code.As a general rule, sure. Here, however, the problem seems to be obvious -- if views are fast separately, and slow when joined, that suggests that the optimizer doesn't merge them correctly.
Best regards,
Nikolay -
Tuning the query : Very Urgent
Hi
We have query wich needs tuning.when we are putting REGULAR EXPRESSION query is running fine but whne we put like LIKE stmt it is taking time.Here is the query below.Please help on tuning.
SELECT a.order_number, b.last_update_date,TO_CHAR( b.split_percent,'FM99999.009') SPLIT_PERCENTAGE,
rs.NAME " SALES_PERSON_NAME ", rs.salesrep_number, b.effective_date,
b.creation_date "CREATION_DATE", rt.NAME "TERRITORY_NAME",
rt.segment1 "ERP_CODE", a.booked_date "DATE_BOOKED",
TO_CHAR(ROUND((( (SELECT SUM (ordered_quantity * unit_selling_price)
FROM apps.oe_order_lines_all ol
WHERE ol.header_id = a.header_id)
* b.split_percent
/ 100
) , 2),'FM99999999999999999999.009') order_total ,
(SELECT user_name
FROM fnd_user
WHERE user_id = b.last_updated_by) requested_by,
b.obsolete_date
FROM oe_order_headers_all a,
apps.csm_header_sales_cr_hist b,
jtf_rs_salesreps rs,
ra_territories rt
WHERE 1 = 1
AND a.header_id = b.source_header_id
AND b.territory_id = rt.territory_id
AND b.salesrep_id = rs.salesrep_id
AND b.source_type = 'O'
AND a.order_number IN (
SELECT a.order_number
FROM oe_order_headers_all a,
apps.csm_header_sales_cr_hist b,
jtf_rs_salesreps rs,
ra_territories rt
WHERE 1 = 1
AND a.header_id = b.source_header_id
AND b.territory_id = rt.territory_id
AND b.salesrep_id = rs.salesrep_id
AND b.source_type = 'O'
-- AND b.obsolete_date IS NULL --ommented by andondap as per TD#9648 Changes
AND REGEXP_LIKE ( rs.name , '(svc)|(Muti.*Y)|(Multi.*Y)|(._MY)') Commented by andondap as per TD#9648 Changes
AND b.last_update_date BETWEEN TO_DATE ('2012/11/25', 'YYYY/MM/DD') AND TO_DATE ('2013/03/23', 'YYYY/MM/DD')+ 0.9999
AND REGEXP_LIKE ( rs.name,'(.MY)|(Muti.*Y))|(Multi.*Y)|(._MY) |(mlti)')
AND rs.name LIKE '%SVC%MULTI%' OR rs.name NOT LIKE '%DUMMY%' OR rs.name LIKE 'Svc%Multi%' OR rs.name LIKE 'Svc%MY%'
OR rs.name LIKE 'Service%Multi%' OR rs.name LIKE '%MY_SHARE_TM' OR rs.name LIKE '%MY_SHARE_T')
ORDER BY a.order_number, b.creation_date
Thanks
HibinHmmm, let's see...
1. OP provided formatted code using {noformat}{noformat} tags.... - FAILED
2. OP provided database version in full... - FAILED
3. OP provided table structures and index information... - FAILED
4. OP provided cardinality and selectivity information... - FAILED
5. OP provided explain plans... - FAILED
6. OP provided execution traces... - FAILED
7. OP is a new member and can be excused for above failures... - FAILED
8. OP has asked previous questions and followed forum etiquette by marking them as answered... - FAILED
9. OP has respected volunteers and other questioners by not marking his question as Urgent... - FAILED
10. OP has read the forum FAQ ({message:id=9360002}) for posting his question... - FAILED
11. OP has read the forum FAQ ({message:id=9360003}) for posting a tuning question... - FAILED
It's a good job you're not a computer program, you wouldn't have even compiled.
so, points to note:
This is a forum of volunteers. There's no such thing as an Urgent question here, and it's considered rude to suggest your question is urgent, as that indicates you want immediate attention from the people who are giving up their own time to help, and who have their own jobs to do. It's also rude for the other people who are asking questions, as everyone would like an answer to their problem as soon as possible, so what makes you any more special? An urgent issue is one where a live system is down potentially putting people's lives at risk or causing a company to lose money, or somehow damage their services. Such issues should be logged with Oracle Support, not on the free OTN forums.
Next, when you post your question, ensure you provide all the information that is needed for people to be able to help you. Read the FAQ posts which point to useful threads indicating what information is required, especially for tuning requests.
Finally, when your questions have been answered, it is common courtesy to mark them as answered (and award points if appropriate), otherwise it indicates that you have no respect for the people who are helping you.
If you follow all the advice above, you will end up creating a good question that people will be willing to help you with. If you don't follow the advice above, such as in this question you've posted, you will find that few experts will bother to help (or if they post it will not likely be helpful advise you receive). The choice is yours. -
Please help!!! Tuning the query
Hi,
I am using Oracle BDBXML 2.4.16. In the following, policyContainer.dbxml has around 1000 documents and productsContainer.dbxml around 10 documents. The following query is taking around 6 - 8 seconds to fetch the data of around 300 records. I have created node-element-equality-string indexes on PolicyEvent, PolicyStatus, Archived, IsLatest, ProductID and CompanyID.
I am novice on Query tuning. Can someone please help me to tune the following query. I have posted the query plan as well.
Thanks in Advance!!
Balakrishna.
Query:
query ' for $policy in collection("policyContainer.dbxml")/Policy[PolicyState/PolicyEvent=("APPLICATION","QUOTE","BINDER","POLICY","ENDORSEMENT QUOTE")]
[PolicyHeader/ProductID = (for $product in collection("productsContainer.dbxml")/Product/ProductsHeader[CompanyID=(1)] return $product/ProductID)]
[PolicyState/PolicyStatus !=("RATE","DECLINED ENDORSEMENT QUOTE","DECLINED NON-PRE ENDORSEMENT QUOTE","DECLINED EXTENSION QUOTE")]
[PolicyState/Archived !="true"]
[(PolicyState/IsLatest !="false"
and (PolicyState/PolicyStatus != ("ENDORSEMENT QUOTE","NON-PRE ENDORSEMENT QUOTE","EXTENSION QUOTE")))
or (PolicyState/IsLatest !="true"
and (PolicyState/PolicyStatus =("ENDORSEMENT QUOTE","NON-PRE ENDORSEMENT QUOTE","EXTENSION QUOTE")))]
let $state := $policy/PolicyState
let $header := $policy/PolicyHeader
let $datatable := $policy/DataTable/DataTableInfo
return
<policyDetail>
{$policy/SubmissionNumber},
{$policy/DocumentNumber},
{$policy/QuoteVersionNumber},
{$state/*,$header/*,$datatable/*}
</policyDetail>'
Query plan:
<XQuery>
<Return>
<LetTuple uri="" name="datatable">
<LetTuple uri="" name="header">
<LetTuple uri="" name="state">
<ForTuple uri="" name="policy">
<ContextTuple/>
<QueryPlanToAST>
<BufferQP id="2">
<NegativeNodePredicateFilterQP uri="" name="#tmp67">
<NegativeNodePredicateFilterQP uri="" name="#tmp73">
<NodePredicateFilterQP uri="" name="#tmp404">
<ParentOfChildJoinQP>
<StepQP axis="parent-of-child" name="PolicyState" nodeType="element">
<UnionQP>
<ValueQP container="policyContainer.dbxml" index="node-element-equality-string" operation="eq" child="PolicyEvent" value="ENDORSEMENT QUOTE"/>
<ValueQP container="policyContainer.dbxml" index="node-element-equality-string" operation="eq" child="PolicyEvent" value="APPLICATION"/>
<ValueQP container="policyContainer.dbxml" index="node-element-equality-string" operation="eq" child="PolicyEvent" value="POLICY"/>
<ValueQP container="policyContainer.dbxml" index="node-element-equality-string" operation="eq" child="PolicyEvent" value="BINDER"/>
<ValueQP container="policyContainer.dbxml" index="node-element-equality-string" operation="eq" child="PolicyEvent" value="QUOTE"/>
</UnionQP>
</StepQP>
<StepQP axis="child" name="Policy" nodeType="element">
<SequentialScanQP container="policyContainer.dbxml" nodeType="document"/>
</StepQP>
</ParentOfChildJoinQP>
<ValueFilterQP comparison="eq" general="true">
<StepQP axis="child" name="ProductID" nodeType="element">
<StepQP axis="child" name="PolicyHeader" nodeType="element">
<VariableQP name="#tmp404"/>
</StepQP>
</StepQP>
<Atomize>
<Return>
<ForTuple uri="" name="product">
<ContextTuple/>
<QueryPlanToAST>
<ParentOfChildJoinQP>
<ValueFilterQP comparison="eq" general="true">
<PresenceQP container="productsContainer.dbxml" index="node-element-equality-string" operation="prefix" child="CompanyID"/>
<Sequence>
<NumericTypeConstructor value="1.0E0" typeuri="http://www.w3.org/2001/XMLSchema" typename="integer"/>
</Sequence>
</ValueFilterQP>
<StepQP axis="child" name="ProductsHeader" nodeType="element">
<StepQP axis="child" name="Product" nodeType="element">
<SequentialScanQP container="productsContainer.dbxml" nodeType="document"/>
</StepQP>
</StepQP>
</ParentOfChildJoinQP>
</QueryPlanToAST>
</ForTuple>
<QueryPlanToAST>
<StepQP axis="child" name="ProductID" nodeType="element">
<VariableQP name="product"/>
</StepQP>
</QueryPlanToAST>
</Return>
</Atomize>
</ValueFilterQP>
</NodePredicateFilterQP>
<ValueFilterQP comparison="ne" general="true">
<ValueFilterQP comparison="ne" general="true">
<ValueFilterQP comparison="ne" general="true">
<ValueFilterQP comparison="ne" general="true">
<StepQP axis="child" name="PolicyStatus" nodeType="element">
<StepQP axis="child" name="PolicyState" nodeType="element">
<VariableQP name="#tmp73"/>
</StepQP>
</StepQP>
<Sequence>
<AnyAtomicTypeConstructor value="RATE" typeuri="http://www.w3.org/2001/XMLSchema" typename="string"/>
<AnyAtomicTypeConstructor value="DECLINED ENDORSEMENT QUOTE" typeuri="http://www.w3.org/2001/XMLSchema" typename="string"/>
<AnyAtomicTypeConstructor value="DECLINED NON-PRE ENDORSEMENT QUOTE" typeuri="http://www.w3.org/2001/XMLSchema" typename="string"/>
<AnyAtomicTypeConstructor value="DECLINED EXTENSION QUOTE" typeuri="http://www.w3.org/2001/XMLSchema" typename="string"/>
</Sequence>
</ValueFilterQP>
<Sequence>
<AnyAtomicTypeConstructor value="RATE" typeuri="http://www.w3.org/2001/XMLSchema" typename="string"/>
<AnyAtomicTypeConstructor value="DECLINED ENDORSEMENT QUOTE" typeuri="http://www.w3.org/2001/XMLSchema" typename="string"/>
<AnyAtomicTypeConstructor value="DECLINED NON-PRE ENDORSEMENT QUOTE" typeuri="http://www.w3.org/2001/XMLSchema" typename="string"/>
<AnyAtomicTypeConstructor value="DECLINED EXTENSION QUOTE" typeuri="http://www.w3.org/2001/XMLSchema" typename="string"/>
</Sequence>
</ValueFilterQP>
<Sequence>
<AnyAtomicTypeConstructor value="RATE" typeuri="http://www.w3.org/2001/XMLSchema" typename="string"/>
<AnyAtomicTypeConstructor value="DECLINED ENDORSEMENT QUOTE" typeuri="http://www.w3.org/2001/XMLSchema" typename="string"/>
<AnyAtomicTypeConstructor value="DECLINED NON-PRE ENDORSEMENT QUOTE" typeuri="http://www.w3.org/2001/XMLSchema" typename="string"/>
<AnyAtomicTypeConstructor value="DECLINED EXTENSION QUOTE" typeuri="http://www.w3.org/2001/XMLSchema" typename="string"/>
</Sequence>
</ValueFilterQP>
<Sequence>
<AnyAtomicTypeConstructor value="RATE" typeuri="http://www.w3.org/2001/XMLSchema" typename="string"/>
<AnyAtomicTypeConstructor value="DECLINED ENDORSEMENT QUOTE" typeuri="http://www.w3.org/2001/XMLSchema" typename="string"/>
<AnyAtomicTypeConstructor value="DECLINED NON-PRE ENDORSEMENT QUOTE" typeuri="http://www.w3.org/2001/XMLSchema" typename="string"/>
<AnyAtomicTypeConstructor value="DECLINED EXTENSION QUOTE" typeuri="http://www.w3.org/2001/XMLSchema" typename="string"/>
</Sequence>
</ValueFilterQP>
</NegativeNodePredicateFilterQP>
<ChildJoinQP>
<StepQP axis="child" name="PolicyState" nodeType="element">
<VariableQP name="#tmp67"/>
</StepQP>
<ValueQP container="policyContainer.dbxml" index="node-element-equality-string" operation="eq" child="Archived" value="true"/>
</ChildJoinQP>
</NegativeNodePredicateFilterQP>
<UnionQP>
<NegativeNodePredicateFilterQP uri="" name="#tmp18">
<NegativeNodePredicateFilterQP uri="" name="#tmp46">
<BufferReferenceQP id="2"/>
<ChildJoinQP>
<StepQP axis="child" name="PolicyState" nodeType="element">
<VariableQP name="#tmp46"/>
</StepQP>
<ValueQP container="policyContainer.dbxml" index="node-element-equality-string" operation="eq" child="IsLatest" value="false"/>
</ChildJoinQP>
</NegativeNodePredicateFilterQP>
<ValueFilterQP comparison="ne" general="true">
<ValueFilterQP comparison="ne" general="true">
<ValueFilterQP comparison="ne" general="true">
<StepQP axis="child" name="PolicyStatus" nodeType="element">
<StepQP axis="child" name="PolicyState" nodeType="element">
<VariableQP name="#tmp18"/>
</StepQP>
</StepQP>
<Sequence>
<AnyAtomicTypeConstructor value="ENDORSEMENT QUOTE" typeuri="http://www.w3.org/2001/XMLSchema" typename="string"/>
<AnyAtomicTypeConstructor value="NON-PRE ENDORSEMENT QUOTE" typeuri="http://www.w3.org/2001/XMLSchema" typename="string"/>
<AnyAtomicTypeConstructor value="EXTENSION QUOTE" typeuri="http://www.w3.org/2001/XMLSchema" typename="string"/>
</Sequence>
</ValueFilterQP>
<Sequence>
<AnyAtomicTypeConstructor value="ENDORSEMENT QUOTE" typeuri="http://www.w3.org/2001/XMLSchema" typename="string"/>
<AnyAtomicTypeConstructor value="NON-PRE ENDORSEMENT QUOTE" typeuri="http://www.w3.org/2001/XMLSchema" typename="string"/>
<AnyAtomicTypeConstructor value="EXTENSION QUOTE" typeuri="http://www.w3.org/2001/XMLSchema" typename="string"/>
</Sequence>
</ValueFilterQP>
<Sequence>
<AnyAtomicTypeConstructor value="ENDORSEMENT QUOTE" typeuri="http://www.w3.org/2001/XMLSchema" typename="string"/>
<AnyAtomicTypeConstructor value="NON-PRE ENDORSEMENT QUOTE" typeuri="http://www.w3.org/2001/XMLSchema" typename="string"/>
<AnyAtomicTypeConstructor value="EXTENSION QUOTE" typeuri="http://www.w3.org/2001/XMLSchema" typename="string"/>
</Sequence>
</ValueFilterQP>
</NegativeNodePredicateFilterQP>
<NegativeNodePredicateFilterQP uri="" name="#tmp56">
<ParentOfChildJoinQP>
<StepQP axis="parent-of-child" name="PolicyState" nodeType="element">
<UnionQP>
<ValueQP container="policyContainer.dbxml" index="node-element-equality-string" operation="eq" child="PolicyStatus" value="NON-PRE ENDORSEMENT QUOTE"/>
<ValueQP container="policyContainer.dbxml" index="node-element-equality-string" operation="eq" child="PolicyStatus" value="EXTENSION QUOTE"/>
<ValueQP container="policyContainer.dbxml" index="node-element-equality-string" operation="eq" child="PolicyStatus" value="ENDORSEMENT QUOTE"/>
</UnionQP>
</StepQP>
<BufferReferenceQP id="2"/>
</ParentOfChildJoinQP>
<ChildJoinQP>
<StepQP axis="child" name="PolicyState" nodeType="element">
<VariableQP name="#tmp56"/>
</StepQP>
<ValueQP container="policyContainer.dbxml" index="node-element-equality-string" operation="eq" child="IsLatest" value="true"/>
</ChildJoinQP>
</NegativeNodePredicateFilterQP>
</UnionQP>
</BufferQP>
</QueryPlanToAST>
</ForTuple>
<QueryPlanToAST>
<StepQP axis="child" name="PolicyState" nodeType="element">
<VariableQP name="policy"/>
</StepQP>
</QueryPlanToAST>
</LetTuple>
<QueryPlanToAST>
<StepQP axis="child" name="PolicyHeader" nodeType="element">
<VariableQP name="policy"/>
</StepQP>
</QueryPlanToAST>
</LetTuple>
<QueryPlanToAST>
<StepQP axis="child" name="DataTableInfo" nodeType="element">
<StepQP axis="child" name="DataTable" nodeType="element">
<VariableQP name="policy"/>
</StepQP>
</StepQP>
</QueryPlanToAST>
</LetTuple>
<DOMConstructor type="element">
<Name>
<Sequence>
<ATQNameConstructor uri="" prefix="" localname="policyDetail" typeuri="http://www.w3.org/2001/XMLSchema" typename="QName"/>
</Sequence>
</Name>
<Children>
<ContentSequence>
<QueryPlanToAST>
<StepQP axis="child" name="SubmissionNumber" nodeType="element">
<VariableQP name="policy"/>
</StepQP>
</QueryPlanToAST>
</ContentSequence>
<ContentSequence>
<Sequence>
<AnyAtomicTypeConstructor value="," typeuri="http://www.w3.org/2001/XMLSchema" typename="string"/>
</Sequence>
</ContentSequence>
<ContentSequence>
<QueryPlanToAST>
<StepQP axis="child" name="DocumentNumber" nodeType="element">
<VariableQP name="policy"/>
</StepQP>
</QueryPlanToAST>
</ContentSequence>
<ContentSequence>
<Sequence>
<AnyAtomicTypeConstructor value="," typeuri="http://www.w3.org/2001/XMLSchema" typename="string"/>
</Sequence>
</ContentSequence>
<ContentSequence>
<QueryPlanToAST>
<StepQP axis="child" name="QuoteVersionNumber" nodeType="element">
<VariableQP name="policy"/>
</StepQP>
</QueryPlanToAST>
</ContentSequence>
<ContentSequence>
<Sequence>
<AnyAtomicTypeConstructor value="," typeuri="http://www.w3.org/2001/XMLSchema" typename="string"/>
</Sequence>
</ContentSequence>
<ContentSequence>
<Parenthesized>
<QueryPlanToAST>
<ChildJoinQP>
<VariableQP name="state"/>
<SequentialScanQP container="policyContainer.dbxml" nodeType="element"/>
</ChildJoinQP>
</QueryPlanToAST>
<QueryPlanToAST>
<StepQP axis="child" uri="*" name="*" nodeType="element">
<VariableQP name="header"/>
</StepQP>
</QueryPlanToAST>
<QueryPlanToAST>
<ChildJoinQP>
<VariableQP name="datatable"/>
<SequentialScanQP container="policyContainer.dbxml" nodeType="element"/>
</ChildJoinQP>
</QueryPlanToAST>
</Parenthesized>
</ContentSequence>
</Children>
</DOMConstructor>
</Return>
</XQuery>The good news is that your indexes are being used (anywhere in the query plan where you see index="node-element-equality-string"), the bad news is that the entire policyContainer is being scanned several times (<SequentialScanQP container="policyContainer.dbxml" nodeType="element"/>). Your best bet is to upgrade to dbxml-2.5.16, since that has several improvements to the optimizer that should optimize away those scans. Failing that, use the shell command (dbxml) to add and remove indexes and see how that changes the query plan and speed. The following line is what is causing the scans:
{$state/*,$header/*,$datatable/*}So add indexes that will help to locate those nodes, or change that line so that the query is faster.
Lauren Foutz -
Parameters to be considered for tuning the QUERY Performance.
Hi Guys
I wanted to identify the Query which is taking more resources through the Dynamic performance views and not through OEM.I wanter to tune the Query.
Please suggest me on this. Also i wanted to know what are all the parameters to be considered for tuning a query like Query execution time, I/O Hits, Library cache hits, etc and from which performance view these paramaters can be taken. I also wanted to know how to find the size of library cache and how much queries can be holded in a library cache and what will be the retention of queries in library cache and how to retrive the queries from Library cache.
Thanks a lot
Edited by: user448837 on Sep 23, 2008 9:24 PMHmm there is a parameter called makemyquery=super_fast, check that ;-).
Ok jokes apart, your question is like asking a doctor that when a person is sick than how to troubleshoot his sickeness? So does a doctor start giving medicine immediately? No right? He has to check some symptoms of the patient. The same is applicable to the query also. There is no view as such which would tell you the performance of the query ie it is good or bad. Tell me if a query is taking up 5 minutes and I come and tell you this, what would you say its good or bad or the query took this much CPU time what would you say, its too much or too less? I am sure your answers would be "it depends". That's the key point.
The supermost point in the performance check is two things, one the plan of the query. What kind of plan optimizer took for the query and whether it was really good or not? There are millions os ways to do som ething but the idea is to do it in the best way. That's what the idea of reading explain plan. I would suggest get your self familiar with explain plan's various paths and their pros and cons. Also about the query's charectristics, you can check V$sql, v$sqlarea , V$sql_text views.
Your other question that you want to check the size of the library cache , its contents and the retention, I would say that its all internally managed. You never size library cache but shared pool only. Similary the best bet for a dba/developer is to check the queries are mostly shareable and there wont be any duplicate sqls. So the cursor_sharing parameter can be used for this. The control is not given to us to manage the rentention or the flushing of the queries from the cache.
HTH
Aman.... -
Need help th tuning query or re write the query--
Hi,
Need help to tune the below query or rewrite th query for reducing the execution time Please find the query and explain plan.
QUERY
explain plan FOR SELECT consumer_key,product_key,days_in_product,20100201 period_key FROM
(SELECT consumer_key,
product_key,
days_in_product,
row_number() over ( Partition BY consumer_key order by Days_in_product DESC) row_num
FROM
(SELECT consumer_key,
product_key,
SUM(no_ofdays) days_in_product
FROM
(SELECT pcv.consumer_key,
pcv.product_key,
pcv.product_consumer_valid_from,
pcv.product_consumer_valid_to,
DECODE (SIGN(20100201000000-product_consumer_valid_from),1,20100201000000,product_consumer_valid_from) period_start,
DECODE (SIGN(20100228235959-product_consumer_valid_to),1,product_consumer_valid_to,20100228235959) period_end,
CASE
WHEN to_number(TO_CHAR(cd.activation_date,'YYYYMMDDHH24MISS')) BETWEEN 20100201000000 AND 20100228235959
AND activation_date > to_Date(product_consumer_valid_to,'YYYYMMDDHH24MISS')
THEN 0
WHEN to_number(TO_CHAR(cd.activation_date,'YYYYMMDDHH24MISS')) BETWEEN 20100201000000 AND 20100228235959
AND activation_date BETWEEN to_Date(product_consumer_valid_from,'YYYYMMDDHH24MISS') AND to_Date(product_consumer_valid_to,'YYYYMMDDHH24MISS')
THEN
--to_char(activation_date,'MON-YYYY')='PERIOD_ACTIVE' and activation_date >= to_Date(product_consumer_valid_from,'YYYYMMDDHH24MISS') then
(to_date(DECODE (SIGN(20100228235959-product_consumer_valid_to),1,product_consumer_valid_to,20100228235959),'YYYYMMDDHH24MISS') - to_date(TO_CHAR(activation_date,'YYYYMMDDHH24MISS'),'YYYYMMDDHH24MISS') )
WHEN to_number(TO_CHAR(cd.activation_date,'YYYYMMDDHH24MISS')) < 20100201000000
THEN (to_date(DECODE (SIGN(20100228235959-product_consumer_valid_to),1,product_consumer_valid_to,20100228235959),'YYYYMMDDHH24MISS') - to_Date(DECODE (SIGN(20100201000000-product_consumer_valid_from),1,20100201000000,product_consumer_valid_from),'YYYYMMDDHH24MISS') )
WHEN to_number(TO_CHAR(cd.activation_date,'YYYYMMDDHH24MISS')) > 20100228235959
THEN 0
ELSE
--unusual situation
(to_date(DECODE (SIGN(20100228235959-product_consumer_valid_to),1,product_consumer_valid_to,20100228235959),'YYYYMMDDHH24MISS') - to_Date(DECODE (SIGN(20100201000000-product_consumer_valid_from),1,20100201000000,product_consumer_valid_from),'YYYYMMDDHH24MISS') )
END No_ofDays
FROM cimtran.product_consumer_validity pcv,
consumer_dimension cd
WHERE pcv.consumer_key =cd.consumer_key
AND product_consumer_valid_to >= 20100201000000
AND product_consumer_valid_from <= 20100228235959
--and product_consumer_valid_from > '20090801000000'
ORDER BY consumer_key,
product_key,
product_consumer_valid_from
) a
GROUP BY consumer_key,
product_key
ORDER BY consumer_key,
product_key
) WHERE row_num=1 ;EXPLAIN PLAN
"PLAN_TABLE_OUTPUT"
"Plan hash value: 3823907703"
"| Id | Operation | Name | Rows | Bytes |TempSpc| Cost (%CPU)| Time |"
"| 0 | SELECT STATEMENT | | 4665K| 231M| | 133K (1)| 00:31:08 |"
"|* 1 | VIEW | | 4665K| 231M| | 133K (1)| 00:31:08 |"
"|* 2 | WINDOW SORT PUSHED RANK| | 4665K| 173M| 232M| 133K (1)| 00:31:08 |"
"| 3 | VIEW | | 4665K| 173M| | 104K (1)| 00:24:18 |"
"| 4 | SORT GROUP BY | | 4665K| 182M| 729M| 104K (1)| 00:24:18 |"
"|* 5 | HASH JOIN | | 13M| 533M| 65M| 44241 (1)| 00:10:20 |"
"| 6 | TABLE ACCESS FULL | CONSUMER_DIMENSION | 2657K| 35M| | 4337 (1)| 00:01:01 |"
"|* 7 | TABLE ACCESS FULL | PRODUCT_CONSUMER_VALIDITY | 13M| 351M| | 15340 (2)| 00:03:35 |"
"Predicate Information (identified by operation id):"
" 1 - filter(""ROW_NUM""=1)"
" 2 - filter(ROW_NUMBER() OVER ( PARTITION BY ""CONSUMER_KEY"" ORDER BY "
" INTERNAL_FUNCTION(""DAYS_IN_PRODUCT"") DESC )<=1)"
" 5 - access(""PCV"".""CONSUMER_KEY""=""CD"".""CONSUMER_KEY"")"
" 7 - filter(""PRODUCT_CONSUMER_VALID_FROM""<=20100228235959 AND "
" ""PRODUCT_CONSUMER_VALID_TO"">=20100201000000)"I doubt that this query can be tuned without using indexes. There is a lot of unnecessary work specified in your query, like unnecessary intermediate sorting and selecting unused columns. The cost based optimizer recognized it and skips some of that unnecessary work, it seems. For clarity's sake, I would rewrite your query like below. Note that the query is untested:
select consumer_key
, max(product_key) keep (dense_rank last order by days_in_product) product_key
, max(days_in_product) days_in_product
, 20100201 period_key
from ( select pcv.consumer_key
, pcv.product_key
, sum
( case
when to_number(to_char(cd.activation_date,'yyyymmddhh24miss')) between 20100201000000 and 20100228235959
then
case
when cd.activation_date > to_date(pcv.product_consumer_valid_to,'yyyymmddhh24miss')
then
0
when cd.activation_date between to_date(pcv.product_consumer_valid_from,'yyyymmddhh24miss') and to_date(product_consumer_valid_to,'yyyymmddhh24miss')
then
to_date(to_char(pcv.product_consumer_valid_to),'yyyymmddhh24miss'))
- to_date(to_char(activation_date,'yyyymmddhh24miss'),'yyyymmddhh24miss')
end
when to_number(to_char(cd.activation_date,'yyyymmddhh24miss')) < 20100201000000
then
to_date(to_char(pcv.product_consumer_valid_to),'yyyymmddhh24miss'))
- to_date(to_char(pcv.product_consumer_valid_from),'yyyymmddhh24miss'))
when to_number(to_char(cd.activation_date,'yyyymmddhh24miss')) > 20100228235959
then
0
end
) days_in_product
from cimtran.product_consumer_validity pcv
, consumer_dimension cd
where pcv.consumer_key = cd.consumer_key
and product_consumer_valid_to >= 20100201000000
and product_consumer_valid_from <= 20100228235959
group by consumer_key
, product_key
group by consumer_keyRegards,
Rob. -
Tuning The Query By Using Xplain Plan
Hi Guys,
This particular query is taking a long time in the production reported by The SPE team .
SELECT
CASE
WHEN TPJRCSHDRW1.CASH_DRAWER_ID = 5000555
THEN 1
WHEN TPTRJO1.OTHER_CASH_DRAWER_ID = 5000555
THEN 2
END TRADE_TYPE,
TPDECO1.DENOMINATION_COUNT_ID,
TPDECO1.DENOMINATION_CATEGORY,
TPDECO1.DENOMINATION_VALUE,
TPDECO1.DENOMINATION_COUNT,
TPDECO1.DENOMINATION_TYPE,
TPDECO1.DENOMINATION_NAME,
TPTRJO1.TRANSACTION_ID,
TPTRJO1.TOTAL_VALUE,
TPTRJO1.TOTAL_VALUE_CCODE,
TPTRJO1.JOURNAL_ENTRY_ID,
TPJRCSHDRW1.CASH_DRAWER_ID,
TPTRJO1.OTHER_CASH_DRAWER_ID
FROM TRANSACTION_JOURNAL TPTRJO1
INNER JOIN JOURNAL_CASH_DRAWER TPJRCSHDRW1
ON TPTRJO1.JOURNAL_ENTRY_ID = TPJRCSHDRW1.JOURNAL_ENTRY_ID
LEFT OUTER JOIN DENOMINATION_COUNT TPDECO1
ON TPDECO1.JOURNAL_ENTRY_ID = TPJRCSHDRW1.JOURNAL_ENTRY_ID
WHERE ((TPJRCSHDRW1.CASH_DRAWER_ID = 5000555)
OR (TPTRJO1.OTHER_CASH_DRAWER_ID = 5000555))
AND (TPTRJO1.TRANSACTION_ID IN (563,590,1362,605,562,589,604))
AND (TPTRJO1.STATUS NOT IN ('I','V','R'))
AND ((TPTRJO1.REVERSED_BY) IS NULL) AND (TPJRCSHDRW1.CASH_DRAWER_DATE >= to_date('2009-07-24','yyyy-mm-dd') )
AND (TPTRJO1.TOTAL_VALUE <> 0)
AND ((TPTRJO1.OFFSET_ID) IS NULL);
When I am analysing the query by xplain_plan , I am getting this plan
Plan hash value: 3371088438
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
| 0 | SELECT STATEMENT | | 36557 | 3391K| 1445 (1)| 00:00:18 |
| 1 | CONCATENATION | | | | | |
| 2 | NESTED LOOPS OUTER | | 1 | 95 | 3 (0)| 00:00:01 |
| 3 | NESTED LOOPS | | 1 | 63 | 2 (0)| 00:00:01 |
|* 4 | TABLE ACCESS BY INDEX ROWID| TRANSACTION_JOURNAL | 1 | 40 | 1 (0)| 00:00:01 |
|* 5 | INDEX RANGE SCAN | I26_TRANSACTION_JOURNAL | 1 | | 1 (0)| 00:00:01 |
|* 6 | TABLE ACCESS BY INDEX ROWID| JOURNAL_CASH_DRAWER | 1 | 23 | 1 (0)| 00:00:01 |
|* 7 | INDEX RANGE SCAN | PKC_JOURNAL_CASH_D | 1 | | 1 (0)| 00:00:01 |
| 8 | TABLE ACCESS BY INDEX ROWID | DENOMINATION_COUNT | 12 | 384 | 1 (0)| 00:00:01 |
|* 9 | INDEX RANGE SCAN | PKC_DENOMINATION_COUNT | 20 | | 1 (0)| 00:00:01 |
| 10 | NESTED LOOPS OUTER | | 36556 | 3391K| 1442 (1)| 00:00:18 |
| 11 | NESTED LOOPS | | 1817 | 111K| 715 (0)| 00:00:09 |
| 12 | TABLE ACCESS BY INDEX ROWID| JOURNAL_CASH_DRAWER | 1817 | 41791 | 351 (0)| 00:00:05 |
|* 13 | INDEX RANGE SCAN | SPE099_JOURNALCASHDRWR | 1817 | | 7 (0)| 00:00:01 |
|* 14 | TABLE ACCESS BY INDEX ROWID| TRANSACTION_JOURNAL | 1 | 40 | 1 (0)| 00:00:01 |
|* 15 | INDEX UNIQUE SCAN | PKC_TRANSACTION_JOURNAL | 1 | | 1 (0)| 00:00:01 |
| 16 | TABLE ACCESS BY INDEX ROWID | DENOMINATION_COUNT | 20 | 640 | 1 (0)| 00:00:01 |
|* 17 | INDEX RANGE SCAN | PKC_DENOMINATION_COUNT | 20 | | 1 (0)| 00:00:01 |
Predicate Information (identified by operation id):
4 - filter("TPTRJO1"."TOTAL_VALUE"<>0 AND "TPTRJO1"."REVERSED_BY" IS NULL AND
"TPTRJO1"."OFFSET_ID" IS NULL)
5 - access("TPTRJO1"."OTHER_CASH_DRAWER_ID"=5000555)
filter("TPTRJO1"."STATUS"<>U'I' AND "TPTRJO1"."STATUS"<>U'V' AND "TPTRJO1"."STATUS"<>U'R'
AND ("TPTRJO1"."TRANSACTION_ID"=562 OR "TPTRJO1"."TRANSACTION_ID"=563 OR
"TPTRJO1"."TRANSACTION_ID"=589 OR "TPTRJO1"."TRANSACTION_ID"=590 OR
"TPTRJO1"."TRANSACTION_ID"=604 OR "TPTRJO1"."TRANSACTION_ID"=605 OR
"TPTRJO1"."TRANSACTION_ID"=1362))
6 - filter("TPJRCSHDRW1"."DRAWER_SEQ" IS NOT NULL)
7 - access("TPTRJO1"."JOURNAL_ENTRY_ID"="TPJRCSHDRW1"."JOURNAL_ENTRY_ID" AND
"TPJRCSHDRW1"."CASH_DRAWER_DATE">=TO_DATE(' 2009-07-24 00:00:00', 'syyyy-mm-dd hh24:mi:ss'))
filter("TPJRCSHDRW1"."CASH_DRAWER_DATE">=TO_DATE(' 2009-07-24 00:00:00', 'syyyy-mm-dd
hh24:mi:ss'))
9 - access("TPDECO1"."JOURNAL_ENTRY_ID"(+)="TPJRCSHDRW1"."JOURNAL_ENTRY_ID")
13 - access("TPJRCSHDRW1"."CASH_DRAWER_ID"=5000555 AND
"TPJRCSHDRW1"."CASH_DRAWER_DATE">=TO_DATE(' 2009-07-24 00:00:00', 'syyyy-mm-dd hh24:mi:ss'))
filter("TPJRCSHDRW1"."DRAWER_SEQ" IS NOT NULL)
14 - filter("TPTRJO1"."STATUS"<>U'I' AND "TPTRJO1"."STATUS"<>U'V' AND "TPTRJO1"."STATUS"<>U'R'
AND ("TPTRJO1"."TRANSACTION_ID"=562 OR "TPTRJO1"."TRANSACTION_ID"=563 OR
"TPTRJO1"."TRANSACTION_ID"=589 OR "TPTRJO1"."TRANSACTION_ID"=590 OR
"TPTRJO1"."TRANSACTION_ID"=604 OR "TPTRJO1"."TRANSACTION_ID"=605 OR
"TPTRJO1"."TRANSACTION_ID"=1362) AND "TPTRJO1"."TOTAL_VALUE"<>0 AND "TPTRJO1"."REVERSED_BY" IS
NULL AND "TPTRJO1"."OFFSET_ID" IS NULL AND LNNVL("TPTRJO1"."OTHER_CASH_DRAWER_ID"=5000555))
15 - access("TPTRJO1"."JOURNAL_ENTRY_ID"="TPJRCSHDRW1"."JOURNAL_ENTRY_ID")
17 - access("TPDECO1"."JOURNAL_ENTRY_ID"(+)="TPJRCSHDRW1"."JOURNAL_ENTRY_ID")
--There is an index SPE099_JOURNALCASHDRWR which is on
CASH_DRAWER_ID
CASH_DRAWER_DATE
DRAWER_SEQ
But I am wondering why there is TABLE ACCESS BY INDEX ROWID| JOURNAL_CASH_DRAWER when this col is availabe in the indexed table .
Can anyone Please suggest what improvements can be done on this query.WIll change in the table order will have some performance boost.
Please suggest ..
Thanks
PrafullaCould you please execute your query reported here below (pay attention to the gather_plan_statistics hint)
select /*+ gather_plan_statistics */
case
when tpjrcshdrw1.cash_drawer_id = 5000555
then 1
when tptrjo1.other_cash_drawer_id = 5000555
then 2
end trade_type,
tpdeco1.denomination_count_id,
tpdeco1.denomination_category,
tpdeco1.denomination_value,
tpdeco1.denomination_count,
tpdeco1.denomination_type,
tpdeco1.denomination_name,
tptrjo1.transaction_id,
tptrjo1.total_value,
tptrjo1.total_value_ccode,
tptrjo1.journal_entry_id,
tpjrcshdrw1.cash_drawer_id,
tptrjo1.other_cash_drawer_id
from
transaction_journal tptrjo1
inner join journal_cash_drawer tpjrcshdrw1
on tptrjo1.journal_entry_id = tpjrcshdrw1.journal_entry_id
left outer join denomination_count tpdeco1
on tpdeco1.journal_entry_id = tpjrcshdrw1.journal_entry_id
where ((tpjrcshdrw1.cash_drawer_id = 5000555)
or (tptrjo1.other_cash_drawer_id = 5000555))
and (tptrjo1.transaction_id in (563,590,1362,605,562,589,604))
and (tptrjo1.status not in ('I','V','R'))
and ((tptrjo1.reversed_by) is null)
and (tpjrcshdrw1.cash_drawer_date >= to_date('2009-07-24','yyyy-mm-dd') )
and (tptrjo1.total_value 0)
and ((tptrjo1.offset_id) is null);and post the formatted explain plan you will get using
select * from table(dbms_xplan.display_cursor(null,null,'ALLSTATS LAST'));IS one of the following indexed columns NULLABLE?
CASH_DRAWER_ID
CASH_DRAWER_DATE
DRAWER_SEQ
Best Regards
Mohamed Houri
www.hourim.wordpress.com
Edited by: Mohamed Houri on 14-juin-2012 7:07 -
Tuning the query..
Hi guys,
I have written a demand view query which is working perfectly and is giving demand betnwen specified date range. Can you suggest any modification in the query which will tune it to run faster and improve performance:
--Demand View query
--Data to use
--date: give any date range for this month
SELECT calendar_date,man_days_demand,/*total_fsr_count,*/
(total_fsr_count - MAN_DAYS_DEMAND) man_days_unstaffed,
/*FSR_Assigned_Serv_Req , FSR_Assigned_OT_Req ,*/
(total_fsr_count-(FSR_Assigned_Serv_Req + FSR_Assigned_OT_Req)) Man_days_avail
FROM (
SELECT TRUNC(cal.calendar_date) calendar_date,
(-- in line column qry to count the service reqs falling on that specific day
SELECT nvl(sum(count(ssrj.assigned_field_service_rep)),0)
FROM sop_service_request_job ssrj, sop_service_request ssr
WHERE (((cal.calendar_date between ssrj.scheduled_start_date AND
get_end_date(ssrj.scheduled_start_date,
ssrj.expected_service_hours,
ssrj.weekend)))
OR
(cal.calendar_date < ssrj.scheduled_start_date and
cal.calendar_date > get_end_date(ssrj.scheduled_start_date,
ssrj.expected_service_hours,
ssrj.weekend)))
and ssrj.service_request_id = ssr.service_request_id
and ssrj.assigned_field_service_rep is not null
GROUP BY calendar_date
) Man_Days_demand,
SELECT nvl(sum(count(ssrj.assigned_field_service_rep)),0)
FROM sop_service_request_job ssrj, sop_service_request ssr
WHERE (((cal.calendar_date between ssrj.scheduled_start_date AND
get_end_date(ssrj.scheduled_start_date,
ssrj.expected_service_hours,
ssrj.weekend)))
OR
(cal.calendar_date < ssrj.scheduled_start_date and
cal.calendar_date > get_end_date(ssrj.scheduled_start_date,
ssrj.expected_service_hours,
ssrj.weekend)))
and ssrj.service_request_id = ssr.service_request_id
and ssrj.assigned_field_service_rep is not null
and ssrj.job_status = 'ASSIGNED'
GROUP BY calendar_date
) FSR_Assigned_Serv_Req,
select nvl(sum(count(fsr_sso_id)),0)
from sop_other_time_alloc_det sotad
where ((cal.calendar_date between trunc(sotad.start_date) AND
trunc(sotad.end_date)) OR
(cal.calendar_date < trunc(sotad.start_date) AND
cal.calendar_date > trunc(sotad.end_date)))
GROUP BY calendar_date
) FSR_Assigned_OT_Req,
select nvl(count(distinct sso_id),0)
from sop_user_map
where role_id = 1
) total_fsr_count
FROM sop_fiscal_calendar_v cal, sop_service_user ssu, sop_service_request ssr,
sop_service_request_job ssrj, CSA_PLATFORM_MASTER cpm
WHERE
calendar_date BETWEEN trunc(to_date('&date_range_start_date','mm/dd/yyyy'))
AND trunc(to_date('&date_range_end_date','mm/dd/yyyy'))
and ssu.sso_id = ssrj.assigned_field_service_rep
and ssrj.service_request_id = ssr.service_request_id
and trim(ssu.sso_id) = trim('&ssoid')
and upper(ssu.qualification) like upper('%&qualification%')
and upper(cpm.platform_name) like upper('%&platform_name%')
and upper(ssu.country) like upper('%&country%')
and upper(ssr.region_id) like upper('%®ion_id')
and upper(ssrj.weekend) like upper('%&weekend%')
and upper(ssu.state) like upper('%&state%')
GROUP BY calendar_date
) order by calendar_date
Thx,,
JPHello
To preserve the formatting any text you post you need surround them with the UBB Code tags [pre] and [/pre]. i.e.
[pre]
SQL> select * from dual;
D
X
Execution Plan
0 SELECT STATEMENT Optimizer=CHOOSE
1 0 TABLE ACCESS (FULL) OF 'DUAL'
Statistics
0 recursive calls
4 db block gets
1 consistent gets
0 physical reads
0 redo size
544 bytes sent via SQL*Net to client
643 bytes received via SQL*Net from client
4 SQL*Net roundtrips to/from client
1 sorts (memory)
0 sorts (disk)
1 rows processed
[/pre]
HTH
David -
Tuning tricks for the query.
Hi Everyone,
This is my DB version @ production.
BANNER
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bi
PL/SQL Release 10.2.0.4.0 - Production
CORE 10.2.0.4.0 Production
TNS for Linux: Version 10.2.0.4.0 - Production
NLSRTL Version 10.2.0.4.0 - Production
We have a query, which is running more than 3 mins at production as we have 40 millions active records for almost 2 million active patients.
So clearly the active record percentage is 98. We have indexes on all required field values last date of computed statistics was 1st Jan 2014.
But we are unable achieve the performance from the query. If we are making it tightly coupled with parent - child relationship, then it's generating cost
value more than 2 million. So we tried some sub-queries but still the cost value is in million. Please do have a look at the query and suggest me something where
I can meliorate this. We can't go change DB structure straight away right now. So what needs to be done here? Please suggest something.
Query:-
select distinct
(select p.last_name || ', ' || p.first_name
from patient p
where p.patient_id = loc.patient_id) as patient_name,
(select p.external_id
from patient p
where p.patient_id = loc.patient_id) as external_id,
(select p.spectra_mrn
from patient p
where p.patient_id = loc.patient_id) as spectra_mrn,
ord.requisition_number as requisition_number,
f.facility_name as facility_name,
f.facility_id as facility_id,
(select fad.account_type as modality
from patient p,
patient_facility_modality pfm,
facility_account_modality fam,
facility_account_detail fad
where p.patient_id = pfm.patient_id
and pfm.facility_account_modality_id =
fam.facility_account_modality_id
and fam.facility_account_detail_id = fad.facility_account_detail_id
and p.patient_id = loc.patient_id
and pfm.facility_id = loc.facility_id) as modality,
(select fad.account_number as account_number
from patient p,
patient_facility_modality pfm,
facility_account_modality fam,
facility_account_detail fad
where p.patient_id = pfm.patient_id
and pfm.facility_account_modality_id =
fam.facility_account_modality_id
and fam.facility_account_detail_id = fad.facility_account_detail_id
and p.patient_id = loc.patient_id
and pfm.facility_id = loc.facility_id) as account_number,
(select fad.hlab_num as hlab_num
from patient p,
patient_facility_modality pfm,
facility_account_modality fam,
facility_account_detail fad
where p.patient_id = pfm.patient_id
and pfm.facility_account_modality_id =
fam.facility_account_modality_id
and fam.facility_account_detail_id = fad.facility_account_detail_id
and p.patient_id = loc.patient_id
and pfm.facility_id = loc.facility_id) as hlab_num,
loc.order_draw_dt as draw_dt,
c.corporation_name as corporation_name,
c.corporation_acronym as acronym,
loc.patient_id,
loct.test_id
from lab_order_occ loc,
lab_order_occ_test loct,
facility f,
corporation c,
order_requisition_header ord
where loc.lab_order_occ_id = loct.lab_order_occ_id
and loc.facility_id = f.facility_id
and f.corporation_id = c.corporation_id
and ord.patient_id = loc.patient_id
and ord.facility_id = loc.facility_id
and ord.draw_dt = loc.order_draw_dt
and loc.order_draw_dt between trunc(sysdate) - 7 and trunc(sysdate)
and loc.status = 'A'
and loc.msg_sent_to_lab_yn = 'Y'
and loct.status <> 'R'
and loct.test_id in (
select test_id
from test_required
where required_test_code in (
select test_code
from interface_adt_aoe_master))
and
(select count(*) from interface_adt_aoe_master where source_system = corporation_acronym
and test_code = (select test_code from test where test_id=(select aoe_test_id from lab_order_occ_test_aoe where lab_order_occ_test_id= loct.lab_order_occ_test_id)))
!=
(select count(*) from EMR_ADTAOE_DTL where patient_id = loc.patient_id and facility_id = loc.facility_id and (
(test_id = (select aoe_test_id from lab_order_occ_test_aoe where lab_order_occ_test_id= loct.lab_order_occ_test_id) and trunc(draw_date) like trunc(loc.order_draw_dt))
or (test_id = (select aoe_test_id from lab_order_occ_test_aoe where LAB_ORDER_OCC_TEST_ID= loct.lab_order_occ_test_id) and trunc(draw_date)= trunc(to_date('12-31-2999','mm-dd-yyyy')))
and STATUS = 'Y' and ANSWER is not null)
Execution Plan @ QAT environment
explain plan succeeded.
PLAN_TABLE_OUTPUT
Plan hash value: 2140167730
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
| 0 | SELECT STATEMENT | | 399 | 59451 | 6293 (1)| 00:01:16 |
| 1 | TABLE ACCESS BY INDEX ROWID | PATIENT | 1 | 21 | 2 (0)| 00:00:01 |
|* 2 | INDEX UNIQUE SCAN | PATIENT_PK | 1 | | 1 (0)| 00:00:01 |
| 3 | TABLE ACCESS BY INDEX ROWID | PATIENT | 1 | 11 | 2 (0)| 00:00:01 |
|* 4 | INDEX UNIQUE SCAN | PATIENT_PK | 1 | | 1 (0)| 00:00:01 |
| 5 | TABLE ACCESS BY INDEX ROWID | PATIENT | 1 | 12 | 2 (0)| 00:00:01 |
|* 6 | INDEX UNIQUE SCAN | PATIENT_PK | 1 | | 1 (0)| 00:00:01 |
| 7 | NESTED LOOPS | | 1 | 43 | 5 (0)| 00:00:01 |
| 8 | NESTED LOOPS | | 1 | 29 | 4 (0)| 00:00:01 |
| 9 | NESTED LOOPS | | 1 | 19 | 3 (0)| 00:00:01 |
|* 10 | INDEX UNIQUE SCAN | PATIENT_PK | 1 | 5 | 1 (0)| 00:00:01 |
|* 11 | INDEX RANGE SCAN | PATIENT_FACILITY_MOD_IX_01 | 1 | 14 | 2 (0)| 00:00:01 |
| 12 | TABLE ACCESS BY INDEX ROWID | FACILITY_ACCOUNT_MODALITY | 1 | 10 | 1 (0)| 00:00:01 |
|* 13 | INDEX UNIQUE SCAN | FACILITY_ACCOUNT_MODALITY_PK | 1 | | 0 (0)| 00:00:01 |
| 14 | TABLE ACCESS BY INDEX ROWID | FACILITY_ACCOUNT_DETAIL | 1 | 14 | 1 (0)| 00:00:01 |
|* 15 | INDEX UNIQUE SCAN | FACILITY_ACCOUNT_DETAIL_PK | 1 | | 0 (0)| 00:00:01 |
| 16 | NESTED LOOPS | | 1 | 40 | 5 (0)| 00:00:01 |
| 17 | NESTED LOOPS | | 1 | 29 | 4 (0)| 00:00:01 |
| 18 | NESTED LOOPS | | 1 | 19 | 3 (0)| 00:00:01 |
|* 19 | INDEX UNIQUE SCAN | PATIENT_PK | 1 | 5 | 1 (0)| 00:00:01 |
|* 20 | INDEX RANGE SCAN | PATIENT_FACILITY_MOD_IX_01 | 1 | 14 | 2 (0)| 00:00:01 |
| 21 | TABLE ACCESS BY INDEX ROWID | FACILITY_ACCOUNT_MODALITY | 1 | 10 | 1 (0)| 00:00:01 |
|* 22 | INDEX UNIQUE SCAN | FACILITY_ACCOUNT_MODALITY_PK | 1 | | 0 (0)| 00:00:01 |
| 23 | TABLE ACCESS BY INDEX ROWID | FACILITY_ACCOUNT_DETAIL | 1 | 11 | 1 (0)| 00:00:01 |
|* 24 | INDEX UNIQUE SCAN | FACILITY_ACCOUNT_DETAIL_PK | 1 | | 0 (0)| 00:00:01 |
| 25 | NESTED LOOPS | | 1 | 42 | 5 (0)| 00:00:01 |
| 26 | NESTED LOOPS | | 1 | 29 | 4 (0)| 00:00:01 |
| 27 | NESTED LOOPS | | 1 | 19 | 3 (0)| 00:00:01 |
|* 28 | INDEX UNIQUE SCAN | PATIENT_PK | 1 | 5 | 1 (0)| 00:00:01 |
|* 29 | INDEX RANGE SCAN | PATIENT_FACILITY_MOD_IX_01 | 1 | 14 | 2 (0)| 00:00:01 |
| 30 | TABLE ACCESS BY INDEX ROWID | FACILITY_ACCOUNT_MODALITY | 1 | 10 | 1 (0)| 00:00:01 |
|* 31 | INDEX UNIQUE SCAN | FACILITY_ACCOUNT_MODALITY_PK | 1 | | 0 (0)| 00:00:01 |
| 32 | TABLE ACCESS BY INDEX ROWID | FACILITY_ACCOUNT_DETAIL | 1 | 13 | 1 (0)| 00:00:01 |
|* 33 | INDEX UNIQUE SCAN | FACILITY_ACCOUNT_DETAIL_PK | 1 | | 0 (0)| 00:00:01 |
| 34 | HASH UNIQUE | | 399 | 59451 | 6293 (1)| 00:01:16 |
|* 35 | FILTER | | | | | |
|* 36 | FILTER | | | | | |
|* 37 | HASH JOIN | | 399 | 59451 | 6285 (1)| 00:01:16 |
| 38 | TABLE ACCESS FULL | CORPORATION | 291 | 11640 | 3 (0)| 00:00:01 |
| 39 | NESTED LOOPS | | 399 | 43491 | 6282 (1)| 00:01:16 |
|* 40 | HASH JOIN | | 2113 | 216K| 6281 (1)| 00:01:16 |
| 41 | TABLE ACCESS FULL | TEST_REQUIRED | 1184 | 10656 | 5 (0)| 00:00:01 |
|* 42 | TABLE ACCESS BY INDEX ROWID | LAB_ORDER_OCC_TEST | 8 | 144 | 5 (0)| 00:00:01 |
| 43 | NESTED LOOPS | | 1345 | 126K| 6276 (1)| 00:01:16 |
|* 44 | HASH JOIN | | 170 | 13260 | 5425 (1)| 00:01:06 |
|* 45 | HASH JOIN | | 170 | 8670 | 5403 (1)| 00:01:05 |
|* 46 | TABLE ACCESS BY INDEX ROWID| LAB_ORDER_OCC | 12775 | 336K| 569 (1)| 00:00:07 |
|* 47 | INDEX SKIP SCAN | LAB_ORDER_OCC_IX_07 | 2218 | | 13 (8)| 00:00:01 |
|* 48 | TABLE ACCESS BY INDEX ROWID| ORDER_REQUISITION_HEADER | 56952 | 1334K| 4833 (1)| 00:00:58 |
|* 49 | INDEX SKIP SCAN | ORDER_REQUISITION_HEADER_IX_04 | 4905 | | 1707 (1)| 00:00:21 |
| 50 | TABLE ACCESS FULL | FACILITY | 4252 | 112K| 22 (0)| 00:00:01 |
|* 51 | INDEX RANGE SCAN | LAB_ORDER_OCC_TEST_IX_01 | 8 | | 2 (0)| 00:00:01 |
|* 52 | INDEX RANGE SCAN | INTERFACE_ADT_AOE_MASTER_IX_01 | 1 | 4 | 0 (0)| 00:00:01 |
| 53 | SORT AGGREGATE | | 1 | 12 | | |
|* 54 | TABLE ACCESS BY INDEX ROWID | INTERFACE_ADT_AOE_MASTER | 1 | 12 | 2 (0)| 00:00:01 |
|* 55 | INDEX RANGE SCAN | INTERFACE_ADT_AOE_MASTER_IX_01 | 4 | | 1 (0)| 00:00:01 |
| 56 | TABLE ACCESS BY INDEX ROWID | TEST | 1 | 9 | 2 (0)| 00:00:01 |
|* 57 | INDEX UNIQUE SCAN | TEST_PK | 1 | | 1 (0)| 00:00:01 |
|* 58 | INDEX RANGE SCAN | LAB_ORDER_OCC_TEST_AOE_PK | 1 | 10 | 3 (0)| 00:00:01 |
| 59 | SORT AGGREGATE | | 1 | 29 | | |
|* 60 | FILTER | | | | | |
|* 61 | TABLE ACCESS BY INDEX ROWID | EMR_ADTAOE_DTL | 1 | 29 | 30 (0)| 00:00:01 |
|* 62 | INDEX RANGE SCAN | EMR_ADTAOE_DTL_IX_01 | 174 | | 3 (0)| 00:00:01 |
|* 63 | INDEX RANGE SCAN | LAB_ORDER_OCC_TEST_AOE_PK | 1 | 10 | 3 (0)| 00:00:01 |
|* 64 | INDEX RANGE SCAN | LAB_ORDER_OCC_TEST_AOE_PK | 1 | 10 | 3 (0)| 00:00:01 |
Query Block Name / Object Alias (identified by operation id):
1 - SEL$2 / P@SEL$2
2 - SEL$2 / P@SEL$2
3 - SEL$3 / P@SEL$3
4 - SEL$3 / P@SEL$3
5 - SEL$4 / P@SEL$4
6 - SEL$4 / P@SEL$4
7 - SEL$5
10 - SEL$5 / P@SEL$5
11 - SEL$5 / PFM@SEL$5
12 - SEL$5 / FAM@SEL$5
13 - SEL$5 / FAM@SEL$5
14 - SEL$5 / FAD@SEL$5
15 - SEL$5 / FAD@SEL$5
16 - SEL$6
19 - SEL$6 / P@SEL$6
20 - SEL$6 / PFM@SEL$6
21 - SEL$6 / FAM@SEL$6
22 - SEL$6 / FAM@SEL$6
23 - SEL$6 / FAD@SEL$6
24 - SEL$6 / FAD@SEL$6
25 - SEL$7
28 - SEL$7 / P@SEL$7
29 - SEL$7 / PFM@SEL$7
30 - SEL$7 / FAM@SEL$7
31 - SEL$7 / FAM@SEL$7
32 - SEL$7 / FAD@SEL$7
33 - SEL$7 / FAD@SEL$7
34 - SEL$AA3B83ED
38 - SEL$AA3B83ED / C@SEL$1
41 - SEL$AA3B83ED / TEST_REQUIRED@SEL$8
42 - SEL$AA3B83ED / LOCT@SEL$1Hi Karthick,
Thanks for the response. The suggestion is really good. But we have some tables accessed like "lab_order_occ" which size is more than 8GB also having no partitions. If I'll ask for altering DB structure, this will be finalized not less than 6 months. Please do have a look at the plan now. It's generating more cost.
explain plan succeeded.
PLAN_TABLE_OUTPUT
Plan hash value: 2523654849
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
| 0 | SELECT STATEMENT | | 1057 | 293K| 25324 (2)| 00:05:04 |
|* 1 | FILTER | | | | | |
|* 2 | HASH JOIN RIGHT SEMI | | 1057 | 293K| 25317 (2)| 00:05:04 |
| 3 | VIEW | VW_NSO_1 | 224 | 2912 | 5 (0)| 00:00:01 |
|* 4 | FILTER | | | | | |
| 5 | NESTED LOOPS | | 224 | 2912 | 5 (0)| 00:00:01 |
| 6 | TABLE ACCESS FULL | TEST_REQUIRED | 1184 | 10656 | 5 (0)| 00:00:01 |
|* 7 | INDEX RANGE SCAN | INTERFACE_ADT_AOE_MASTER_IX_01 | 1 | 4 | 0 (0)| 00:00:01 |
|* 8 | TABLE ACCESS BY INDEX ROWID | LAB_ORDER_OCC_TEST | 8 | 144 | 5 (0)| 00:00:01 |
| 9 | NESTED LOOPS | | 1345 | 355K| 25311 (2)| 00:05:04 |
|* 10 | HASH JOIN | | 170 | 43010 | 24460 (2)| 00:04:54 |
| 11 | TABLE ACCESS FULL | CORPORATION | 291 | 11640 | 3 (0)| 00:00:01 |
|* 12 | HASH JOIN | | 170 | 36210 | 24457 (2)| 00:04:54 |
| 13 | NESTED LOOPS OUTER | | 170 | 31620 | 24434 (2)| 00:04:54 |
|* 14 | HASH JOIN | | 170 | 14960 | 5403 (1)| 00:01:05 |
|* 15 | TABLE ACCESS BY INDEX ROWID | LAB_ORDER_OCC | 12775 | 598K| 569 (1)| 00:00:07 |
|* 16 | INDEX SKIP SCAN | LAB_ORDER_OCC_IX_07 | 2218 | | 13 (8)| 00:00:01 |
|* 17 | TABLE ACCESS BY INDEX ROWID | ORDER_REQUISITION_HEADER | 56952 | 2224K| 4833 (1)| 00:00:58 |
|* 18 | INDEX SKIP SCAN | ORDER_REQUISITION_HEADER_IX_04 | 4905 | | 1707 (1)| 00:00:21 |
| 19 | VIEW PUSHED PREDICATE | | 1 | 98 | 112 (2)| 00:00:02 |
|* 20 | HASH JOIN | | 93 | 8835 | 112 (2)| 00:00:02 |
|* 21 | HASH JOIN | | 93 | 6231 | 56 (2)| 00:00:01 |
|* 22 | HASH JOIN | | 93 | 5301 | 48 (3)| 00:00:01 |
| 23 | NESTED LOOPS | | 68 | 2924 | 44 (0)| 00:00:01 |
| 24 | TABLE ACCESS BY INDEX ROWID| PATIENT | 1 | 34 | 2 (0)| 00:00:01 |
|* 25 | INDEX UNIQUE SCAN | PATIENT_PK | 1 | | 1 (0)| 00:00:01 |
| 26 | TABLE ACCESS BY INDEX ROWID| LAB_ORDER_OCC | 68 | 612 | 42 (0)| 00:00:01 |
|* 27 | INDEX RANGE SCAN | LAB_ORDER_OCC_IX_02 | 53 | | 2 (0)| 00:00:01 |
|* 28 | INDEX RANGE SCAN | PATIENT_FACILITY_MOD_IX_01 | 111 | 1554 | 3 (0)| 00:00:01 |
| 29 | TABLE ACCESS FULL | FACILITY_ACCOUNT_MODALITY | 9159 | 91590 | 8 (0)| 00:00:01 |
| 30 | TABLE ACCESS FULL | FACILITY_ACCOUNT_DETAIL | 7266 | 198K| 55 (0)| 00:00:01 |
| 31 | TABLE ACCESS FULL | FACILITY | 4252 | 112K| 22 (0)| 00:00:01 |
|* 32 | INDEX RANGE SCAN | LAB_ORDER_OCC_TEST_IX_01 | 8 | | 2 (0)| 00:00:01 |
| 33 | SORT AGGREGATE | | 1 | 12 | | |
|* 34 | TABLE ACCESS BY INDEX ROWID | INTERFACE_ADT_AOE_MASTER | 1 | 12 | 2 (0)| 00:00:01 |
|* 35 | INDEX RANGE SCAN | INTERFACE_ADT_AOE_MASTER_IX_01 | 4 | | 1 (0)| 00:00:01 |
| 36 | TABLE ACCESS BY INDEX ROWID | TEST | 1 | 9 | 2 (0)| 00:00:01 |
|* 37 | INDEX UNIQUE SCAN | TEST_PK | 1 | | 1 (0)| 00:00:01 |
|* 38 | INDEX RANGE SCAN | LAB_ORDER_OCC_TEST_AOE_PK | 1 | 10 | 3 (0)| 00:00:01 |
| 39 | SORT AGGREGATE | | 1 | 29 | | |
|* 40 | FILTER | | | | | |
|* 41 | TABLE ACCESS BY INDEX ROWID | EMR_ADTAOE_DTL | 1 | 29 | 30 (0)| 00:00:01 |
|* 42 | INDEX RANGE SCAN | EMR_ADTAOE_DTL_IX_01 | 174 | | 3 (0)| 00:00:01 |
|* 43 | INDEX RANGE SCAN | LAB_ORDER_OCC_TEST_AOE_PK | 1 | 10 | 3 (0)| 00:00:01 |
Query Block Name / Object Alias (identified by operation id):
1 - SEL$19EEE7EA
3 - SEL$9DB3EFF9 / VW_NSO_1@SEL$19EEE7EA
4 - SEL$9DB3EFF9
6 - SEL$9DB3EFF9 / TEST_REQUIRED@SEL$3
7 - SEL$9DB3EFF9 / INTERFACE_ADT_AOE_MASTER@SEL$4
8 - SEL$19EEE7EA / LOCT@SEL$1
11 - SEL$19EEE7EA / C@SEL$1
15 - SEL$19EEE7EA / LOC@SEL$1
16 - SEL$19EEE7EA / LOC@SEL$1
17 - SEL$19EEE7EA / ORD@SEL$1
18 - SEL$19EEE7EA / ORD@SEL$1
19 - SEL$639F1A6F / P@SEL$1
20 - SEL$639F1A6F
24 - SEL$639F1A6F / P@SEL$2
25 - SEL$639F1A6F / P@SEL$2
26 - SEL$639F1A6F / LOC@SEL$2
27 - SEL$639F1A6F / LOC@SEL$2
28 - SEL$639F1A6F / PFM@SEL$2
29 - SEL$639F1A6F / FAM@SEL$2
30 - SEL$639F1A6F / FAD@SEL$2
31 - SEL$19EEE7EA / F@SEL$1
32 - SEL$19EEE7EA / LOCT@SEL$1
33 - SEL$5
34 - SEL$5 / INTERFACE_ADT_AOE_MASTER@SEL$5
35 - SEL$5 / INTERFACE_ADT_AOE_MASTER@SEL$5
36 - SEL$6 / TEST@SEL$6
37 - SEL$6 / TEST@SEL$6
38 - SEL$7 / LAB_ORDER_OCC_TEST_AOE@SEL$7
39 - SEL$8
41 - SEL$8 / EMR_ADTAOE_DTL@SEL$8
42 - SEL$8 / EMR_ADTAOE_DTL@SEL$8
43 - SEL$9 / LAB_ORDER_OCC_TEST_AOE@SEL$9
Predicate Information (identified by operation id):
1 - filter( (SELECT /*+ */ COUNT(*) FROM "KORUS2XPROD_OWN"."INTERFACE_ADT_AOE_MASTER"
"INTERFACE_ADT_AOE_MASTER" WHERE "TEST_CODE"= (SELECT /*+ */ "TEST_CODE" FROM "KORUS2XPROD_OWN"."TEST" "TEST"
WHERE "TEST_ID"= (SELECT /*+ */ "AOE_TEST_ID" FROM "KORUS2XPROD_OWN"."LAB_ORDER_OCC_TEST_AOE"
"LAB_ORDER_OCC_TEST_AOE" WHERE "LAB_ORDER_OCC_TEST_ID"=:B1)) AND "SOURCE_SYSTEM"=:B2)<> (SELECT /*+ */ COUNT(*)
FROM "KORUS2XPROD_OWN"."EMR_ADTAOE_DTL" "EMR_ADTAOE_DTL" WHERE "TEST_ID"= (SELECT /*+ */ "AOE_TEST_ID" FROM
"KORUS2XPROD_OWN"."LAB_ORDER_OCC_TEST_AOE" "LAB_ORDER_OCC_TEST_AOE" WHERE "LAB_ORDER_OCC_TEST_ID"=:B3) AND
"PATIENT_ID"=:B4 AND "FACILITY_ID"=:B5 AND "STATUS"='Y' AND (TO_CHAR(TRUNC(INTERNAL_FUNCTION("DRAW_DATE"))) LIKE
TO_CHAR(TRUNC(:B6)) OR TRUNC(INTERNAL_FUNCTION("DRAW_DATE"))=TO_DATE(' 2999-12-31 00:00:00', 'syyyy-mm-dd
hh24:mi:ss')) AND "ANSWER" IS NOT NULL))
2 - access("LOCT"."TEST_ID"="$nso_col_1")
4 - filter(TRUNC(SYSDATE@!)-7<=TRUNC(SYSDATE@!))
7 - access("REQUIRED_TEST_CODE"="TEST_CODE")
8 - filter("LOCT"."STATUS"<>'R')
10 - access("F"."CORPORATION_ID"="C"."CORPORATION_ID")
12 - access("LOC"."FACILITY_ID"="F"."FACILITY_ID")
14 - access("ORD"."PATIENT_ID"="LOC"."PATIENT_ID" AND "ORD"."FACILITY_ID"="LOC"."FACILITY_ID" AND
"ORD"."DRAW_DT"="LOC"."ORDER_DRAW_DT")
15 - filter("LOC"."PATIENT_ID" IS NOT NULL AND "LOC"."MSG_SENT_TO_LAB_YN"='Y')
16 - access("LOC"."ORDER_DRAW_DT">=TRUNC(SYSDATE@!)-7 AND "LOC"."STATUS"='A' AND
"LOC"."ORDER_DRAW_DT"<=TRUNC(SYSDATE@!))
filter("LOC"."STATUS"='A')
17 - filter("ORD"."PATIENT_ID" IS NOT NULL)
18 - access("ORD"."DRAW_DT">=TRUNC(SYSDATE@!)-7 AND "ORD"."DRAW_DT"<=TRUNC(SYSDATE@!))
filter("ORD"."DRAW_DT">=TRUNC(SYSDATE@!)-7 AND "ORD"."DRAW_DT"<=TRUNC(SYSDATE@!))
20 - access("FAM"."FACILITY_ACCOUNT_DETAIL_ID"="FAD"."FACILITY_ACCOUNT_DETAIL_ID")
21 - access("PFM"."FACILITY_ACCOUNT_MODALITY_ID"="FAM"."FACILITY_ACCOUNT_MODALITY_ID")
22 - access("PFM"."FACILITY_ID"="LOC"."FACILITY_ID")
25 - access("P"."PATIENT_ID"="LOC"."PATIENT_ID")
27 - access("LOC"."PATIENT_ID"="LOC"."PATIENT_ID") -
How to improve the query performance or tune query from Explain Plan
Hi
The following is my explain plan for sql query. (The plan is generated by Toad v9.7). How to fix the query?
SELECT STATEMENT ALL_ROWSCost: 4,160 Bytes: 25,296 Cardinality: 204
8 NESTED LOOPS Cost: 3 Bytes: 54 Cardinality: 1
5 NESTED LOOPS Cost: 2 Bytes: 23 Cardinality: 1
2 TABLE ACCESS BY INDEX ROWID TABLE AR.RA_CUSTOMER_TRX_ALL Cost: 1 Bytes: 13 Cardinality: 1
1 INDEX UNIQUE SCAN INDEX (UNIQUE) AR.RA_CUSTOMER_TRX_U1 Cost: 1 Cardinality: 1
4 TABLE ACCESS BY INDEX ROWID TABLE AR.HZ_CUST_ACCOUNTS Cost: 1 Bytes: 10 Cardinality: 1
3 INDEX UNIQUE SCAN INDEX (UNIQUE) AR.HZ_CUST_ACCOUNTS_U1 Cost: 1 Cardinality: 1
7 TABLE ACCESS BY INDEX ROWID TABLE AR.HZ_PARTIES Cost: 1 Bytes: 31 Cardinality: 1
6 INDEX UNIQUE SCAN INDEX (UNIQUE) AR.HZ_PARTIES_U1 Cost: 1 Cardinality: 1
10 TABLE ACCESS BY INDEX ROWID TABLE AR.RA_CUSTOMER_TRX_ALL Cost: 1 Bytes: 12 Cardinality: 1
9 INDEX UNIQUE SCAN INDEX (UNIQUE) AR.RA_CUSTOMER_TRX_U1 Cost: 1 Cardinality: 1
15 NESTED LOOPS Cost: 2 Bytes: 29 Cardinality: 1
12 TABLE ACCESS BY INDEX ROWID TABLE AR.RA_CUSTOMER_TRX_ALL Cost: 1 Bytes: 12 Cardinality: 1
11 INDEX UNIQUE SCAN INDEX (UNIQUE) AR.RA_CUSTOMER_TRX_U1 Cost: 1 Cardinality: 1
14 TABLE ACCESS BY INDEX ROWID TABLE ONT.OE_ORDER_HEADERS_ALL Cost: 1 Bytes: 17 Cardinality: 1
13 INDEX RANGE SCAN INDEX (UNIQUE) ONT.OE_ORDER_HEADERS_U2 Cost: 1 Cardinality: 1
21 FILTER
16 TABLE ACCESS FULL TABLE ONT.OE_TRANSACTION_TYPES_TL Cost: 2 Bytes: 1,127 Cardinality: 49
20 NESTED LOOPS Cost: 2 Bytes: 21 Cardinality: 1
18 TABLE ACCESS BY INDEX ROWID TABLE AR.RA_CUSTOMER_TRX_ALL Cost: 1 Bytes: 12 Cardinality: 1
17 INDEX UNIQUE SCAN INDEX (UNIQUE) AR.RA_CUSTOMER_TRX_U1 Cost: 1 Cardinality: 1
19 INDEX RANGE SCAN INDEX (UNIQUE) ONT.OE_ORDER_HEADERS_U2 Cost: 1 Bytes: 9 Cardinality: 1
23 TABLE ACCESS BY INDEX ROWID TABLE AR.RA_CUSTOMER_TRX_ALL Cost: 1 Bytes: 12 Cardinality: 1
22 INDEX UNIQUE SCAN INDEX (UNIQUE) AR.RA_CUSTOMER_TRX_U1 Cost: 1 Cardinality: 1
45 NESTED LOOPS Cost: 4,160 Bytes: 25,296 Cardinality: 204
42 NESTED LOOPS Cost: 4,150 Bytes: 23,052 Cardinality: 204
38 NESTED LOOPS Cost: 4,140 Bytes: 19,992 Cardinality: 204
34 NESTED LOOPS Cost: 4,094 Bytes: 75,850 Cardinality: 925
30 NESTED LOOPS Cost: 3,909 Bytes: 210,843 Cardinality: 3,699
26 PARTITION LIST ALL Cost: 2,436 Bytes: 338,491 Cardinality: 14,717 Partition #: 29 Partitions accessed #1 - #18
25 TABLE ACCESS BY LOCAL INDEX ROWID TABLE XLA.XLA_AE_HEADERS Cost: 2,436 Bytes: 338,491 Cardinality: 14,717 Partition #: 29 Partitions accessed #1 - #18
24 INDEX SKIP SCAN INDEX XLA.XLA_AE_HEADERS_N1 Cost: 264 Cardinality: 1,398,115 Partition #: 29 Partitions accessed #1 - #18
29 PARTITION LIST ITERATOR Cost: 1 Bytes: 34 Cardinality: 1 Partition #: 32
28 TABLE ACCESS BY LOCAL INDEX ROWID TABLE XLA.XLA_AE_LINES Cost: 1 Bytes: 34 Cardinality: 1 Partition #: 32
27 INDEX RANGE SCAN INDEX (UNIQUE) XLA.XLA_AE_LINES_U1 Cost: 1 Cardinality: 1 Partition #: 32
33 PARTITION LIST ITERATOR Cost: 1 Bytes: 25 Cardinality: 1 Partition #: 35
32 TABLE ACCESS BY LOCAL INDEX ROWID TABLE XLA.XLA_DISTRIBUTION_LINKS Cost: 1 Bytes: 25 Cardinality: 1 Partition #: 35
31 INDEX RANGE SCAN INDEX XLA.XLA_DISTRIBUTION_LINKS_N3 Cost: 1 Cardinality: 1 Partition #: 35
37 PARTITION LIST SINGLE Cost: 1 Bytes: 16 Cardinality: 1 Partition #: 38
36 TABLE ACCESS BY LOCAL INDEX ROWID TABLE XLA.XLA_EVENTS Cost: 1 Bytes: 16 Cardinality: 1 Partition #: 39 Partitions accessed #2
35 INDEX UNIQUE SCAN INDEX (UNIQUE) XLA.XLA_EVENTS_U1 Cost: 1 Cardinality: 1 Partition #: 40 Partitions accessed #2
41 PARTITION LIST SINGLE Cost: 1 Bytes: 15 Cardinality: 1 Partition #: 41
40 TABLE ACCESS BY LOCAL INDEX ROWID TABLE XLA.XLA_TRANSACTION_ENTITIES Cost: 1 Bytes: 15 Cardinality: 1 Partition #: 42 Partitions accessed #2
39 INDEX UNIQUE SCAN INDEX (UNIQUE) XLA.XLA_TRANSACTION_ENTITIES_U1 Cost: 1 Cardinality: 1 Partition #: 43 Partitions accessed #2
44 TABLE ACCESS BY INDEX ROWID TABLE GL.GL_CODE_COMBINATIONS Cost: 1 Bytes: 11 Cardinality: 1
43 INDEX UNIQUE SCAN INDEX (UNIQUE) GL.GL_CODE_COMBINATIONS_U1 Cost: 1 Cardinality: 1damorgan wrote:
Tuning is NOT about reducing the cost of i/o.
i/o is only one of many contributors to cost and only one of many contributors to waits.
Any time you would like to explore this further run this code:
SELECT 1 FROM dual
WHERE regexp_like(' ','^*[ ]*a');but not on a production box because you are going to experience an extreme tuning event with zero i/o.
And when I say "extreme" I mean "EXTREME!"
You've been warned.I think you just need a faster server.
SQL> set autotrace traceonly statistics
SQL> set timing on
SQL> select 1 from dual
2 where
3 regexp_like (' ','^*[ ]*a');
no rows selected
Elapsed: 00:00:00.00
Statistics
1 recursive calls
0 db block gets
0 consistent gets
0 physical reads
0 redo size
243 bytes sent via SQL*Net to client
349 bytes received via SQL*Net from client
1 SQL*Net roundtrips to/from client
0 sorts (memory)
0 sorts (disk)
0 rows processedRepeated from an Oracle 10.2.0.x instance:
SQL> SELECT DISTINCT SID FROM V$MYSTAT;
SID
310
SQL> ALTER SESSION SET EVENTS '10053 TRACE NAME CONTEXT FOREVER, LEVEL 1';
Session altered.
SQL> select 1 from dual
2 where
3 regexp_like (' ','^*[ ]*a');The session is hung. Wait a little while and connect to the database using a different session:
COLUMN STAT_NAME FORMAT A35 TRU
SET PAGESIZE 200
SELECT
STAT_NAME,
VALUE
FROM
V$SESS_TIME_MODEL
WHERE
SID=310;
STAT_NAME VALUE
DB time 9247
DB CPU 9247
background elapsed time 0
background cpu time 0
sequence load elapsed time 0
parse time elapsed 6374
hard parse elapsed time 5997
sql execute elapsed time 2939
connection management call elapsed 1660
failed parse elapsed time 0
failed parse (out of shared memory) 0
hard parse (sharing criteria) elaps 0
hard parse (bind mismatch) elapsed 0
PL/SQL execution elapsed time 95
inbound PL/SQL rpc elapsed time 0
PL/SQL compilation elapsed time 0
Java execution elapsed time 0
repeated bind elapsed time 48
RMAN cpu time (backup/restore) 0Seems to be using a bit of time for the hard parse (hard parse elapsed time). Wait a little while, then re-execute the query:
STAT_NAME VALUE
DB time 9247
DB CPU 9247
background elapsed time 0
background cpu time 0
sequence load elapsed time 0
parse time elapsed 6374
hard parse elapsed time 5997
sql execute elapsed time 2939
connection management call elapsed 1660
failed parse elapsed time 0
failed parse (out of shared memory) 0
hard parse (sharing criteria) elaps 0
hard parse (bind mismatch) elapsed 0
PL/SQL execution elapsed time 95
inbound PL/SQL rpc elapsed time 0
PL/SQL compilation elapsed time 0
Java execution elapsed time 0
repeated bind elapsed time 48
RMAN cpu time (backup/restore) 0The session is not reporting additional CPU usage or parse time.
Let's check one of the session's statistics:
SELECT
SS.VALUE
FROM
V$SESSTAT SS,
V$STATNAME SN
WHERE
SN.NAME='consistent gets'
AND SN.STATISTIC#=SS.STATISTIC#
AND SS.SID=310;
VALUE
163Not many consistent gets after 20+ minutes.
Let's take a look at the plan:
SQL> SELECT SQL_ID,CHILD_NUMBER FROM V$SQL WHERE SQL_TEXT LIKE 'select 1 from du
al%';
SQL_ID CHILD_NUMBER
04mpgrzhsv72w 0
SELECT * FROM TABLE(DBMS_XPLAN.DISPLAY_CURSOR('04mpgrzhsv72w',0,'TYPICAL'))
select 1 from dual where regexp_like (' ','^*[ ]*a')
NOTE: cannot fetch plan for SQL_ID: 04mpgrzhsv72w, CHILD_NUMBER: 0
Please verify value of SQL_ID and CHILD_NUMBER;
It could also be that the plan is no longer in cursor cache (check v$sql_p
lan)No plan...
Let's take a look at the 10053 trace file:
Registered qb: SEL$1 0x19157f38 (PARSER)
signature (): qb_name=SEL$1 nbfros=1 flg=0
fro(0): flg=4 objn=258 hint_alias="DUAL"@"SEL$1"
Predicate Move-Around (PM)
PM: Considering predicate move-around in SEL$1 (#0).
PM: Checking validity of predicate move-around in SEL$1 (#0).
CBQT: Validity checks failed for 7uqx4guu04x3g.
CVM: Considering view merge in query block SEL$1 (#0)
CBQT: Validity checks failed for 7uqx4guu04x3g.
Subquery Unnest
SU: Considering subquery unnesting in query block SEL$1 (#0)
Set-Join Conversion (SJC)
SJC: Considering set-join conversion in SEL$1 (#0).
Predicate Move-Around (PM)
PM: Considering predicate move-around in SEL$1 (#0).
PM: Checking validity of predicate move-around in SEL$1 (#0).
PM: PM bypassed: Outer query contains no views.
FPD: Considering simple filter push in SEL$1 (#0)
FPD: Current where clause predicates in SEL$1 (#0) :
REGEXP_LIKE (' ','^*[ ]*a')
kkogcp: try to generate transitive predicate from check constraints for SEL$1 (#0)
predicates with check contraints: REGEXP_LIKE (' ','^*[ ]*a')
after transitive predicate generation: REGEXP_LIKE (' ','^*[ ]*a')
finally: REGEXP_LIKE (' ','^*[ ]*a')
apadrv-start: call(in-use=592, alloc=16344), compile(in-use=37448, alloc=42256)
kkoqbc-start
: call(in-use=592, alloc=16344), compile(in-use=38336, alloc=42256)
kkoqbc-subheap (create addr=000000001915C238)Looks like the query never had a chance to start executing - it is still parsing after 20 minutes.
I am not sure that this is a good example - the query either executes very fast, or never has a chance to start executing. But, it might still make your point physical I/O is not always the problem when performance problems are experienced.
Charles Hooper
IT Manager/Oracle DBA
K&M Machine-Fabricating, Inc. -
Please help me to increase the performance of the query
Hello
I am not an oracle expert or developer and i have a problem to resolve.
Below is the query and explaiation plan and seeking the help to improve the performance of the query.
Our Analysis,
The query runs good,takes less one minute and fetches the results but during peak time it takes 8 minutes
Require anyone suggestion's to improve the query.
The query is generated from the Microsft dll so we dont have SQL code and require some help on tuning the tables.
If tuning the query improves then also fine please suggest for that also.
Enviroment: Solaris 8
DB : oracle 9i
(SELECT vw.dispapptobjid, vw.custsiteobjid, vw.emplastname, vw.empfirstname,
vw.scheduledonsite AS starttime, vw.appttype, vw.latestart,
vw.endtime, vw.typetitle, vw.empobjid, vw.latitude, vw.longitude,
vw.workduration AS DURATION, vw.dispatchtype, vw.availability
FROM ora_appt_disp_view vw
WHERE ( ( vw.starttime >=
TO_DATE ('2/12/2007 4:59 PM', 'MM/DD/YYYY HH12:MI AM')
AND vw.starttime <
TO_DATE ('2/21/2007 3:59 PM', 'MM/DD/YYYY HH12:MI AM')
OR vw.endtime >
TO_DATE ('2/12/2007 4:59 PM', 'MM/DD/YYYY HH12:MI AM')
AND vw.endtime <=
TO_DATE ('2/21/2007 3:59 PM', 'MM/DD/YYYY HH12:MI AM')
OR ( vw.starttime <=
TO_DATE ('2/12/2007 4:59 PM', 'MM/DD/YYYY HH12:MI AM')
AND vw.endtime >=
TO_DATE ('2/21/2007 3:59 PM', 'MM/DD/YYYY HH12:MI AM')
UNION
(SELECT 0 AS dispapptobjid, emp.emp_physical_site2site AS custsiteobjid,
emp.last_name AS emplastname, emp.first_name AS empfirstname,
TO_DATE ('1/1/3000', 'MM/DD/YYYY') AS starttime, 'E' AS appttype,
NULL AS latestart, NULL AS endtime, '' AS typetitle,
emp.objid AS empobjid, 0 AS latitude, 0 AS longitude, 0 AS DURATION,
'' AS dispatchtype, 0 AS availability
FROM table_employee emp, table_user usr
WHERE emp.employee2user = usr.objid AND emp.field_eng = 1 AND usr.status = 1)
ORDER BY empobjid, starttime, endtime DESC
Operation Object Name Rows Bytes Cost Object Node In/Out PStart PStop
SELECT STATEMENT Optimizer Mode=HINT: ALL_ROWS 23 K 11312
SORT UNIQUE 23 K 3 M 11140
UNION-ALL
VIEW ORA_APPT_DISP_VIEW 17 K 3 M 10485
UNION-ALL
CONCATENATION
NESTED LOOPS OUTER 68 24 K 437
NESTED LOOPS 68 23 K 369
NESTED LOOPS OUTER 68 25 K 505
NESTED LOOPS OUTER 68 24 K 505
NESTED LOOPS 68 23 K 369
NESTED LOOPS 68 22 K 369
NESTED LOOPS OUTER 68 22 K 369
NESTED LOOPS 19 6 K 312
NESTED LOOPS 19 5 K 312
HASH JOIN 19 5 K 293
NESTED LOOPS 19 5 K 274
NESTED LOOPS 19 4 K 236
NESTED LOOPS 19 4 K 198
NESTED LOOPS OUTER 19 3 K 160
NESTED LOOPS OUTER 19 3 K 160
NESTED LOOPS OUTER 19 4 K 160
NESTED LOOPS OUTER 19 1 K 103
NESTED LOOPS OUTER 19 2 K 103
NESTED LOOPS OUTER 19 2 K 103
TABLE ACCESS BY INDEX ROWID TABLE_DISPTCHFE 19 1 K 46
INDEX RANGE SCAN GSA_SCHED_REPAIR 44 3
TABLE ACCESS BY INDEX ROWID TABLE_COMMIT_LOG 1 22
INDEX RANGE SCAN GSA_COMDFE 1 2
TABLE ACCESS BY INDEX ROWID TABLE_COMMIT_LOG 1 22
INDEX RANGE SCAN GSA_COMDFE 1 2
TABLE ACCESS BY INDEX ROWID TABLE_COMMIT_LOG 1 22 3
INDEX RANGE SCAN GSA_COMDFE 1 2
TABLE ACCESS BY INDEX ROWID TABLE_COMMIT_LOG 1 28
INDEX RANGE SCAN IND_CASE_COMMIT2CASE 2 2
TABLE ACCESS BY INDEX ROWID TABLE_COMMIT_LOG 1 28
INDEX RANGE SCAN IND_CASE_COMMIT2CASE 2 2
TABLE ACCESS BY INDEX ROWID TABLE_COMMIT_LOG 1 28 3
INDEX RANGE SCAN IND_CASE_COMMIT2CASE 2 2
TABLE ACCESS BY INDEX ROWID TABLE_CASE 1 30 2
INDEX UNIQUE SCAN CASE_OBJINDEX 1 1
TABLE ACCESS BY INDEX ROWID TABLE_SITE 1 12 2
INDEX UNIQUE SCAN SITE_OBJINDEX 1 1
TABLE ACCESS BY INDEX ROWID TABLE_ADDRESS 1 12 2
INDEX UNIQUE SCAN ADDRESS_OBJINDEX 1 1
TABLE ACCESS FULL TABLE_EMPLOYEE 1 34 1
INDEX UNIQUE SCAN SITE_OBJINDEX 1 6 1
INDEX UNIQUE SCAN USER_OBJINDEX 1 6
TABLE ACCESS BY INDEX ROWID TABLE_X_GSA_TIME_STAMPS 4 48 3
INDEX RANGE SCAN GSAIDX_TS2DISP 1 2
INDEX UNIQUE SCAN GBST_ELM_OBJINDEX 1 6
INDEX UNIQUE SCAN GBST_ELM_OBJINDEX 1 6
TABLE ACCESS BY INDEX ROWID TABLE_MOD_LEVEL 1 12 1
INDEX UNIQUE SCAN MOD_LEVEL_OBJINDEX 1
INDEX UNIQUE SCAN PART_NUM_OBJINDEX 1 6
INDEX UNIQUE SCAN GBST_ELM_OBJINDEX 1 6
INDEX UNIQUE SCAN SUBCASE_OBJINDX 1 6 1
NESTED LOOPS OUTER 68 25 K 505
NESTED LOOPS OUTER 68 24 K 505
NESTED LOOPS OUTER 68 24 K 437
NESTED LOOPS 68 23 K 369
NESTED LOOPS 68 23 K 369
NESTED LOOPS 68 22 K 369
NESTED LOOPS OUTER 68 22 K 369
NESTED LOOPS 19 6 K 312
NESTED LOOPS 19 5 K 312
NESTED LOOPS 19 5 K 293
NESTED LOOPS 19 5 K 274
NESTED LOOPS 19 4 K 236
NESTED LOOPS 19 4 K 198
NESTED LOOPS OUTER 19 4 K 160
NESTED LOOPS OUTER 19 3 K 160
NESTED LOOPS OUTER 19 3 K 160
NESTED LOOPS OUTER 19 2 K 103
NESTED LOOPS OUTER 19 2 K 103
NESTED LOOPS OUTER 19 1 K 103
TABLE ACCESS BY INDEX ROWID TABLE_DISPTCHFE 19 1 K 46
INDEX RANGE SCAN GSA_SCHED_REPAIR 44 3
TABLE ACCESS BY INDEX ROWID TABLE_COMMIT_LOG 1 22 3
INDEX RANGE SCAN GSA_COMDFE 1 2
TABLE ACCESS BY INDEX ROWID TABLE_COMMIT_LOG 1 22
INDEX RANGE SCAN GSA_COMDFE 1 2
TABLE ACCESS BY INDEX ROWID TABLE_COMMIT_LOG 1 22
INDEX RANGE SCAN GSA_COMDFE 1 2
TABLE ACCESS BY INDEX ROWID TABLE_COMMIT_LOG 1 28 3
INDEX RANGE SCAN IND_CASE_COMMIT2CASE 2 2
TABLE ACCESS BY INDEX ROWID TABLE_COMMIT_LOG 1 28
INDEX RANGE SCAN IND_CASE_COMMIT2CASE 2 2
TABLE ACCESS BY INDEX ROWID TABLE_COMMIT_LOG 1 28
INDEX RANGE SCAN IND_CASE_COMMIT2CASE 2 2
TABLE ACCESS BY INDEX ROWID TABLE_CASE 1 30 2
INDEX UNIQUE SCAN CASE_OBJINDEX 1 1
TABLE ACCESS BY INDEX ROWID TABLE_SITE 1 12 2
INDEX UNIQUE SCAN SITE_OBJINDEX 1 1
TABLE ACCESS BY INDEX ROWID TABLE_ADDRESS 1 12 2
INDEX UNIQUE SCAN ADDRESS_OBJINDEX 1 1
TABLE ACCESS BY INDEX ROWID TABLE_EMPLOYEE 1 34 1
INDEX UNIQUE SCAN EMPLOYEE_OBJINDEX 1
INDEX UNIQUE SCAN SITE_OBJINDEX 1 6 1
INDEX UNIQUE SCAN USER_OBJINDEX 1 6
TABLE ACCESS BY INDEX ROWID TABLE_X_GSA_TIME_STAMPS 4 48 3
INDEX RANGE SCAN GSAIDX_TS2DISP 1 2
INDEX UNIQUE SCAN GBST_ELM_OBJINDEX 1 6
INDEX UNIQUE SCAN GBST_ELM_OBJINDEX 1 6
INDEX UNIQUE SCAN GBST_ELM_OBJINDEX 1 6
INDEX UNIQUE SCAN SUBCASE_OBJINDX 1 6 1
TABLE ACCESS BY INDEX ROWID TABLE_MOD_LEVEL 1 12 1
INDEX UNIQUE SCAN MOD_LEVEL_OBJINDEX 1
INDEX UNIQUE SCAN PART_NUM_OBJINDEX 1 6
NESTED LOOPS OUTER 68 25 K 505
NESTED LOOPS OUTER 68 24 K 505
NESTED LOOPS OUTER 68 24 K 437
NESTED LOOPS 68 23 K 369
NESTED LOOPS 68 23 K 369
NESTED LOOPS 68 22 K 369
NESTED LOOPS OUTER 68 22 K 369
NESTED LOOPS 19 6 K 312
NESTED LOOPS 19 5 K 312
NESTED LOOPS 19 5 K 293
NESTED LOOPS 19 5 K 274
NESTED LOOPS 19 4 K 236
NESTED LOOPS 19 4 K 198
NESTED LOOPS OUTER 19 4 K 160
NESTED LOOPS OUTER 19 3 K 160
NESTED LOOPS OUTER 19 3 K 160
NESTED LOOPS OUTER 19 2 K 103
NESTED LOOPS OUTER 19 2 K 103
NESTED LOOPS OUTER 19 1 K 103
TABLE ACCESS BY INDEX ROWID TABLE_DISPTCHFE 19 1 K 46
INDEX RANGE SCAN GSA_REQ_ETA 44 3
TABLE ACCESS BY INDEX ROWID TABLE_COMMIT_LOG 1 22 3
INDEX RANGE SCAN GSA_COMDFE 1 2
TABLE ACCESS BY INDEX ROWID TABLE_COMMIT_LOG 1 22
INDEX RANGE SCAN GSA_COMDFE 1 2
TABLE ACCESS BY INDEX ROWID TABLE_COMMIT_LOG 1 22
INDEX RANGE SCAN GSA_COMDFE 1 2
TABLE ACCESS BY INDEX ROWID TABLE_COMMIT_LOG 1 28 3
INDEX RANGE SCAN IND_CASE_COMMIT2CASE 2 2
TABLE ACCESS BY INDEX ROWID TABLE_COMMIT_LOG 1 28
INDEX RANGE SCAN IND_CASE_COMMIT2CASE 2 2
TABLE ACCESS BY INDEX ROWID TABLE_COMMIT_LOG 1 28
INDEX RANGE SCAN IND_CASE_COMMIT2CASE 2 2
TABLE ACCESS BY INDEX ROWID TABLE_CASE 1 30 2
INDEX UNIQUE SCAN CASE_OBJINDEX 1 1
TABLE ACCESS BY INDEX ROWID TABLE_SITE 1 12 2
INDEX UNIQUE SCAN SITE_OBJINDEX 1 1
TABLE ACCESS BY INDEX ROWID TABLE_ADDRESS 1 12 2
INDEX UNIQUE SCAN ADDRESS_OBJINDEX 1 1
TABLE ACCESS BY INDEX ROWID TABLE_EMPLOYEE 1 34 1
INDEX UNIQUE SCAN EMPLOYEE_OBJINDEX 1
INDEX UNIQUE SCAN SITE_OBJINDEX 1 6 1
INDEX UNIQUE SCAN USER_OBJINDEX 1 6
TABLE ACCESS BY INDEX ROWID TABLE_X_GSA_TIME_STAMPS 4 48 3
INDEX RANGE SCAN GSAIDX_TS2DISP 1 2
INDEX UNIQUE SCAN GBST_ELM_OBJINDEX 1 6
INDEX UNIQUE SCAN GBST_ELM_OBJINDEX 1 6
INDEX UNIQUE SCAN GBST_ELM_OBJINDEX 1 6
INDEX UNIQUE SCAN SUBCASE_OBJINDX 1 6 1
TABLE ACCESS BY INDEX ROWID TABLE_MOD_LEVEL 1 12 1
INDEX UNIQUE SCAN MOD_LEVEL_OBJINDEX 1
INDEX UNIQUE SCAN PART_NUM_OBJINDEX 1 6
NESTED LOOPS 16 K 2 M 5812
HASH JOIN 16 K 2 M 5812
HASH JOIN 16 K 2 M 5286
TABLE ACCESS FULL TABLE_EMPLOYEE 13 K 441 K 28
HASH JOIN 16 K 1 M 5243
TABLE ACCESS FULL TABLE_SCHEDULE 991 11 K 2
HASH JOIN OUTER 16 K 1 M 5240
HASH JOIN OUTER 16 K 1 M 3866
HASH JOIN OUTER 16 K 1 M 450
HASH JOIN 16 K 1 M 44
TABLE ACCESS FULL TABLE_GBST_ELM 781 14 K 2
TABLE ACCESS FULL TABLE_APPOINTMENT 16 K 822 K 41
INDEX FAST FULL SCAN CASE_OBJINDEX 1 M 6 M 201
TABLE ACCESS FULL TABLE_SITE 967 K 11 M 3157
TABLE ACCESS FULL TABLE_ADDRESS 961 K 11 M 1081
INDEX FAST FULL SCAN SITE_OBJINDEX 967 K 5 M 221
INDEX UNIQUE SCAN USER_OBJINDEX 1 6
HASH JOIN 6 K 272 K 51
TABLE ACCESS FULL TABLE_USER 6 K 51 K 21
TABLE ACCESS FULL TABLE_EMPLOYEE 6 K 220 K 28Hi,
First-off, it appear that you are querying a view. I would redo the auery against the base table.
Next, look at a function-based index for the DATE column. Here are my notes:
http://www.dba-oracle.com/t_function_based_indexes.htm
http://www.dba-oracle.com/oracle_tips_index_scan_fbi_sql.htm
Also, make sure you are analyzed properly with dbms_stats:
http://www.dba-oracle.com/art_builder_dbms_stats.htm
And histograms, if appropriate:
http://www.dba-oracle.com/art_builder_histo.htm
Lasty, look at increasing hash_area_size or pga_aggregate_tagtet, depending on your table sizes:
http://www.dba-oracle.com/art_so_undocumented_pga_parameters.htm
Hope this helps. . . .
Donald K. Burleson
Oracle Press Author
Maybe you are looking for
-
Dunning error (form does not exist)
Hi, While performing the dunning after selection the Individual dunning notice for printout the system shwoing error that '''FORM F150_DUNN_01''' DOES NOT EXISTS. When I tried several times to performance the dunning it showing the same error message
-
Regarding delivery block in sales order
Hi experts, i have problem in user exits in which i hav 2 work my requirement is if sales organization is ____ and order type is_____ and payment of terms is ______ then delivery block must be ' Needs Approval'.. please help me out for this Thanks i
-
Dear PM Experts, I want to create a counter in (IK01) for preventive maintenance plan of Compressor which require the CHARACTERISTIC (HRS),and i had created my own characteristic in CT04 but the counter dose not work properly. So please help me in cr
-
Getting Time out Error in ZReports..
Hi, I am getting timeout error whenever I am trying to run a report. This error is coming only in case of ZReports. These programs are of different modules, like SD, FI and HR. Standard reports and programs are running fine. Any solution ??? Priyanka
-
OWB 11.2.0.4: Process flows execute in parallel instead of serial
Hi all, we migrated a 10gR2 repository (Linux) onto 11.2.0.4 and noticed a heavy error: the sub-processes which are supposed to execute serially (and did this in 10g) are started in parallel, so, that the whole dependency concept is destroyed. Prior