Code Listing 6: Querying only the materialized view


SELECT t.month, p.product_id, SUM(ps.purchase_price) as sum_of_sales
FROM time t, product p, purchases ps
WHERE t.time_key = ps.time_key AND
      ps.product_id = p.product_id AND
      t.year = 2000

GROUP BY t.month, p.product_id;

  Id    Operation                       Name              
__________________________________________________
 SELECT STATEMENT                                 
   1     HASH JOIN                                              

   2     VIEW                                                  
   3       SORT UNIQUE                                           
   4        TABLE ACCESS FULL           TIME                      
   5      MAT_VIEW REWRITE ACCESS FULL   FIVE_YR_MONTHLY_SALES_MV

Oracle Is The Information Company About Oracle | Oracle RSS Feeds | Careers | Contact Us | Site Maps | Legal Notices | Terms of Use | Privacy