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 -> Re: materialized view for this?

Re: materialized view for this?

From: Noel <tomekb_at_s_o_f_t_m_a_n.pl>
Date: Tue, 11 Jan 2005 15:22:55 +0100
Message-ID: <cs0nnb$5mp$1@atlantis.news.tpi.pl>


Użytkownik wolfing1_at_yahoo.com napisał:

> version 9i
> Problem is, there's a lot of code already written, and originally I was
> thinking of making a materialized view and rewrite the code to use the
> MV instead of the tables. But I was wondering how flexible or smart is
> the query rewrite thing so maybe I don't have to change the code or not
> all of it...
> Like, how would it work if I had this:
> table1: a,b,c,d,e
> MView: select a,sum(b) x,sum(c) y,max(d) z from table1
>
> query: select a-4, sum(b)+sum(c),max(d) from table1 where e=10
> Will Oracle use MView here?
>

First, you must group by a, if you want this queries to work. If there are indexes on column a and e why bother with MView? Gathering statisticts would help too. Should work fast enough.

-- 
tomekb
Received on Tue Jan 11 2005 - 08:22:55 CST

Original text of this message

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