Materialised view runs for ever ...

Hi
I'd appreciate if someone could shine some light on an issue I'm having with a materialised view.
I inherited this when I came into my current project, so before you ask me why tables are not partitioned or why a MV is being used for such a scenario, the answer is I don't know!!
Anyway ... I'm using "Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - Prod" running on SUSE ...
There are a number of normalised tables two of which contain in the region of 400million rows each and tend to grow at the rate of 27000 rows per day.
There's a materialised view (for the purposes of providing fast interactive reporting) that is setup as a normal join between 4 tables; the above two and the other two are just basic dictionary type lookups each containing around 100 or so rows.
SELECT .... FROM LargeTable1, LargeTable2, Lookup3, Lookup4 WHERE Lookup3.ID=LargeTable1.LID and LargeTable2.ID=LargeTable1.ID and LargeTable2.LID=Lookup4.ID ;
Running a FULL refresh on the MV failes with a 'ora-01555 snapshot too old' error after about 5 days!! Then takes around the same amount of time to rollback. Can't do a FAST refresh, I think because logs and/or mv indecies are out of sync.
Table space is 63% full and undo space is set to auto-extend.
I've tried /*+RULE */ but that doesn't seem to make a huge difference.
Why does it take so long? Why does it fail? What can I do to speed it up?
Thanks in advance for your assistance.
Edited by: 883758 on Sep 7, 2011 2:16 PM

You should approach this as a SQL tuning exercise, without the ability to change the query itself.
Are table statistics up to date? Look at the execution plan – does it look reasonable for you? Are there any indexes that can help? (I am thinking covering indexes on the large tables …)
Iordan Iotzov
http://iiotzov.wordpress.com/

