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

Home -> Community -> Usenet -> c.d.o.server -> REPOST: Re: Oracle 9i: Information about how frequent materialized views have

REPOST: Re: Oracle 9i: Information about how frequent materialized views have

From: Stefan Dipper <stefan.dipper_at_spamnix.com>
Date: Thu, 24 Jan 2002 10:10:18 +0100
Message-ID: <3$--$%%%%---$$%%-$@news.noc.cabal.int>


Hi Chris,

thank you for your response. One thing is not clear to me:

Use of materialized views is transparent. So what happens if I query a table and the optimizer decides to use a materialized view instead ? I assume in v$sqlarea the original statement text appears, not the statement after query rewrite. But maybe I am wrong.

Regards,
Stefan

Chris Weiss wrote:

> Query the V$SQLAREA. The execution count will tell you how often SQL
> against these views is executed.
>
> SELECT SUM(EXECUTIONS) FROM V$SQLAREA WHERE SQL_TEXT LIKE '%<OBJECT>%';
>
> You could extend this with an anonymous block driven off of all_objects or
> user_objects
>
> DECLARE
> CURSOR c_cursor IS
> SELECT OBEJCT_NAME FROM USER_OBJECTS WHERE OBJECT_TYPE=VIEW;
> l_count PLS_INTEGER;
> BEGIN
> FOR c_rec IN c_cursor LOOP
> EXECUTE IMMEDIATE 'SELECT SUM(EXECUTIONS) FROM V$SQLAREA WHERE SQL_TEXT
> LIKE ''%'||c_rec.OBJECT_NAME||'%''' INTO l_count
> -- Write the results somewhere for review
> END LOOP;
> END;
> /
>
> This will be ****SLOW**** so run it off hours.
>
> Good Luck!
> --
>
> ~~~~~~~~~~~~~~~~
> Chris Weiss
> www.hpdbe.com
> High Performance Database Engineering
> ~~~~~~~~~~~~~~~~
>
> "Stefan Dipper" <stefan.dipper_at_sap.com> wrote in message
> news:3C4ED367.960EC055_at_sap.com...
> > Hi all,
> >
> > is there a possibility to figure out in Oracle 9i on a view level how
> > frequent materialized views have been used ? Information of that kind is
> > quite important for a DBA to be able to decide whether the effort to
> > maintain the materialized view makes sense. I would like to avoid a
> > situation where there are hundreds of materialized views in a system and
> > nobody knows which are the important ones.
> >
> > Regards,
> > Stefan
> >
> >
> >
> >

This message was cancelled from within The Unacanceller's glorious new software, Lotus 1-2-3 For Rogue Cancellers. Received on Thu Jan 24 2002 - 03:10:18 CST

Original text of this message

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