Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Union all alternative.

USER101Jul 26 2005 — edited Jul 28 2005
Guys,

We have about 6 materialized views, each of which have been built on a single county and have same column. These get refreshed overnight. We have another view built on top of this that acts as a single view to the front end users and based on the selection of country, the user accesses the data that they need.

create view MAIN as
slect col1,col2 from A
Union all
slect col1,col2 from B
Union all
slect col1,col2 from C
Union all
slect col1,col2 from D
Union all
slect col1,col2 from E;

But i am noticing that the entire 5 MV's are scanned everytime a user requests for information related to a single country, from the upper most view. Is there anyway we can restrict it so that they access only single MVIEW rather than all of them ?

Currently the explain plan looks like this :

Operation Object Name Rows Bytes Cost Object Node In/Out PStart PStop

SELECT STATEMENT Optimizer Mode=ALL_ROWS 30 M 78989
VIEW XCM_VIEW_PM_CUSTOMERS_ALL 30 M 8G 78989
UNION-ALL PARTITION
TABLE ACCESS FULL MV_XCM_VIEW_PM_CUSTOMERS 2 M 790 M 6981
TABLE ACCESS FULL MV_XCM_VIEW_PM_CUSTOMERS_DEU 5 M 1G 745 :Q368491000 P->S QC (RANDOM)
TABLE ACCESS FULL MV_XCM_VIEW_PM_CUSTOMERS_FRA 4 M 1G 492 :Q368492000 P->S QC (RANDOM)
TABLE ACCESS FULL MV_XCM_VIEW_PM_CUSTOMERS_GBR 9 M 1G 1171 :Q368493000 P->S QC (RANDOM)
TABLE ACCESS FULL MV_XCM_VIEW_PM_CUSTOMERS_ITA 3 M 938 M 8513
TABLE ACCESS FULL MV_XCM_VIEW_PM_CUSTOMERS_EUR 4 M 1G 10561
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 25 2005
Added on Jul 26 2005
11 comments
579 views