Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> Re: Select is fast, insert is very very slow

Re: Select is fast, insert is very very slow

From: <Saminathan_Seerangan_at_i2.com>
Date: Thu, 15 May 2003 02:07:02 -0800
Message-ID: <F001.005995EB.20030515020702@fatcity.com>


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 to 
insert
around 74,000 records. I have altered the temp_segment_sr_filter table to nologging, increased the number of freelists to 2 and there are no indexes on the temp_segment_sr_filter table. The select statement takes only 250 ms
to execute where as while inserting into the temp_segment_sr_filter it takes
5 minutes:
     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 (
                                             (
                                                    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
SRTF.COUNTRY_KEY = (SELECT COUNTRY_KEY FROM STATION WHERE STN_KEY = FSG.DEST_STN_KEY)) )
                                                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 AND
SRTF.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 (
                                             (
                                                    SR.STN_KEY =
FSG.DEST_STN_KEY
                                                AND ( (SRTF.STN_KEY =
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)) )
                                                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.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)) )
                                                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: INET: Saminathan_Seerangan_at_i2.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 - 05:07:02 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US