Similar Messages

  • Query runs for ever - suggestions - ideas - tips

    Hello all,
    I have the following situation:
    1) Database 1: XE 10g Release 10.2.0.1.0 - Production
    2) Database 2: 10g Enterprise Edition Release 10.2.0.4.0 - 64bit Production
    3) Dblink from Database 1 pointing to Database 2
    4) Synonyms created withing Database 1, pointing to Database 2 packages and tables:
    - "mytable1" exists in Database 2 therefore a synonym "mytable1" is created in Database 1
    - "mytable2" exists in Database 2 therefore a synonym "mytable2" is created in Database 1
    - "mypackage" exists in Database 2 therefore a synonym "mypackage" is created in Database 1
    5) Of course select and execute rights are granted
    6) Query:
    SELECT field1
    FROM myshcema.mytable1
    WHERE field2 = myshcema.mypackage.myfunction ('PARAMVALUE'))
    AND EXISTS (SELECT 1 FROM myshcema.mytable2 WHERE field_in_tab2 = field_in_tab1)
    7) Problem.This query runs for ever
    8) Explain plan
    OPERATION - OBJECT_NAME - OPTIONS - COST
    SELECT STATEMENT - - - 17
    -> FILTER - - -
    -> -> FILTER - - - 3
    -> -> -> REMOTE - mytable1 - -
    -> -> REMOTE - mytable2 - - 1
    9) Now I get the value returned by the function and re-execute the previous query:
    - select myshcema.mypackage.myfunction ('PARAMVALUE')) from dual;
    - return value is *89787621*
    - re-executing the query:
    SELECT field1
    FROM myshcema.mytable1
    WHERE field2 = *89787621*
    AND EXISTS (SELECT 1 FROM myshcema.mytable2 WHERE field_in_tab2 = field_in_tab1)
    10) Explain plan
    OPERATION - OBJECT_NAME - OPTIONS - COST
    SELECT STATEMENT - - REMOTE - 3
    -> NESTED LOOPS - - SEMI - 3
    -> -> INDEX - MY_UK_NAME - RANGE SCAN - 3
    -> -> INDEX - MY_2ND_UK - UNIQUE SCAN - 0
    And the results are instantaneous
    Now my question: Can somebody direct me on whether a hint or something else will correct this situation? Due to restrictions that I cannot currently explain here, I am not able to change the code to first get the value and then execute the query.
    Thanks for helping
    G
    Edited by: G on May 17, 2011 9:07 AM
    Edited by: G on May 17, 2011 9:10 AM

    I would think the driving site hint woud be the frist thing I tried. If for some reason Oracle does not seem to be able to use the hint or if hints are heavily frowned on at your site then here is another approach to the problem.
    Code the query into a view and define the view on the remote database then issues a local query against the remote view.
    HTH -- Mark D Powell --

  • Dbms_scheduler job neither succeeds nor errors its just keep running for ever

    Hi All,
    I am trying to run a shell script from plsql using the dbms_scheduler, job is getting created and it keeps running for ever without success or error.
    Can some please help me where I am doing the mistake.
    Thanks
    DB Version:
    Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bi
    PL/SQL Release 10.2.0.5.0 - Production
    Plsql Script:
    BEGIN
       DBMS_SCHEDULER.create_job (
          job_name              => 'SFTP_PAYMENTECH_BATCHID1',
          job_type              => 'EXECUTABLE',
          job_action            => '/app07/ebdev/ebdevappl/xxtpc/bin/test.sh',
          number_of_arguments   => 1,
          enabled               => FALSE,
          auto_drop             => TRUE,
          comments              => 'SFTP Batch File to Paymentech');
       DBMS_OUTPUT.put_line (
          'Job Created Successfully:' || 'SFTP PAYMENTECH BATCHID');
       fnd_file.put_line (
          fnd_file.output,
          'Job Created Successfully:' || 'SFTP PAYMENTECH BATCHID');
       COMMIT;
       DBMS_SCHEDULER.SET_JOB_ARGUMENT_VALUE (
          job_name            => 'SFTP_PAYMENTECH_BATCHID1',
          argument_position   => 1,
          argument_value      => '66667'                        /*v_printer_name*/
       DBMS_SCHEDULER.enable (name => 'SFTP_PAYMENTECH_BATCHID1');
    EXCEPTION
       WHEN OTHERS
       THEN
          fnd_file.put_line (fnd_file.output,
                             'Error while creating the Job:' || SQLERRM);
          DBMS_OUTPUT.put_line ('Error while creating the Job:' || SQLERRM);
    END;
    Shell Script which I am calling:
    #!/usr/bin/ksh
    FILENAME=$1
    PMTHOST=198.xx.xx.xx
    PMTUSER=xxxxx
    PMTPW=xxxxx
    a='apps'
    b='xxxxxx'
    c='EBDEV'
    INST=`echo $TWO_TASK | sed 's/_BALANCE//'`
    echo INSTANCE: $INST
    echo
    File_Path=$XXTPC_TOP/iby/out
    echo File Name: $FILENAME
    echo $PMTHOST
    echo $PMTUSER
    echo
    echo Date: `date`
    echo
    echo File System User: `whoami`
    echo
    echo Instance: $TWO_TASK
    echo
    echo File_Path: $File_Path
    echo
    echo PMT SFTP
    # Fetch file using MBATCHID as File Name
    cd $File_Path
    echo
    echo -----------------------------------------------
    echo
    echo Current File          :$FILENAME
    l_date_time=`date +%Y%m%d%H%M%S`
    echo SFTP Remittance File
    # sftp $PMTUSER@$PMTHOST << EOF
    lftp -u $PMTUSER,$PMTPW sftp://$PMTHOST << EOF
    lcd $File_Path
    cd test/945299
    put $FILENAME
    exit
    EOF
    #`sqlplus -s apps/tpcdev2013@EBDEV @try.sql $FILENAME`

    Have you tried running the script manually to confirm it isnt just hanging on input for the lftp ?
    You could add a -o <file> to the lftp command line which would output debug info into <file> so you could see.
    Creation of the job looks fine so as GregV said, what output do you have in ALL_SCHEDULER_RUNNING_JOBS and any ADDITIONAL_INFO in the ALL_SCHEDULER_JOB_RUN_DETAILS or in $ORACLE_HOME/scheduler/log that might indicate what the problem is ?
    If this answer was helpful, please mark as helpful answer. 

  • Sql is running for ever

    We have one report which will process every night which is running good from couple of years. Today that report is running for ever. I extrated sql from that report and if I run that sql by giving * after select, it is giving result with in one minute. If I run the sql by selecting column names, it is running for ever. Our daily report will run by selecting few columns from three tables. We are using choose based optimizer.
    But when I run the same query by selecting the columns, with yesterday, I will get the output with in one minute. If I run the same query for today's date, getting that problem. But we had almost more than 10 thousand transactions over night. Not sure whether I need to run compute statistics on those tables which can fix the problem.
    Pls advice how to fix this. Our db is 9i.
    Thanks in advance.
    Hari Babu
    Edited by: user6367891 on Oct 8, 2009 12:55 PM

    Pl also see HOW TO: Post a SQL statement tuning request - template posting
    The information you have posted so far is insufficient to make any kind of diagnosis.
    HTH
    Srini

  • What are the areas impact query to run for ever/long?

    Hi All,
    When I have to talk about long running scripts or procedures I focus on DTA which suggests on Indexing and infact I think this is the main cause. What are the other areas which we need to consider for Long running queries and troubleshooting tools we need
    to use do you think?
    Ofcourse blocking impacts but am purely thinking at query perspective.
    Thanks
    Swapna

    What are the other areas which we need to consider for Long running queries and troubleshooting tools we need to use do you think?
    One of the reasons is blocking. Please take a look at these links:
    INF: Understanding and resolving SQL Server blocking problems
    Troubleshoot Slow-Running Queries In SQL Server
    T-SQL Articles
    T-SQL e-book by TechNet Wiki Community
    T-SQL blog

  • Job running for ever...

    Hi Gurus,
    I created a generic extractor and when execute it using RSA3 transaction in SRM, is OK.
    When i execute the function module is also OK.
    When i start a job (infopackage) using this extractor, the records are load in BI but the job still running...
    I saw in SM5O that the work process is reading a ROIS table...
    Why it it taking so long...it has only 20 records.
    Appreciate your response.
    Thanks,
    rCm.

    Hi,
    When a BI load takes long time to finish.It may be hanged in tRFC.
    Do the following steps.
    1.Go to the long running load monitor (T-code: RSMO) screen and from menu at top navigate to u2018Environmentu2018 -> u2018Transact. RFCu2018 and then,
    -> To u2018In the Data Warehouseu2018 , if the data source is in same SAP system as of the current load
    -> To u2018In the source systemu2018 , if the data source exists in external SAP system (like R/3).
    2.Now we will be in u2018Transactional RFCu2018 list selection screen. Here enter the input parameters. Put wild character asterisk u2018*u2019 in you need to get entire list of tRFCu2019s in the system.
    3.Now the screen will list all the tRFCs currently scheduled to execute or held up. If a tRFC is held for long time, then we can manually push it by clicking on it from the list and then from menu go to u2018Editu2018 -> u2018Execute LUWu2018 or pressing F6.
    Regards,
    Shiva.

  • Query runs for ever

    I have three summary tables which are yearly,monthly and daily. The yearly table has year and some aggreagted facts. The monthly table has year,month and some aggregated facts while day table has year,month and day and some aggregated facts.
    I ran a Query on yearly table and monthly table with a join on year for these fields
    Year(year from yearly table)
    month and some aggregated facts (monthly table). This query runs forever. But if I pull all these fields from monthly table it runs fast. Can I join on year to pull the data. I dont have any keys in these tables.

    Query from different tables:
    SELECT
    PMAC.ACT_ALL_SUM_YEAR.DEPT_AIRPORT,
    PMAC.ACT_ALL_SUM_YEAR.ARR_AIRPORT,
    (PMAC.ACT_ALL_SUM_YEAR.DATE_YEAR),
    PMAC.ACT_ALL_SUM_MONTH.AVG_AIRB,
    (PMAC.ACT_ALL_SUM_MONTH.DATE_MONTH)
    FROM
    PMAC.ACT_ALL_SUM_YEAR,
    PMAC.ACT_ALL_SUM_MONTH,
    PMAC.ACT_ALL_SUM_DAY
    WHERE
    ( PMAC.ACT_ALL_SUM_YEAR.DATE_YEAR=PMAC.ACT_ALL_SUM_DAY.DATE_YEAR )
    AND ( PMAC.ACT_ALL_SUM_DAY.DATE_YEAR=PMAC.ACT_ALL_SUM_MONTH.DATE_YEAR )
    AND
    PMAC.ACT_ALL_SUM_YEAR.DEPT_AIRPORT = 'ATL'
    AND
    PMAC.ACT_ALL_SUM_YEAR.ARR_AIRPORT = 'JFK'
    AND
    (PMAC.ACT_ALL_SUM_YEAR.DATE_YEAR) In ( '2001','2002','2003' )
    )Query to pull data from single table:
    SELECT
      PMAC.ACT_ALL_SUM_MONTH.AVG_AIRB,
      (PMAC.ACT_ALL_SUM_MONTH.DATE_MONTH),
      PMAC.ACT_ALL_SUM_MONTH.ARR_AIRPORT,
      PMAC.ACT_ALL_SUM_MONTH.DEPT_AIRPORT,
      (PMAC.ACT_ALL_SUM_MONTH.DATE_YEAR)
    FROM
      PMAC.ACT_ALL_SUM_MONTH
    WHERE
       PMAC.ACT_ALL_SUM_MONTH.DEPT_AIRPORT  =  'ATL'
       AND
       PMAC.ACT_ALL_SUM_MONTH.ARR_AIRPORT  =  'JFK'
       AND
       (PMAC.ACT_ALL_SUM_MONTH.DATE_YEAR)  In  ( '2001','2002','2003'  )
      )These are two queries which I was working on. The first query takes too much time to run and it runs fast on the second query. How can I optimise the first query. Can we include any keys in these tables to make the query faster.
    Edited by: user9518444 on Dec 3, 2008 7:34 AM
    Edited by: user9518444 on Dec 3, 2008 7:38 AM

  • LMS 3.2 discovery process runs for ever

    Dear friends,
    I am having a problem with discovery on Ciscoworks LMS 3.2. The discovery process runs eternally and does not discover any devices.
    Here are the individual device versions:
    Name   Version   Size   Status   Expiration Date 
    1. CM 5.2 300 Purchased Never
    2. DFM 3.2 300 Purchased Never
    3. HUM 1.0 100 Evaluation Sun Jul 26 12:18:01 GMT+03:00 2009
    4. IPM 4.2 300 Purchased Never
    5. RME 4.3 300 Purchased Never
    6. VNM 1.0 Unlimited Purchased Never
    Please find enclosed the csdiscovery.log which indicates the following error
    1000 [main] DEBUG com.cisco.nm.csdiscovery.CSDiscoveryManager  - FATAL: Exception occured in the start discovery Exception occured during start of discovery in CS.
    Reason : failed to initialize DiscoveryController
    I am also enclosing the CSDiscovery-config.xml under the config directory and the specific job as well.
    ngdiscovery.log shows 0 bytes. I am not sure if it is to be populated only when we initiate some debugging?
    Thanks a lot
    Gautam

    It seems you're missing some critical files.  Under NMSROOT/conf/csdiscovery, you should have the following zip files:
    SharedDiscoveryAUS.zipSharedDiscoveryCluster.zipSharedDiscoveryGeneral.zipSharedDiscoveryIGX.zip
    The casusers group should have full control on all four files.  If these files really are missing, you will need to contact TAC to get new ones, or you will need to reinstall Common Services.

  • How do I set a Phase Listener to only run for a specific page?

    How do I set a Phase Listener to only run for a specific page?
    I understand that a Phase Listener runs for ever page in the application, however I want a phase listener to only run for one page at the beginning of the application.
    I discovered I can't use a Filter, because the JSF Application instance always returns null.
    Thus, I thought a Phase Listener would be a good approach.
    Thoughts?
    Thanks,
    --Todd                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

    I have moved forward with checking the requested URI...
    (shivers)
    Thanks,
    --Todd                                                                                                                                                                                   

  • How to disable photo-downloader for ever ?

    Hi there,
    after installing Photoshop Album Starter Edition 3.0 my PC always shows an active downloader icon in the systray. I don't want this program to run for ever (or at each startup). Even deactivating is only valid until the next reboot.
    How can I disable this program ?
    Thanks for your help
    Casik

    Hi Casik,
    You can disable the downloader by right clicking the icon and selecting disable. After this the icon is still visible in system tray but Downloader doe snot launch automatically.
    There have been some posts in the past about removing the icon from system tray. However I have not tried the suggestions and cannot tell you for sure whether we they work.
    Here is the link to one of the posts:
    Colin Walls, "Stop automatic startup??" #6, 19 Sep 2005 11:19 pm
    Hope this helps you.
    ~Vibha~

  • How can I change the background of a running webpage on my own. Example Facebook I want to change its backround color from white to black just in my view not for all

    How can I change the background of a running webpage on my own. Example Facebook I want to change its background color from white to black just in my view, not for all. Cause I really hate some site with white background because as I read for an hour it aches my eyes but not on those with darker background color.

    You can use the NoSquint extension to set font sizes (text/page zoom) and text colors on web pages.
    *NoSquint: https://addons.mozilla.org/firefox/addon/nosquint/

  • Hello, I'm pretty sure my fan on my 2009 mac book pro has stopped running. Would this cause the computer to slow down and take for ever to boot up and show the color wheel every time I select an application ?

    Hello, I'm pretty sure my fan on my 2009 mac book pro has stopped running. Would this cause the computer to slow down and take for ever to boot up and show the color wheel every time I select an application ? how involved to replace fan ? cost ?
    thanks

    Not directly, but if the CPU overheats because of incompatible software, that would cause slowdowns. Do not allow the computer to run if the fan is not working unless you wish to fry your motherboard. Please make a Genius Appointment and take it in for service.

  • Update statement is taking for ever, has been running for the last 6 hours.

    UPDATE PRODUCT_INTERIM A
    SET PRODUCT_ID =
    SELECT MAX(PRODUCT_ID)
    FROM PRODUCT B
    WHERE B.CHAIN_ID = A.chain_ID
    AND B.x_id = A.x_id
    WHERE EXISTS
    SELECT '1'
    FROM RET_PRODUCT B
    WHERE B.CHAIN_ID = A.chain_id
    AND B.x_id = A.x_id
    Oracle Experts, The above query is taking for ever and ever. We do have 11 million records in product_interim table, for those 11 Million records, this query has been running for the last 6+ hours...in OEM, it still says, 89% percent completed and 2 hours waiting time.. it always shows 2 hours waiting time...
    Can you guys give some ideas to get this run fast....Your time and help would be greatly appreciated...

    >
    Oracle Experts, The above query is taking for ever and ever. We do have 11 million records in product_interim table, for those 11 Million records, this query has been running for the last 6+ hours...in OEM, it still says, 89% percent completed and 2 hours waiting time.. it always shows 2 hours waiting time...
    Can you guys give some ideas to get this run fast....Your time and help would be greatly appreciated...
    >
    Don't do anything yet!
    Let it keep running until you know that you REALLY want to stop it. If you think the UPDATE is slow the ROLLBACK if you kill it may take much longer.
    Now - how do you plan to get it to 'run fast' when it is already running? If you do a ROLLBACK the time it takes to apply the UNDO could take even longer than the time it has taken to get this far with the update. And if you interrupt the ROLLBACK you will have to do a recovery from backup. Don't go there.
    Read the FAQ at the top of the thread list for how to post a tuning request and the info you need to provide. Some of that info is:
    1. Ask for help BEFORE you start running the query. Once you start you should usually just let it finish.
    2. Always provide your 4 digit Oracle version
    3. Provide table and index DDL
    4. Provide row counts for the table and for the query predicates
    5. Provide info about the exact command you used to collect stats and say if the stats are current

  • HT1338 My MBA running osx version 10.6.8 cant update, it take hours and hours to download and freezes at verifying stage for ever , please help me

    Hi
      My MBA
    Model Name:          MacBook Air
      Model Identifier:          MacBookAir3,2
      Processor Name:          Intel Core 2 Duo
      Processor Speed:          2.13 GHz
      Number of Processors:          1
      Total Number of Cores:          2
      L2 Cache:          6 MB
      Memory:          4 GB
      Bus Speed:          1.07 GHz
      Boot ROM Version:          MBA31.0061.B01
    Cant update , it download for ages and freezes while verifing and installing for ever.
    My surfing is  also affected,
    Systems acts kind of crazy.
    Please help
    Thanks

    Not enough free disk space can cause the problems you are describing.
    Right or control click the MacintoshHD icon on your Desktop.
    Click Get Info. In the Get Info window you will see Capacity and Available.
    Make sure there's a minimum of 15% free disk space.
    Freeing space on your Mac OS X startup disk
    If it's not a disk space issue, the startup disk may need repairing, try here (MacBook Air / Snow Leopard >  OSX Tips: Using Disk Utility 6. Verify or Repair Disk

  • Should I use materialised view?

    I am using the following sql in my code. This takes a long time to execute and I need to tune this. Please review and suggest if I should be using a materialized view instead.
    Main Select statement for interest calculation
    SELECT          intratechgcur.SECURITY, intratechgcur.srl_no, intratechgcur.schg_type,
         CASE WHEN intratechgcur.effective_date < ADt_Start_Date THEN ADt_Start_Date
                             ELSE intratechgcur.effective_date END AS start_date,
         CASE WHEN intratechgcur.effective_date < ADt_End_Date
                             AND NVL(intratechgnext.effective_date, ADt_End_Date) > ADt_End_Date THEN ADt_End_Date
                             ELSE NVL(intratechgnext.effective_date, ADt_End_Date) END AS end_date,
                        intratechgcur.rate, intratechgcur.face_value, intratechgcur.listing_int, intratechgcur.comm_prod_int,
                        intratechgcur.sec_create_int, intratechgcur.int_type, intratechgcur.interest_key, intratechgcur.margin,
                        intratechgcur.FLOOR, intratechgcur.cap, intratechgcur.reset_freq, intratechgcur.cmpd_y_n, intratechgcur.cmpd_freq,
                        intratechgcur.comp_type, intratechgcur.int_day, intratechgcur.int_day_1, intratechgcur.int_day_2, intratechgcur.int_dtls_yn
    FROM               v_intratechg intratechgcur, v_intratechg intratechgnext
    WHERE               intratechgcur.SECURITY          = AS_Security
    AND          intratechgcur.effective_date < ADt_End_Date
    AND               intratechgnext.SECURITY          (+)= intratechgcur.SECURITY
    AND               intratechgnext.srl_no          (+)= intratechgcur.srl_no + 1
    ORDER BY      intratechgcur.SECURITY, intratechgcur.effective_date, intratechgcur.srl_no ;
    The code for the view V_intratechg is;
    CREATE OR REPLACE VIEW V_INTRATECHG AS
    SELECT     security,
         schg_type,
         effective_date,
         SUM(1) over (PARTITION BY security ORDER BY security, effective_date ASC, schg_type ASC) AS srl_no,
         face_value,
         rate,
         listing_int,
         comm_prod_int,
         sec_create_int,
         int_type,
         interest_key,
         margin,
         FLOOR,
         cap,
         NVL(reset_freq, 'DAILY') AS reset_freq,
         NVL(cmpd_y_n, 'N') AS cmpd_y_n,
         NVL(cmpd_freq, 'DAILY') AS cmpd_freq,
         NVL(comp_type, 'N') AS comp_type,
         int_day, int_day_1, int_day_2, int_dtls_yn
    FROM
         (SELECT     security.security, 'IM' AS schg_type,
              GREATEST(security.prv_int_dt, NVL(security.allot_date, security.prv_int_dt),
              NVL(security.first_int_date,security.prv_int_dt)) AS effective_date,
              DECODE(intday.int_day_1, 'ACD', NVL((SELECT interest_amt FROM securityschddtls A WHERE security.security = A.security
              AND A.adhoc_schd_date > GREATEST(security.prv_int_dt, NVL(security.allot_date, security.prv_int_dt),
              NVL(security.first_int_date,security.prv_int_dt))
              AND a.rectype ='L' AND A.ADHOC_SCHD_DATE = (SELECT MIN(ADHOC_SCHD_DATE) FROM securityschddtls
    WHERE      securityschddtls.adhoc_schd_date > GREATEST(security.prv_int_dt, NVL(security.allot_date, security.prv_int_dt), NVL(security.first_int_date,security.prv_int_dt))
         AND securityschddtls.security = A.security AND securityschddtls.rectype='L')),
              NVL(secchg.rate, security.interest)), NVL(secchg.rate, security.interest)) AS rate,
              NVL(secchg.face_value, security.face_value) AS face_value,
              NVL(secchg.listing_int, security.listing_int) AS listing_int,
              NVL(secchg.comm_prod_int, security.comm_prod_int) AS comm_prod_int,
              NVL(secchg.sec_create_int,security.sec_create_int) AS sec_create_int,
              NVL(secchg.int_type, security.int_type) AS int_type,
              NVL(secchg.interest_key, security.interest_key) AS interest_key,
              NVL(secchg.margin, security.margin) AS margin,
              NVL(secchg.FLOOR, security.FLOOR) AS FLOOR,
              NVL(secchg.cap, security.cap) AS cap,
              NVL(secchg.reset_freq, security.reset_freq) AS reset_freq,
              NVL(secchg.cmpd_y_n, security.cmpd_y_n) AS cmpd_y_n,
              NVL(secchg.cmpd_freq, security.cmpd_freq) AS cmpd_freq,
              NVL(secchg.comp_type, security.comp_type) AS comp_type,
              NVL(secchg.int_day, security.int_day) AS int_day, intday.int_day_1,
              intday.int_day_2, 'Y' AS int_dtls_yn
              FROM          security, assetype, intday, securityschddtls secdtls,
                        (SELECT     secchg.security AS security, secchg.call_date AS effective_date,
                        NVL(secchg.rate,0) AS rate, secchg.face_value,
                        SUM(1) over (PARTITION BY secchg.security ORDER BY secchg.security,
                        secchg.call_date ASC) AS srl_no,
                        NVL(secchg.listing_int,0) AS listing_int, NVL(secchg.comm_prod_int,0) AS comm_prod_int,
                        NVL(secchg.sec_create_int,0) AS sec_create_int,
                        secchg.int_type, secchg.interest_key,
                        nvl(secchg.margin,0) as margin, nvl(secchg.FLOOR,0) as floor,
                        nvl(secchg.cap,0) as cap, secchg.reset_freq,
                        secchg.cmpd_y_n, secchg.cmpd_freq, secchg.comp_type, secchg.int_day FROM          secchg) secchg
              WHERE          security.asset_type     = assetype.asset_type
                   AND          security.int_day          = intday.int_day
                   AND          assetype.int_y_n           = 'Y'
                   AND          security.rectype          = 'L'
                   AND          assetype.rectype          = 'L'
                   AND          intday.rectype               = 'L'
                   AND          secchg.security (+)= security.security
                        AND          secchg.srl_no (+)= 1
                        AND          secdtls.security (+)= security.security
                        AND          secdtls.srl_no (+)= 1
                        AND          secdtls.rectype (+)= 'L'
              UNION ALL
              SELECT     schedules.security,
                   DECODE(schedules.schd_past_yn, 'Y', 'RP', 'RS') AS schg_type,
                   DECODE(intday.int_day_1, 'ACD',security_cashflow.start_date,security_cashflow.inflow_date) AS effective_date,
                   --commented by vijai
                   -- DECODE(intday.int_day_1, 'ACD', intschdamt.amount, NVL(intratechg.rate,security.interest)) AS rate,
                   DECODE(intday.int_day_1, 'ACD', intschdamt.amount,decode(security_cashflow.start_Date,intratechg.value_Date, intratechg.rate, security.interest)) as rate,
                   decode(nvl(schedules.tot_face_value - schedules.cum_face_value,security.face_value),0,security.face_value,schedules.tot_face_value - schedules.cum_face_value,security.face_value) AS face_value,
                   NVL(intratechg.listing_int,security.listing_int) as listing_int,
                   NVL(intratechg.comm_prod_int,security.comm_prod_int) as comm_prod_int,
                   NVL(intratechg.sec_create_int,security.sec_create_int),
                   NVL(intratechg.int_type,security.int_type) as int_type,
                   nvl(intratechg.interest_key,security.interest_key) as interest_key,
                   nvl(intratechg.margin,security.margin) as margin,
                   nvl(intratechg.FLOOR,security.floor) as floor,
                   nvl(intratechg.cap,security.cap) as cap,
                   nvl(intratechg.reset_freq,security.reset_freq) as reset_freq,
                   nvl(intratechg.cmpd_y_n,security.cmpd_y_n) as cmpd_y_n,
                   nvl(intratechg.cmpd_freq,security.cmpd_freq) as cmpd_freq,
                   nvl(intratechg.comp_type,security.comp_type),
                   nvl(intratechg.int_day,security.int_day),
                   intday.int_day_1, intday.int_day_2,
                   DECODE(intratechg.security, NULL, 'N', 'Y') AS int_dtls_yn
              FROM     v_schedules schedules, security, intday, intratechg, v_schedules intschdamt, security_cashflow
              WHERE     schedules.security          = security.security
              AND          schedules.red_yn      = 'Y'
              AND          security.int_day               = intday.int_day
              AND          security.rectype               = 'L'
              AND          intday.rectype                    = 'L'
              AND          intratechg.security (+)= schedules.security
              AND          intratechg.value_date(+)= schedules.schd_date
              AND          intratechg.rectype     (+)= 'L'
              AND          intschdamt.security (+)= schedules.security
              AND          intschdamt.schd_date (+)= schedules.schd_date
              AND          intschdamt.red_yn (+)= 'N'
              AND           security_cashflow.inflow_type      = 'INT'
              AND           security_cashflow.inflow_date     = schedules.schd_date
              AND           security.security               = security_cashflow.security
              AND           schedules.security          = security_cashflow.security
              UNION ALL
              SELECT     intratechg.security, 'IR' AS schg_type,
                   intratechg.value_date AS effective_date,
                   NVL(intratechg.rate,security.interest),
                   security.face_value,
                   NVL(intratechg.listing_int,security.listing_int),
                   NVL(intratechg.comm_prod_int,security.comm_prod_int),
                   NVL(intratechg.sec_create_int,security.sec_create_int),
                   nvl(intratechg.int_type,security.int_type),
                   nvl(intratechg.interest_key,security.interest_key),
                   nvl(intratechg.margin,security.margin),
                   nvl(intratechg.FLOOR,security.floor),
                   nvl(intratechg.cap,security.cap),
                   nvl(intratechg.reset_freq,security.reset_freq),
                   nvl(intratechg.cmpd_y_n,security.cmpd_y_n),
                   nvl(intratechg.cmpd_freq,security.cmpd_freq),
                   nvl(intratechg.comp_type,security.comp_type),
                   nvl(intratechg.int_day,security.int_day),
                   intday.int_day_1, intday.int_day_2, 'Y' AS int_dtls_yn
              FROM     intratechg, security, intday
              WHERE     intratechg.security          = security.security
              AND     security.int_day               = intday.int_day
              AND     intratechg.rectype          = 'L'
              AND     security.rectype               = 'L'
              AND     intday.rectype                    = 'L'
              AND     NOT EXISTS     (SELECT     1 FROM          v_schedules schedules
                             WHERE          schedules.security     = intratechg.security
                             AND          schedules.schd_date     = intratechg.value_date
                             AND          schedules.red_yn          = 'Y'))
              ORDER BY security, srl_no
    The code for the view V_schedules is;
    CREATE OR REPLACE VIEW V_SCHEDULES AS
    SELECT schdall.security,
              schdall.schd_date,
              schdall.schd_type,
              schdall.percent,
              schdall.units_o,
              schdall.units_n,
              schdall.amount,
              schdall.sequences,
    schdall.act_sch_dt,
         schdall.security_n,
              schdall.prior_act,
         schdall.red_amount,
              schdall.ben_refer,
         schdall.round_method,
    schdall.round_dec,
    schdall.average_y_n,
         schdall.schd_past_yn,
         CASE WHEN schd_type IN(sysschd.red, sysschd.disred) THEN 'Y' ELSE 'N' END AS red_yn,
         SUM( CASE WHEN schd_type IN(sysschd.red, sysschd.disred) THEN schdall.red_amount ELSE 0 END)
                                  over(PARTITION BY schdall.security) AS tot_face_value,
    SUM( CASE WHEN schd_type IN(sysschd.red, sysschd.disred) THEN schdall.red_amount ELSE 0 END)
                                  over(PARTITION BY schdall.security
                                       ORDER BY schdall.security, schdall.schd_date ASC) AS cum_face_value,
         SUM( CASE WHEN schd_type IN(sysschd.red, sysschd.disred) THEN schdall.red_amount ELSE 0 END)
                                       over(PARTITION BY schdall.security
                                       ORDER BY schdall.security, schdall.schd_date DESC) AS to_be_redeemed ,
              SUM(CASE WHEN schd_type =sysschd.INT THEN 0 ELSE 1 END)
                                       over(PARTITION BY schdall.security,schdall.schd_date,schd_type)
                             AS no_of_schd
    FROM
                   (SELECT      schedules.security_o AS security,
                                  schedules.schd_date,
                                  schedules.schd_type,
                                  schedules.percent,
                                  schedules.units_o,
                                  schedules.units_n,
                                  schedules.amount,
                                  schedules.sequences,
                                  schedules.act_sch_dt,
                                  schedules.security_n,
                                  schedules.prior_act,
                                  schedules.red_amount,
                                  schedules.ben_refer,
                                  schedules.round_method,
                                  schedules.round_dec,
                                  schedules.average_y_n,
                                  DECODE(schedules.schd_type,'RED','Y','Y') AS schd_past_yn
              FROM           schdpast schedules
              WHERE           prior_act = 'A'
              AND                rectype = 'L'
              UNION ALL
              SELECT           schedules.security_o AS security,
                                  schedules.schd_date,
                                  schedules.schd_type,
                                  schedules.percent,
                             schedules.units_o,
                   schedules.units_n,
                             schedules.amount,
                        schedules.sequences,
                        schedules.act_sch_dt,
                   schedules.security_n,
                   schedules.prior_act,
                        schedules.red_amount,
                        schedules.ben_refer,
                   schedules.round_method,
                   schedules.round_dec,
                   schedules.average_y_n,
                        'N' AS schd_past_yn
              FROM           schedules
              WHERE           prior_act = 'A'
              AND                rectype = 'L'
              AND                Process_date IS NULL ) schdall,
              (SELECT           MAX(redschdtype) AS red,
                             MAX(disredtype) AS disred,
                                  MAX(intschdtype) AS      INT
                                  FROM sysparamschd
              WHERE rectype = 'L') sysschd
    ORDER BY security, schd_date, schd_type

    Too much SQL... makes me eyes hurt.
    I think you're running down the wrong alley here. The very first and fundamental principle of performance tuning is identifying the performance problem. Saying that there is a problem is not identifying the actual problem.
    You cannot run down the alley with a knife looking for a performance problem to kill if you do not know how it looks like. Good that you are running though - the old Klingon saying of "a running warrior can slit more throats" hold very true. :-)
    Why is the existing SQL slow? You first need to identify that. Sure, a materialised view can make the end-query much faster as it has no longer to do all the work - that has now been done in batch by a DBMS_REFRESH job updating and maintaining that materialised view. But that work is still done... so have you actually fixed the cause of the performance problem, or merely hid it by addressing the symptoms?
    How does one find and identify the underlaying performance problem with too-much-SQL-that-makes-Billy's-eyes-hurt? Software Engineering 101. Take any complex problem. Break it down into lots of smaller little problems. Solve each on in turn.
    Take the SQL, break it down into simpler pieces and check each for performance issues. Look at the execution plan and cost. Determime if you (via the physical db design) are providing optimal I/O paths to the CBO in order for it to get to the required data with as little I/O as possible.
    Once you deal with the facts, you can make an informed decision or whether or not a materialised view will actually fix the cause of the performance problem.

Maybe you are looking for

  • MacBook Pro No Longer Operational

    I have a Macbook Pro which was purchased in 2005, I believe.  I currently have been running MacOSX 10.5 on it.  It had been running decently, but within the last couple of days, I've totally lost its functionality.  Initial Symptoms: Spinning Ball De

  • Basic behavior - compile vs. save, application freezes and other questions

    Hi all, I've just recently moved from MS SQL to Oracle and found Oracle SQL Developer the only more or less working application to access the database and write scripts. Still, there are some issues which are beyond me in this application. So what I'

  • .cfa files in Premiere

    Hi anyone knows which are these files, as I open them in Premiere? every time you import a video extension. avi in Premiere Pro CS5.5 I get an error adjustment

  • How to adjust width of comments/changes pane in Pages '09?

    I'm working withe complex changes on an imported .docx document. If I could make the comments/changes panel wider (and thus see all the comments on any given page w/o scrolling), it would be a big help. Can it be done? How? Thanks! Sally

  • Vendor evaluation - Avrge Variance

    hi, when I excuting me6b ranking by material , i m getting individual  scores and average variance column also. please clarify me how  this average variance calculation happens ? how it be linked with overall score. Thanz in Advance. aparji