Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Materialized View Log for Multiple Materialized Views

Posted on 2013-01-09
6
Medium Priority
?
741 Views
Last Modified: 2013-01-11
Environment:
HPUX 11.11
Oracle 9.2.0.7

I don't have a lot of experience using Materialized Views so I'd like some clarification if possible.

I have a couple of Views that users use heavily that represent self joining a table to itself from 6 to 10 times.

When called in a query, these views are adding some considerable overhead to the query run time.

Based on the answer to a previous question, I'm looking to turn them into Materialized Views.

Because they would be MV's based upon a self join, they are not considered "simple" MV's and can't be used for FAST REFRESH.  

Can multiple MV's be kept updated from a single MV Log ?  Will Oracle keep the updates in sync in multiple target MV's that are not simple and have to do a complete refresh ?

In the Oracle documentation (here), under the Managing Materialized View Log Space header, it talks about " multiple simple materialized views".

Since my MV's aren't "simple", is there anything I need to be aware of ?

I don't *think* there's going to be a concern, but would like to be sure before I try to implement.

Anyone have any experience with this kind of thing ?

Thanks in advance for any insight.
0
Comment
Question by:Steve Wales
  • 3
  • 2
6 Comments
 
LVL 16

Expert Comment

by:Wasim Akram Shaik
ID: 38761688
instead of creating multiple simple materialized views, create  a materialized view log for each mv ... this will make the mv refresh to check out their independent logs while refreshing..

mv log is specified at the time of creation of mv

for ex:

CREATE MATERIALIZED VIEW LOG ON emp WITH ROWID (dept_id, emp_id, ename,startdate) INCLUDING NEW VALUES;
0
 
LVL 35

Expert Comment

by:johnsone
ID: 38762944
Materialized view logs are not used for complete refreshes.  They are only used for fast refreshes.  Since your views are not "simple" and require a complete refresh every time, there is no need to create the materialized view log.
0
 
LVL 23

Author Comment

by:Steve Wales
ID: 38763204
There's no way to tell the materialized view to not refresh unless there has a been a change to the underlying data when using a complex MV ?

The structure I'm dealing with doesn't change very often.  It seems like such a waste to rebuild the complete structure every hour when it might only change once a quarter if that.

My last part to this question, then, is what happens if a query attempts to execute against the MV while a rebuild is in progress (or vice versa, a rebuild starts while a query is running)?

I'm hoping that it will just hold a lock while the first process does it's thing and the second process to start will wait until the first operation completes and then complete successfully.
0
Veeam Disaster Recovery in Microsoft Azure

Veeam PN for Microsoft Azure is a FREE solution designed to simplify and automate the setup of a DR site in Microsoft Azure using lightweight software-defined networking. It reduces the complexity of VPN deployments and is designed for businesses of ALL sizes.

 
LVL 35

Accepted Solution

by:
johnsone earned 2000 total points
ID: 38763281
This may have changed in 11 as I have not checked yet, but on a complete refresh, while the refresh is in process the table will appear empty to all users.  The reason is that the first thing a refresh of a complex materialized view does is truncate the table.

What I have seen done if you want it to always be accessible is to actually have 2 materialized views and a synonym.  The synonym points to the current materialized view.  You refresh the other view and once it completes successfully change the synonym to the one that just refreshed.  Users access the synonym and the fact that there is 2 views is hidden to them.
0
 
LVL 23

Author Comment

by:Steve Wales
ID: 38763354
OK maybe I can look at it that way.  It doesn't take long for the refresh to complete, a matter of a few seconds, but because of Murphy's Law, you know that the users will want to query it in that short window.

Would need to modify the job that does the refresh to play synonym dancing, but that's doable.

I'll play with it and get back to you.  Thanks.
0
 
LVL 23

Author Closing Comment

by:Steve Wales
ID: 38769363
Thanks.  This is how they want to proceed, so we'll go that way.
0

Featured Post

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Why doesn't the Oracle optimizer use my index? Querying too much data Most Oracle developers know that an index is useful when you can use it to restrict your result set to a small number of the total rows in a table. So, the obvious side…
This article started out as an Experts-Exchange question, which then grew into a quick tip to go along with an IOUG presentation for the Collaborate confernce and then later grew again into a full blown article with expanded functionality and legacy…
This video explains at a high level with the mandatory Oracle Memory processes are as well as touching on some of the more common optional ones.
This video shows information on the Oracle Data Dictionary, starting with the Oracle documentation, explaining the different types of Data Dictionary views available by group and permissions as well as giving examples on how to retrieve data from th…
Suggested Courses
Course of the Month13 days, 7 hours left to enroll

581 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question