DBAsupport.com Forums - Powered by vBulletin
Results 1 to 6 of 6

Thread: materialized view + explain plan

  1. #1
    Join Date
    Feb 2008
    Location
    California,USA
    Posts
    6

    materialized view + explain plan

    Hello All,

    I have a set of queries which perform aggregate operations on a single table .The performance of the query(s) is very bad and no other option has worked .
    So I have created a materialized view on the table.
    Till now its fine but
    The problem is when I execute the query and run the explain plan on it the MV is not getting picked up.
    There is a FULL TABLE SCAN going on.

    I have tried the MV with REFRESH ON COMMIT and REFRESH ON DEMAND and other options as well.Nothing works.
    Any suggestions on what to be done .....


    The MV is written as :

    CREATE MATERIALIZED VIEW mv_test_table
    PCTFREE 0
    STORAGE (initial 8k next 8k pctincrease 0)
    BUILD IMMEDIATE
    REFRESH ON COMMIT
    ENABLE QUERY REWRITE
    AS
    SELECT(clo1a,colb,...)
    from test_table
    group by cola;

    Thanks,
    riki

  2. #2
    Join Date
    Nov 2001
    Posts
    335
    What is valie ofr query_rewrite_enabled ?
    One, who thinks that the other one who thinks that know and does not know, does not know either!

  3. #3
    Join Date
    Feb 2008
    Location
    California,USA
    Posts
    6
    yes it is enabled.

  4. #4
    Join Date
    Aug 2007
    Location
    Cyberjaya,kuala lumpur
    Posts
    340
    Can you post the queries which perform aggregate operations
    and post the explain plan also..

  5. #5
    Join Date
    Mar 2007
    Location
    Ft. Lauderdale, FL
    Posts
    3,555
    Just a couple of notes.

    1- MVs are ignored if being refresh at the time the query is issued; since your MV is set to refresh on commit the likelyhood of this to happen would be a function of the activity in your base table. I would test it by creating the MV as refresh on demand.

    2- MV would be taken into consideration if the MV structure is aligned to what the query is looking for. Please post your actual MV creation statement and your actual query.

    3- MV would be taken into consideration if Oracle finds it is cheaper to use it rather than using the base table. How many rows do you have on your base table?... how many rows do you have on your MV?
    Pablo (Paul) Berzukov

    Author of Understanding Database Administration available at amazon and other bookstores.

    Disclaimer: Advice is provided to the best of my knowledge but no implicit or explicit warranties are provided. Since the advisor explicitly encourages testing any and all suggestions on a test non-production environment advisor should not held liable or responsible for any actions taken based on the given advice.

  6. #6
    Join Date
    Feb 2008
    Location
    California,USA
    Posts
    6
    Hello PAVB,

    Thank you for your suggestions.
    The MV is picking up.

    Thanks,
    riki

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Click Here to Expand Forum to Full Width