Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Mailing Lists -> Oracle-L -> RE: Select is fast, insert is very very slow
First...do a memory flush to make sure you are not doing a select from
memory so we can compare
Apples to apples.
Supply the explain plan for this insert. Number of rows in each table.
Brian
-----Original Message-----
Sent: Thursday, May 15, 2003 6:07 AM
To: Multiple recipients of list ORACLE-L
Hi Ranganath,
Coudl you please provide us the explain plan for the same? Also you can turn on autotrace to get the statistics like redo size, sort size, recursive calls etc..
Thanks
Sami
"Krishnaswamy, Ranganath" <Ranganath.Krishnaswamy_at_blr.hpsglobal.com>
Sent by: root_at_fatcity.com
05/15/03 01:31 PM
Please respond to ORACLE-L
To: Multiple recipients of list ORACLE-L <ORACLE-L_at_fatcity.com> cc: Subject: Select is fast, insert is very very slow
Hi List,
The below insert statement is taking about 5 minutes toinsert
INSERT /*+ append */ INTO
TEMP_SEGMENT_SR_FILTER (FLIGHT_SCH_KEY, FLIGHT_SCH_TYPE, FLIGHT_NO,
FLIGHT_SGT_KEY, ORG_STN_KEY, DEST_STN_KEY, SERVICE_CODE, AC_TYPE_KEY,
POSITION_CODE)
SELECT
TDFS.FLIGHT_SCH_KEY, TDFS.FLIGHT_SCH_TYPE, FSH.FLIGHT_NO, FSG.FLIGHT_SGT_KEY, FSG.ORG_STN_KEY, FSG.DEST_STN_KEY, TOS.SERVICE_CODE, FSG.AC_TYPE_KEY AS AC_TYPE_KEY, POS.POSITION_CODE FROM TEMP_DAY_FLIGHT_SCHEDULE TDFS, FLIGHT_SCHEDULE FSH, FLIGHT_SGT FSG, TEMP_OFP_SERVICE TOS, POSITION POS WHERE TDFS.FLIGHT_SCH_KEY = FSH.FLIGHT_SCH_KEY AND FSH.FLIGHT_SCH_KEY = FSG.FLIGHT_SCH_KEY AND TOS.SERVICE_CODE <> '*' AND POS.POSITION_CODE <> '*' AND TDFS.FLIGHT_SCH_TYPE = 'F' AND FSG.AC_TYPE_KEY <> 132 AND NOT EXISTS ( SELECT /*+ index(SR i2_station_restriction) no_expand */ 1 FROM STATION_RESTRICTION SR, STN_RSTCN_TO_FRM SRTF, STN_RESTRICTION_SPL_CODE SRSC WHERE SR.STN_RSTCN_KEY = SRTF.STN_RSTCN_KEY AND SR.STN_RSTCN_KEY = SRSC.STN_RSTCN_KEY (+) AND SRSC.STN_RSTCN_KEY IS NULL AND (SR.AC_TYPE_KEY = FSG.AC_TYPE_KEY OR SR.AC_TYPE_KEY = 517 ) AND ( ( POS.POSITION_CODE IN ('E', 'TE') AND (SRTF.COUNTRY_KEY = (SELECT COUNTRY_KEY FROM STATION WHERE STN_KEY = FSG.DEST_STN_KEY)) )
(
SR.STN_KEY = FSG.ORG_STN_KEY AND ( (SRTF.STN_KEY = FSG.DEST_STN_KEY) OR (SRTF.STN_KEY = 0) OR (SRTF.STN_KEY IS NULL AND
AND SR.AIRLINE_KEY = (SELECT AIRLINE_KEY FROM AIRLINE WHERE AIRLINE_CODE = SUBSTR(FSH.FLIGHT_NO, 1, 2) ) ) OR ( SR.STN_KEY = 0 AND ( (SRTF.STN_KEY = FSG.DEST_STN_KEY) OR (SRTF.STN_KEY = 0) OR (SRTF.STN_KEY IS NULL ANDSRTF.COUNTRY_KEY = (SELECT COUNTRY_KEY FROM STATION WHERE STN_KEY = FSG.DEST_STN_KEY)) )
AND SR.AIRLINE_KEY IN ((SELECT AIRLINE_KEY FROM AIRLINE WHERE AIRLINE_CODE = SUBSTR(FSH.FLIGHT_NO, 1, 2)) , 106 )
) ) AND (SR.VALID_FROM <=TRUNC(to_date('14-May-03'))+FSG.DEP_DAY_CHG AND SR.VALID_TO >= TRUNC(to_date('14-May-03'))+FSG.DEP_DAY_CHG)
AND (SR.WEEKDAYS LIKE ('%' ||DECODE(TO_CHAR(TRUNC(to_date('14-May-03'))+FSG.DEP_DAY_CHG, 'D'), '1', '7', TO_NUMBER(TO_CHAR(TRUNC(to_date('14-May-03'))+FSG.DEP_DAY_CHG , 'D')) - 1 ) || '%'))
) OR ( POS.POSITION_CODE IN ('I', 'TI') AND (FSG.ORG_STN_KEY) OR (SRTF.STN_KEY = 0) OR (SRTF.STN_KEY IS NULL AND SRTF.COUNTRY_KEY = (SELECT COUNTRY_KEY FROM STATION WHERE STN_KEY = FSG.ORG_STN_KEY)) )
(
SR.STN_KEY = FSG.DEST_STN_KEY AND ( (SRTF.STN_KEY =
AND SR.AIRLINE_KEY = (SELECT AIRLINE_KEY FROM AIRLINE WHERE AIRLINE_CODE = SUBSTR(FSH.FLIGHT_NO, 1, 2) ) ) ORFSG.ORG_STN_KEY) OR (SRTF.STN_KEY = 0) OR (SRTF.STN_KEY IS NULL AND SRTF.COUNTRY_KEY = (SELECT COUNTRY_KEY FROM STATION WHERE STN_KEY = FSG.ORG_STN_KEY)) )
(
SR.STN_KEY = 0 AND ( (SRTF.STN_KEY =
AND SR.AIRLINE_KEY IN((SELECT AIRLINE_KEY FROM AIRLINE WHERE AIRLINE_CODE = SUBSTR(FSH.FLIGHT_NO, 1, 2)) , 106 )
) ) AND (SR.VALID_FROM <=TRUNC(to_date('14-May-03')) + FSG.ARR_DAY_CHG AND SR.VALID_TO >= TRUNC(to_date('14-May-03')) + FSG.ARR_DAY_CHG )
AND (SR.WEEKDAYS LIKE ('%' ||DECODE(TO_CHAR(TRUNC(to_date('14-May-03'))+FSG.ARR_DAY_CHG, 'D'), '1', '7', TO_NUMBER(TO_CHAR(TRUNC(to_date('14-May-03'))+FSG.ARR_DAY_CHG, 'D')) - 1 ) || '%'))
) ) --AND (SR.WEEKDAYS LIKE '%3%') AND ( (SR.RESTRICTED_POSITION = '*' AND SR.SERVICE_KEY = 5 ) OR (SR.RESTRICTED_POSITION = POS.POSITION_CODE AND SR.SERVICE_KEY = 5 ) OR (SR.RESTRICTED_POSITION = '*' AND SR.SERVICE_KEY = TOS.SERVICE_KEY ) OR (SR.RESTRICTED_POSITION = POS.POSITION_CODE AND SR.SERVICE_KEY = TOS.SERVICE_KEY ) ) AND IS_ALLOWED = 'N' )
Can anybody help me in imporving the insert performance? Any help in this regard is very much appreciated.
Thanks and Regards,
Ranganath
WARNING: The information in this message is confidential and may be legally privileged. It is intended solely for the addressee. Access to this message by anyone else is unauthorised. If you are not the intended recipient, any disclosure, copying, or distribution of the message, or any action or omission taken by you in reliance on it, is prohibited and may be unlawful. Please immediately contact the sender if you have received this message in error. Thank you.
-- Please see the official ORACLE-L FAQ: http://www.orafaq.net -- Author: Krishnaswamy, Ranganath INET: Ranganath.Krishnaswamy_at_blr.hpsglobal.com Fat City Network Services -- 858-538-5051 http://www.fatcity.com San Diego, California -- Mailing list and web hosting services --------------------------------------------------------------------- To REMOVE yourself from this mailing list, send an E-Mail message to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing). -- Please see the official ORACLE-L FAQ: http://www.orafaq.net -- Author: Spears, Brian INET: BSpears_at_Limitedbrands.com Fat City Network Services -- 858-538-5051 http://www.fatcity.com San Diego, California -- Mailing list and web hosting services --------------------------------------------------------------------- To REMOVE yourself from this mailing list, send an E-Mail message to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing).Received on Thu May 15 2003 - 09:42:14 CDT
![]() |
![]() |