The Materialized View - ORA-12052: is unable to fast refresh materialized view
Hello
I was hitting my head all day trying to create materialized views. I have made some progress, but have hit a brick wall, unfortunately!
Basically, I have been invited to take a view and see if I can get the benefits of performance by transforming all or part of it in materialized views. Because the underlying tables of the config is updated quite frequently, I want to fast refresh materialized views on commit. However, when I try to create a materialized view containing an outer join in an aggregated materialized view table, I get ORA-12052: is unable to fast refresh materialized view.
I went through the documentation and also Rob van Wijkvery useful series of blogs on the topic (especially http://rwijk.blogspot.co.uk/2009/09/fast-refreshable-materialized-view.html) but have not found anything that matches. Maybe I missed something somewhere along the line, or maybe I'm asking just something completely impossible?
My db is 11.2.0.2.
Here's the test scripts, I've worked with that:
drop materialized view test1_test2_mv;
Drop materialized view test2 journal;
drop table test2;
Drop materialized view test1_mv newspaper;
drop materialized view test1_mv;
Drop materialized view test1 journal;
drop table test1;
create table test1 (identification number,
type varchar2 (10),
number of Val,
update_time date,
constraint t1_pk primary key (id, type, val));
Insert into test1
Select 1, 'a', 1001, sysdate - 10/24 Union double all the
Select 1, 'b', 1003, sysdate - 9/24 Union double all the
Select 1, 'c', 1002, sysdate - 8/24 Union double all the
Select 1, had ', 1004, sysdate - 7/24 Union double all the
Select 1, 'e', 1005, sysdate - 6/24 Union double all the
Select 1, 'c', 1006, sysdate - 5/24 Union double all the
Select 2, 'a', 1002, sysdate - 4/24 Union double all the
Select 2, 'b', 1005, sysdate - 3/24 Union double all the
Select 3, 'a', 1001, sysdate - 2/24 Union double all the
Select 3, 'c', 1006, sysdate - 1/24 Union double all the
Select 3, 'e', 1008, sysdate - 2/24 Union double all the
Select option 4, has ', 1004, sysdate - 3/24 Union double all the
Select 5, 'b', 1002, sysdate - 4/24 Union double all the
Select 5, 'g', 1001, sysdate - 5/24 Union double all the
Select 6, 'h', 1004, sysdate - 6/24 Union double all the
Select 7, 'b', 1007, sysdate - 7/24 Union double all the
Select 7, had ', 1001, sysdate - 8/24 double;
commit;
Select * from test1;
CREATE MATERIALIZED VIEW LOG ON test1
WITH rowid, primary key (update_time)
including the new values;
Test1_mv CREATE MATERIALIZED VIEW
IMMEDIATE CONSTRUCTION
COOL OFF QUICKLY ON COMMIT
Did YOU SELECT id,
MAX (case when type = "there" end of val) THAT col_a,.
MAX (case when type = 'b', then val end) AS col_b,.
MAX (case when type = 'c' then end val) AS col_c,.
MAX (case when type = ' then end of val) AS col_d,
MAX (update_time) AS update_time
OF test1
WHERE TYPE in ('a',
« b »,
« c »,
a ')
GROUP BY id;
CREATE MATERIALIZED VIEW LOG ON test1_mv
WITH rowid
including the new values;
create table test2 (identification number,
col2 number,
COL3 varchar2 (10),
number of COL4,
constraint t2_pk primary key (id));
Insert into test2
Select 1, 1, 'bob', 1 double Union all
Select 2, 1, "sue", 1 double Union all
Select 3, 1, 'tom', 1 double Union all
Select 4, 1, 'jay', 1 double Union all
Select 5, 1, 'art', 1 double Union all
Select 6, 1, 'kay', 1 double Union all
Select 7, 1, 'max', 1 double Union all
Select 8, 1, 'tim', 1 double Union all
Select 9, 1, "liz", 1 from dual;
commit;
CREATE MATERIALIZED VIEW LOG ON test2
WITH rowid, primary key
including the new values;
Test1_test2_mv CREATE MATERIALIZED VIEW
IMMEDIATE CONSTRUCTION
COOL OFF QUICKLY ON COMMIT
LIKE SOME t2.rowid,.
T1.ID,
T1.col_a,
T1.col_b,
T1.col_c,
T1.col_d,
T1.update_time,
T2.col2,
T2. COL3
OF test1_mv t1,.
Test2 t2
WHERE (+) t1.id = t2.id; -symbol of outer join is not correctly displayed on the forums without space, grr!
ORA-12052: is unable to fast refresh materialized view TEST1_TEST2_MV
Y at - it any way I can get the materialized view fast refresh on commit or I asking the impossible?
Add t1.rowid:
SQL > CREATE MATERIALIZED VIEW test1_test2_mv
2 BUILD IMMEDIATE
3 QUICK REFRESH YOU COMMIT
4 AS t2.rowid SELECT rid2,
5 t1.rowid rid1,
6 t1.id
T1.col_a 7,.
T1.col_b 8,.
T1.col_c 9,.
T1.col_d 10,
T1.update_time 11,
T2.col2 12,
13 t2.col3
14 OF test1_mv t1,
15 test2 T2
16 WHERE t1.id = t2.id
17.
Materialized view created.
SQL > select * from test1_test2_mv
2.
RID2 RID1 ID COL_A, COL_B, COL_C COL_D UPDATE_TIME COL2 COL3
------------------ ------------------ ---------- ---------- ---------- ---------- ---------- ------------------- ---------- ----------
AAAYB6AANAAAANDAAA AAAYB/AANAAAAN/AAA 1 1001 1003 1006 1004 25 / 06 / 2014 12:54:16 1 bob
AAAYB6AANAAAANDAAB AAAYB/AANAAAAN/AAB 2 1002 1005 25 / 06 / 2014 1 sue 14:54:16
AAAYB6AANAAAANDAAC AAAYB/AANAAAAN/AAC 3 1001 1006 25 / 06 / 2014 16:54:16 1 tom
AAAYB/AANAAAAN/AAD AAAYB6AANAAAANDAAD 4 1004 25/06/2014 14:54:16 1 jay
AAAYB6AANAAAANDAAE AAAYB / AANAAAAN / AAE 5 1002 2014/06/25 13:54:16 1 art
AAAYB6AANAAAANDAAF AAAYB/AANAAAAN/AAG 7 1007 1009 25 / 06 / 2014 10:54:16 max 1
AAAYB/AANAAAAN/AAH 1 tim
AAAYB/AANAAAAN/AAF 1 kay
AAAYB/AANAAAAN/AAI 1 liz
9 selected lines.
SQL > update of test2
2 set col3 = "fly."
3 where id = 7
6 m
1 line update.
SQL > validation
2.
Validation complete.
SQL > select * from test1_test2_mv
2.
RID2 RID1 ID COL_A, COL_B, COL_C COL_D UPDATE_TIME COL2 COL3
------------------ ------------------ ---------- ---------- ---------- ---------- ---------- ------------------- ---------- ----------
AAAYB6AANAAAANDAAA AAAYB/AANAAAAN/AAA 1 1001 1003 1006 1004 25 / 06 / 2014 12:54:16 1 bob
AAAYB6AANAAAANDAAB AAAYB/AANAAAAN/AAB 2 1002 1005 25 / 06 / 2014 1 sue 14:54:16
AAAYB6AANAAAANDAAC AAAYB/AANAAAAN/AAC 3 1001 1006 25 / 06 / 2014 16:54:16 1 tom
AAAYB/AANAAAAN/AAD AAAYB6AANAAAANDAAD 4 1004 25/06/2014 14:54:16 1 jay
AAAYB6AANAAAANDAAE AAAYB / AANAAAAN / AAE 5 1002 2014/06/25 13:54:16 1 art
AAAYB/AANAAAAN/AAH 1 tim
AAAYB/AANAAAAN/AAF 1 kay
AAAYB/AANAAAAN/AAI 1 liz
AAAYB6AANAAAANDAAF AAAYB/AANAAAAN/AAG 7 1007 1009 25 / 06 / 2014 10:54:16 1 rob
9 selected lines.
Tags: Database
Similar Questions
-
ORA-12052: is unable to fast refresh materialized view string.string
Hello
I try to create the same xx and xx, after creating a newspaper, I get this error. Follow my structure:
When you try to create, I get the error ORA-12052:create table PEDIDO ( NR_PEDIDO NUMBER not null, DESCRICAO_PEDIDO VARCHAR2(10) ); alter table PEDIDO add constraint PEDIDO_PK primary key (NR_PEDIDO); create table ITEM_PEDIDO ( NR_PEDIDO NUMBER not null, NR_PRODUTO VARCHAR2(10) not null ); alter table ITEM_PEDIDO add constraint ITEM_PK primary key (NR_PEDIDO, NR_PRODUTO); alter table ITEM_PEDIDO add constraint PEDIDO_ITEM_FK foreign key (NR_PEDIDO) references PEDIDO (NR_PEDIDO) on delete cascade; create index INDEX_ITEM_PEDIDO on ITEM_PEDIDO (NR_PEDIDO); insert into pedido values (1, 'A'); insert into pedido values (2, 'B'); insert into item_pedido values (1, 'X'); insert into item_pedido values (1, 'Z'); insert into item_pedido values (2, 'X'); commit;
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0drop materialized view log on pedido; drop materialized view log on item_pedido; create materialized view log on pedido; create materialized view log on item_pedido; create materialized view mv_pedido_item refresh fast as select pe.nr_pedido, pe.descricao_pedido, ip.nr_produto from pedido pe, item_pedido ip where pe.nr_pedido = ip.nr_pedido;
Hello Luiz,
Thank you for provding test cases.
SQL> drop materialized view log on pedido; Materialized View log dropped. SQL> drop materialized view log on item_pedido; Materialized View log dropped. SQL> create materialized view log on pedido with rowid; Materialized View log created. SQL> create materialized view log on item_pedido with rowid; Materialized View log created. SQL> create materialized view mv_pedido_item refresh fast as select pe.nr_pedido, pe.descricao_pedido, ip.nr_produto, pe.rowid pe_rowid, ip.rowid ip_rowid from pedido pe, item_pedido ip where pe.nr_pedido = ip.nr_pedido; Materialized view created. BANNER -------------------------------------------------------------------------------- Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production 1 row selected.
Concerning
Peter -
Materialized view conducive to fast refresh method
In AWM when I select refresh FASTER method and select the materialized view, get the error below:
"Quick Refresh method requires the materialized view logs and a complete refresh previously run the MV cube." I need this fast a cube materialized view refresh, so that it performs an incremental refresh and re-aggregation of only the changed lines in the source table.
can someone help me on this?Remember to choose the 'Force' that runs fast if possible update, as otherwise it performs a complete refresh. You can also specify Complete as the Refresh method in the dialog box Assistant Maintenance first, you keep the cube.
You'll need create materialized on all the base tables, view logs if you have not already done so, otherwise the cube will be able to do a fast refresh (differential).
-
Experts,
I'm trying to create a YOUNG refreshable ON COMMIT MV (xyz) using a table (circuit) and quickly updateable on validation MV (abc), but get an error:
SQL error: ORA-12054: cannot set the attribute ON COMMIT refresh for the materialized view
12054 00000 - "cannot set the refresh attribute COMMIT for the materialized view.
* Cause: The materialized view did not meet the requirements for update to
moment of validation.
* Action: Specify only valid options.
1] MV abc
= MV abc defined as below =.CREATE MATERIALIZED view abc_MV
Immediate CONSTRUCTION
REFRESH QUICKLY YOU COMMIT using constraints of trust
WITH ROWID AS SELECT n.*,.
n.ROWID noderowid
node n
where n.nodetype in (1610000069,1610007267);
-Above works OK and MV connect you on table node is created successfully
=====================================================
[ 2] Circuit Board
======================================================
CREATE MATERIALIZED VIEW LOG ON Cramer.Circuit WITH SEQUENCE, ROWID ( ) -all columns of table ofcircut parentheses
INCLUDING THE NEW VALUES;
-More top works OK and MV connect you on table circuit is created successfully
======================================================
[3] trying to create MV xyz
======================================================
CREATE MATERIALIZED VIEW LOG ON cramer.abc_MV WITH SEQUENCE, ROWID ( ) -all columns of abc_MV brackets
INCLUDING THE NEW VALUES;
-Above works OK and log on ABC MV MV gets created successfully
-Problematic step below
Xyz_MV CREATE MATERIALIZED VIEW
IMMEDIATE CONSTRUCTION
REFRESH QUICKLY YOU COMMIT using constraints of trust
AS
SELECT c., c.rowid circuit_rowid, n.rowid tr_rowid
the circuit c, abc_mv n
where circuit2startnode = n.nodeid
and c.rpplanId = n.rpplanId;
==========================================================Clues on how to solve this problem and make quickly updatable ON Commit MV xyz
Thanks in advance.
Chanchal,
If you can read my original post carefully you may have noticed that all these restrictions will not apply in my case.
All,
In any case I found the solution to my problem.
There are a few additional restrictions for materialized views multilayer
Additional Restrictions for master materialized views
The following types of materialized views may not be masters of editable materialized views:
ROWID
materialized views- Complex materialized views
- Read-only materialized views
I've updated the underlying MV abc below and everything worked like a charm
CREATE MATERIALIZED view abc_MV
Immediate CONSTRUCTION
REFRESH QUICKLY YOU COMMIT using constraints of trust
IN SELECT
n.*, n.rowid noderowid, nt.rowid nodetyperowid
the node n, nodetype_m nt
where n.node2nodetype = nt.nodetypeid
and nt.nodetypeid in (1610000069,1610007267);
Note: To ADD a join without which I was getting error below (although had primary key on the table of the node)
SQL error: ORA-23415: materialized view log for "NODE" does not save the primary key
23415 00000 - "view the log for materialized \"%s\".\"%s\"does not save the primary key.
* Cause: A primary key materialized view is refreshed quickly, but the
The materialized view log does not record the primary key information.
* Action: Use CREATING MATERIALIZED VIEW LOG... Command to add a PRIMARY KEY to
start recording of the primary key information in the materialized view
Newspaper.
-
Failed to create the fast refresh on the materialized view
Hi, I am creating a materialized on the tables with fast refresh view on commit but I get an error message.
I have created the following logs:
Bonus CREATE MATERIALIZED VIEW LOG ON
Users TABLESPACE
WITH THE PRIMARY KEY
INCLUDING THE NEW VALUESUsed to CREATE MATERIALIZED VIEW LOG ON
Users TABLESPACE
WITH THE PRIMARY KEY
INCLUDING THE NEW VALUESI then try to create the following:
Test.BAM CREATE MATERIALIZED VIEW
IMMEDIATE CONSTRUCTION
COOL OFF QUICKLY ON COMMIT
AS
SELECT a.dept_no, SUM (a.salary)
EMPLOYEE a, b bonus
WHERE a.employee_id = b.employee_id
GROUP BY dept_noWhen I do that, I get the following error:
. ORA-12032: cannot use column rowid of materialized
view log on 'test '. "" BONUS ".
If I change to a full refresh, it works pretty well. If I create a MV with a fast refresh on a query just within the limits of the table bonus it also works very well, for example ' select * bonus where employee_id = 2'
What I am doing wrong? Also when looking at the notes for MV connects in some places, he said using the primary key and others, he says to the sequence of use and row_id. Which is correct and what difference does it make?
11.2 aix.
Thank you very much
I suggest that investigate you the reason why your MV is not quickly updatable with the following method:
(1) create MV_CAPABILITIES_TABLE with @?/rdbms/admin/utlxmv.sql
(2) exec ('BAM') dbms_mview.explain_mview
3)
column format a100 msgtxt
column related_text format a20
SELECT the possible, capability_name, related_text,
msgtxt
OF mv_capabilities_table;
That should tell you the reason why he isn't yet quickly updatable.
There was a popular quote on men and fishing, but I don't remember it for now :-)
Kind regards
Uwe Hesse
-
Problem with the materialized view
Hello
I encountered a problem...
I have a materialized view which I update via a button in my application. I used the following code to do this:
DBMS_REFRESH. Refresh (the "SCHEME".) "MY_MV" ');
As you can see the pattern, I have included in the appeal, and which worked fine until now.
We have now 2 apps. in the same PB. Its actually the same app... Only for the development and the other for testing. The app development uses a different schema and this effect cannot use the call above, it seems.
I offcause want to ommit using the schema in the call, because otherwise I would have to change every time I move to App Development to test the app. But when I ommit it I get the following error:
ORA-23404: refresh, group "APEX_PUBLIC_USER". "' MY_MV ' does not exist
How to solve this?
And another thing... My selection around the application does not use the scheme, then how does apex know what sound scheme when his choice, but he does not know when its doing a dbms_refresh?
Hope someone is smarter than me :)
BjarkeHello
Try this waydeclare my_schema varchar2(10); begin select owner into my_schema from apex_applications where application_id=:APP_ID; dbms_refresh.refresh( my_schema || '.'|| 'MY_MV'); end;
CITY
-
The materialized view log and user...
Hello
Suppose a user, we will call him A has a table and another user B must create a log of materialized view on the table that a user has.
While user B have all the privileges of object (direct priv insert, update, delete... not through a role) on the table to the user may not create a log of mv on this table on its schema...
Thus, the insert/update/delete stmts on < table_name > are run successfully (after having logged on as user B).
The error message ' ORA-00942: table or view does not exist ' appears when I run the command:
Connect B/B;
create log view materialized on table_name with sequence including new values;
Note: I use ORADB 10.2.0.4 and it stands for table-name to user B (which tries to create the log of mv on)...
The req. above is possible somehow?
Thank you
SIMThe documentation says the following:
The materialized view log is created in the same schema as the master of the target.
HTH!
-
Original title: I tried to apply the photo viewer to open a file and the photo viewer icon replaced each icon on my desktop. Now I can't open anything on my desktop. What is going on?
The name is below the icon, but the correct icon has been replaced by windows Photo Viewer icon. When I click to open it, it says: windows Photo Viewer cannot open this photo because Photo Viewer does not support this file format, or you do not have the latest updates... I don't know what I did!
Hi,
Thanks for posting your question in the Microsoft Community.
From your problem description, I understand that you are unable to access the photo viewer; and also cannot access the desktop icons because they are changed to the photo viewer icon. Please let me know if you do not experience this problem.
I understand the inconvenience caused to you. I'll help you solve the problem!
Before troubleshooting, I have little information on the issue.
1. did you of recent changes to the computer before this problem?
Try the methods suggested in the article below and check after each method:
Method 1: Icons change incorrectly in Windows: http://support.microsoft.com/kb/2396571
Registry warning: Important This section, method, or task contains steps that tell you how to modify the registry. However, serious problems can occur if you modify the registry incorrectly. Therefore, make sure that you proceed with caution. For added protection, back up the registry before you edit it. Then you can restore the registry if a problem occurs. For more information about how to back up and restore the registry, click on the number below to view the article in the in the Microsoft Knowledge Base: 322756. How to back up and restore the registry in Windows: http://windows.microsoft.com/en-us/windows-vista/Back-up-the-registry
Method 2: Run scan files system (CFS) auditor, to repair missing or corrupted system files.
How to use the System File Checker tool to fix the system files missing or corrupted on Windows Vista or Windows 7: http://support.microsoft.com/kb/929833
If the problem persists, post your reply with the results and the questions asked above. We are happy to help you further in the advanced troubleshooting steps!
It will be useful.
-
Trigger on the materialized view
Hello
I have the scenario based (Database 11 g):
There is a view materialized (PERSON), which contains the ID and NAME fields. This MV is update daily with a fast refresh.
I have a second array (NAMES), with ID and NORM_NAME. This table contains the name of the person, without special characters.
For example, for recording / * 1 BJORN * / in the PERSON table
I would check * 1 BJORN * / in table NAMES.
Problem is how to fill the NAME table after the filling of the materialized view.
I used a trigger AFTER INSERT or update, as described below, but even if I update the master table (for this purpose, update the MV), I have only to trigger inserts.
Is there a way to implement a trigger "after update" on a materialized view, or do I need another approach?
/*
create or replace TRIGGER TRG_TESTE_MV
AFTER INSERT OR UPDATE ON THE PERSON
REFERENCING OLD AS OLD AGAIN AS NEW
FOR EACH LINE
BEGIN
IF THE INSERTION
INSERT THE NAMES
VALUES
(: NEW.id,:NEW.NAME);
END IF;
IF THE UPDATE CAN
UPDATE OF NAMES
SET NAME =: NEW.NAME WHERE ID =: NEW.id;
END IF;
END;
*/
Thanks for any help
Your trigger fires, but I doubted that you will be satisfied with the results. You really need to understand how to refresh process works before you begin creating triggers of MV:
SQL > create table emp1 in select * from EMP
2.Table created.
SQL > create materialized view emp1 with rowid journal
2.Materialized view log that is created.
SQL > create materialized view emp1_mv
2 fast refresh
3 on request
4 with rowid
5 as
6 select * from emp1
7.Materialized view created.
SQL > create or replace
trigger 2 emp1_mv_biudr
3 before inserting
4 or update
5 or delete
6 on emp1_mv
7 for each line
Start 8
9 insert then dbms_output.put_line ('INSERT' |: new.ename); end if;
10 if the deletion then dbms_output.put_line ('REMOVE' |: old.ename); end if;
11 end;
12.Trigger created.
SQL > insert
2 in emp1 (empno, ename, sal)
3 values(1,'X',1000)
4.1 line of creation.
SQL > validation
2.Validation complete.
SQL > set serveroutput on
SQL > exec dbms_mview.refresh ('emp1_mv', 'f');
INSERTION OF XPL/SQL procedure successfully completed.
SQL > update emp1
2 set sal = sal + 1
3 where ename ('King', 'JONES')
4.2 lines to date.
SQL > validation
2.Validation complete.
SQL > set serveroutput on
SQL > exec dbms_mview.refresh ('emp1_mv', 'f');
INSERTION OF JONES
INSERTION OF KINGPL/SQL procedure successfully completed.
SQL > delete emp1
2 where in ename ('ALLEN', 'SMITH')
3.2 deleted rows.
SQL > validation
2.Validation complete.
SQL > set serveroutput on
SQL > exec dbms_mview.refresh ('emp1_mv', 'f');PL/SQL procedure successfully completed.
SQL >
As you can see, refresh MV updates ever. Results update underlying table to remove/insert in MV. That's why your trigger will not give the results that you expected.
SY.
-
Create a materialized by an action of the page view
I created an application to allow users to download data from payroll data loading. I also have a view of materialzied based on these data. What I want to do is to run create or replace the script to update the display with new data. Ideally, I'd like the button to finish so that the action of fire. How would I do that?If the proposed process allows you to recoil in horror, I'm open to a better way to do it. The requirement is that a materialized view is created/replaced when the data loading process is complete. How this occurs, it is to me.
I'm under Apex 4.2 on 11g.
Thank you!
Hello
See the documentation for the refresh of the materialized views
Kind regards
Jari -
Re: view opaque and the materialized view
Hi Experts,
I want some clarification of opaque and view view in the physical layer OBIEE materialized
-> what is the main difference between the opaque view and materialized in the RPD perspective view, we have to do this at the level of the RPD or DB.
-> I want the list of opaque opinion and materialized in the RPD view how I should do.
-> How opaque views will degrade the performance and how a materialized view will improve performance at the level of the report.
-> In scenarios that we use view opaque and the view materialized (if possible with a scenario for the best permanent basis).
Thanks in advance.
I want some clarification of opaque and view view in the physical layer OBIEE materialized
-> What is the main difference between opaque view and create the materialized view in the RPD point of view, we have to do this at the level of the RPD or DB.
Opaque views is a SQL statement that is defined in the physical layer, OBIEE will use all in the construction of a SQL query. In a way it's not different from a database view, except it is set in OBIEE only. Alternatively, you can deploy an Opaque view, which pushes its definition in the database. Read more about it here: work with physical tables, Cubes and joins - 11 g Release 1 (11.1.1)
A materialized view (MV) is a database concept where the results of a SQL statement are physicalised like a table, and therefore as OBIEE is a MV is just another physical array
-> If I want a list of the opaque views and materialized in the RPD view how I should do.
To find opaque views, use the function «Repository of applications» administration tool Search physical Tables and set up a filter on the Type = Select
Screenshot: https://www.evernote.com/shard/s16/sh/5c843e47-bff1-4d4b-b847-be98f3a2ec09/cf060a6cd9805f687fa0b5b46f3f0020
To find materialized views, you will need to query the catalog in your database (for example select object_name, object_type from user_objects where type_objet = "MATERIALIZED VIEW" ;) and compare it to the list of tables in your SPR)
-> How opaque views will degrade the performance and how a materialized view will improve performance at the level of the report.
A materialized view is materialized, in other words, the results are already stored in the database. This means usually there will be more efficient because all the joins and aggregations, etc. will be settled in advance.
-
Do not to use the materialized view
I wonder if we've already created a materialized view, can we prefer not to use this point of view, materialized for a query? I want to say can we determine if a query uses MV and other queries don't use MV? Thank you.
Hello Indra,
I'm not completely sure about that, but you can read (with examples) concerning the indications- NO_REWRITE and REWRITE
Text over the doc links:
Council of REWRITING:
The
REWRITE
Council instructs the optimizer to rewrite a query regarding the materialized views when possible, regardless of cost. Use theREWRITE
trick with or without a display list. If you useREWRITE
with a view list and the list contains an eligible materialized view, then Oracle uses this view regardless of its cost.Tip NO_REWRITE:
The
NO_REWRITE
Council tells the optimizer to disable the rewrite of the query to the query block, of the substitution of the definition of the parameterQUERY_REWRITE_ENABLED
.Be aware! -The
NOREWRITE
suspicion has been deprecated. Use theNO_REWRITE
hint instead.Read here: setting QUERY_REWRITE_ENABLED
-Nordine
-
Change the definition of the materialized view while maintaining access for users uninteruupted
Hello
We have a system report and the need to change the report definition mv access - like to do it without interruption.
Is this possible?
the sql behind mv was change picks up so column of another table.
Have you heard but not used for dbms_redefinition tables
Thank you
It is built in the Oracle solution for this one, where you can edit the definition WITHOUT interruption. You can drop the materialized view existing with the clause "save table" and rebuilt the view materialized on 'predefined table'. I googled this example for you
create materialized view mv1 as select dept , count(*) as cnt from scott.emp;
We want to change the statement so that only dept more 5 will be calculated
drop materialized view mv1 preserve table;
Notice that
PRESERVE TABLE
clause - mv1 table is not droped - single layer mview.desc mv1
now, we create the mview with a different query on top of the existing table
create materialized view mv1 on prebuilt table as select dept , count(*) as cnt from scott.emp where dept > 5;
Notice that
on prebuilt table
the mview uses the existing object clause.exec dbms_mview.refresh_mview('mv1');
http://StackOverflow.com/questions/18085894/redefine-MATERIALIZED-view-with-no-downtime
http://Arup.blogspot.com/2009/01/ultra-fast-MV-alteration-using-prebuilt.html
-
Elapsed time for the materialized view vs Master table query
Hello all;
Small confusion about time up for the vs Master materialized view table query
SQL > select count (*), sum (quan_sold), sum (amt_sold) of the sale;
COUNT (*) SUM (QUAN_SOLD) SUM (AMT_SOLD)
6000000 12000000 720480000
Elapsed time: 00:00:30.54
SQL > create materialized view mv1
Materialized view created.
2 activate the rewrite of the query as
3. select count (*), sum (quan_sold), sum (amt_sold) of the sale;
Elapsed time: 00:00:01.45
SQL > select count (*), sum (quan_sold), sum (amt_sold) of the sale;
COUNT (*) SUM (QUAN_SOLD) SUM (AMT_SOLD)
6000000 12000000 720480000
Elapsed time: 00:00:00.01
Please see the three cases "Elapsed Time"...
When comparing other cases.
1. my query takes long time (30.54), extraction of data from the sale
2. create a materialized view takes less time (01:45) why?
Source: http://uhesse.com/2009/07/08/brief-introduction-into-materialized-views/>
Small confusion about elapsed time for the materialized view vs Master table querySQL > select count (*), sum (quan_sold), sum (amt_sold) from the sale.
COUNT (*) SUM (QUAN_SOLD) SUM (AMT_SOLD)
6000000 12000000 720480000
Elapsed time: 00:00:30.54SQL > create materialized view mv1
2 activate the rewrite of the query as
3. select count (*), sum (quan_sold), sum (amt_sold) of the sale;
Materialized view created.
Elapsed time: 00:00:01.45SQL > select count (*), sum (quan_sold), sum (amt_sold) from the sale.
COUNT (*) SUM (QUAN_SOLD) SUM (AMT_SOLD)
6000000 12000000 720480000
Elapsed time: 00:00:00.01Please see the three cases "Elapsed Time"...
When comparing other cases.
1. my query takes long time (30.54), extraction of data from the sale
2. create a materialized view takes less time (01:45) why?
>
Many queries take less time the second time you run them. After the first performance, there may be many, if not all, lines in the buffer cache. Then the second round will not make any or all e/s physical but will obtain data from the buffer cache.Also, you haven't checked that the MV was even used for the second run.
Drop the MV and make the query several times and means of the time. Then create the MV and do the same thing.
-
performance of the queries on the main tables of the materialized view vs
Hello
I'm afraid of strange behavior in db, on my paintings of master UDBMOVEMENT_ORIG (26mil.rows) and UDBIDENTDATA_ORIG (18mil.rows) is created the materialized view TMP_MS_UDB_MV (UDBMOVEMENT stands for this object) that meets certain default conditions and the join on these paintings of master condition. MV got on the lines of 12milions. I created MV for poll not so huge objects, MV got 3GB, paintings of master toghether 12 GB. But I don't understand that physical reads and becomes compatible is less on MV that on the main tables, the final execution time is shorter on the master tables. See my journal below.
Why?
Thanks for the replies.
SQL > set echo on
SQL > @flush
SQL > alter system flush buffer_cache;
Modified system.
Elapsed time: 00:00:00.20
SQL > alter system flush shared_pool;
Modified system.
Elapsed time: 00:00:00.65
SQL > SELECT
UDBMovement.zIdDevice 2, UDBMovement.sDevice, UDBMovement.zIdLocal, UDBMovement.sComputer, UDBMovement.tActionTime, UDBIdentData.sCardSubType, UDBIdentData.sCardType, UDBMovement.cEpan, UDBMovement.cText, UDBMovement.lArtRef, UDBMovement.sArtClassRef, UDBMovement.lSequenz, UDBMovement.sTransMark, UDBMovement.lBlock, UDBMovement.sTransType, UDBMovement.lGlobalID, UDBMovement.sFacility, UDBIdentData.sCardClass, UDBMovement.lSingleAmount, UDBMovement.sVAT, UDBMovement.lVATTot, UDBIdentData.tTarifTimeStart, UDBIdentData.tTarifTimeEnd, UDBIdentData.cLicensePlate, UDBIdentData.lMoneyValue, UDBIdentData.lPointValue, UDBIdentData.lTimeValue, UDBIdentData.tProdTime, UDBIdentData.tExpireDate
UDBMOVEMENT_orig UDBMovement 3, Udbidentdata_orig UDBIdentData
4. WHERE
5 UDBMovement.lGlobalId = UDBIdentData.lGlobalRef (+) AND UDBMovement.sComputer = UDBIdentData.sComputer (+)
6 AND UDBMovement.sTransType > 0 AND UDBMovement.sDevice < 1000 AND UDBMovement.sDevice > = 0 AND UDBIdentData.sCardType IN (2) AND (bitand(UDBMovement.sSaleFlag,1) = 0 AND bitand(UDBMovement.sSaleFlag,4) = 0) AND UDBMovement.sArtClassRef < 100
7 AND UDBMovement.tActionTime > = TO_DATE (May 5, 2011 00:00:00 ',' dd/mm/yyyy hh24:mi:ss') + 0.25 AND UDBMovement.tActionTime < TO_DATE (May 5, 2011 00:00:00 ',' dd/mm/yyyy hh24:mi:ss') + 0.5
8 ORDER BY tActionTime, lBlock, lSequenz;
4947 selected lines.
Elapsed time: 00:00:15.84
Execution plan
----------------------------------------------------------
Hash value of plan: 1768406139
------------------------------------------------------------------------------------------------------------
| ID | Operation | Name | Lines | Bytes | TempSpc | Cost (% CPU). Time |
------------------------------------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | 7166 | 1238K | 20670 (1) | 00:04:09 |
| 1. SORT ORDER BY | 7166 | 1238K | 1480K | 20670 (1) | 00:04:09 |
| 2. NESTED LOOPS |
| 3. NESTED LOOPS | 7166 | 1238K | 20388 (1) | 00:04:05 |
|* 4 | TABLE ACCESS BY INDEX ROWID | UDBMOVEMENT_ORIG | 7142 | 809K | 7056 (1) | 00:01:25 |
|* 5 | INDEX RANGE SCAN | IDX_UDBMOVARTICLE | 10709. 61 (0) | 00:00:01 |
|* 6 | INDEX UNIQUE SCAN | UDBIDENTDATA_PRIM | 1 | | | 1 (0) | 00:00:01 |
|* 7 | TABLE ACCESS BY INDEX ROWID | UDBIDENTDATA_ORIG | 1. 61. 2 (0) | 00:00:01 |
------------------------------------------------------------------------------------------------------------
Information of predicates (identified by the operation identity card):
---------------------------------------------------
4 - filter("UDBMOVEMENT".") STRANSTYPE"> 0 AND 'UDBMOVEMENT '. "" SDEVICE ' < 1000 AND
BITAND ("SSALEFLAG", 1) = 0 AND "UDBMOVEMENT". "" SDEVICE ' > = 0 AND BITAND ("UDBMOVEMENT". "SSALEFLAG «(, 4) = 0)" "
5 - access("UDBMOVEMENT".") TACTIONTIME' > = TO_DATE (' 2011-05-05 06:00 ',' syyyy-mm-jj)
('HH24:mi:SS) AND "UDBMOVEMENT". "' TACTIONTIME ', TO_DATE (' 2011-05-05 12:00 ',' syyyy-mm-jj)
('HH24:mi:SS) AND "UDBMOVEMENT". ("' SARTCLASSREF" < 100)
filter ("UDBMOVEMENT". "SARTCLASSREF" < 100)
6 - access("UDBMOVEMENT".") LGLOBALID "=" UDBIDENTDATA. " "" LGLOBALREF "AND
'UDBMOVEMENT '. "' SCOMPUTER"="UDBIDENTDATA." ("' SCOMPUTER")
7 - filter("UDBIDENTDATA".") SCARDTYPE "= 2)
Statistics
----------------------------------------------------------
543 recursive calls
0 db block Gets
84383 compatible Gets
4485 physical reads
0 redo size
533990 bytes sent via SQL * Net to client
3953 bytes received via SQL * Net from client
331 SQL * Net back and forth to and from the client
kinds of 86 (memory)
0 sorts (disk)
4947 lines processed
SQL > @flush
SQL > alter system flush buffer_cache;
Modified system.
Elapsed time: 00:00:00.12
SQL > alter system flush shared_pool;
Modified system.
Elapsed time: 00:00:00.74
SQL > SELECT UDBMovement.zIdDevice, UDBMovement.sDevice, UDBMovement.zIdLocal, UDBMovement.sComputer, UDBMovement.tActionTime, UDBMovement.sCardSubType, UDBMovement.sCardType, UDBMovement.cEpan, UDBMovement.cText, UDBMovement.lArtRef, UDBMovement.sArtClassRef, UDBMovement.lSequenz, UDBMovement.sTransMark, UDBMovement.lBlock, UDBMovement.sTransType, UDBMovement.lGlobalID, UDBMovement.sFacility, UDBMovement.sCardClass, UDBMovement.lSingleAmount, UDBMovement.sVAT, UDBMovement.lVATTot, UDBMovement.tTarifTimeStart, UDBMovement.tTarifTimeEnd, UDBMovement.cLicensePlate, UDBMovement.lMoneyValue, UDBMovement.lPointValue, UDBMovement.lTimeValue, UDBMovement.tProdTime
2. OF UDBMOVEMENT WHERE
3 UDBMovement.sTransType > 0 AND UDBMovement.sDevice < 1000 AND UDBMovement.sDevice > = 0 AND UDBMovement.sCardType IN (2) AND (bitand(UDBMovement.sSaleFlag,1) = 0 AND bitand(UDBMovement.sSaleFlag,4) = 0) AND UDBMovement.sArtClassRef < 100
4. AND UDBMovement.tActionTime > = TO_DATE (May 5, 2011 00:00:00 ',' the hh24: mi: ss' dd/mm/yyyy) + 0.25
5 AND UDBMovement.tActionTime < TO_DATE (May 5, 2011 00:00:00 ',' the hh24: mi: ss' dd/mm/yyyy) + 0.5 ORDER BY tActionTime, lBlock, lSequenz;
4947 selected lines.
Elapsed time: 00:00:26.46
Execution plan
----------------------------------------------------------
Hash value of plan: 3648898312
-----------------------------------------------------------------------------------------------------------
| ID | Operation | Name | Lines | Bytes | Cost (% CPU). Time |
-----------------------------------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | 2720 | 443K | 2812 (1) | 00:00:34 |
| 1. SORT ORDER BY | 2720 | 443K | 2812 (1) | 00:00:34 |
|* 2 | MAT_VIEW ACCESS BY INDEX ROWID | TMP_MS_UDB_MV | 2720 | 443K | 2811 (1) | 00:00:34 |
|* 3 | INDEX RANGE SCAN | EEETMP_MS_ACTTIMEDEVICE | 2732 | 89 (0) | 00:00:02 |
-----------------------------------------------------------------------------------------------------------
Information of predicates (identified by the operation identity card):
---------------------------------------------------
2 - filter("UDBMOVEMENT".") STRANSTYPE"> 0 AND BITAND ("UDBMOVEMENT". "SSALEFLAG «(, 4) = 0 AND" "
BITAND ("SSALEFLAG", 1) = 0 AND "UDBMOVEMENT". ("' SARTCLASSREF" < 100)
3 - access("UDBMOVEMENT".") TACTIONTIME' > = TO_DATE (' 2011-05-05 06:00 ',' syyyy-mm-jj)
('HH24:mi:SS) AND "UDBMOVEMENT". "" SDEVICE ' > = 0 AND "UDBMOVEMENT". ' SCARDTYPE ' = 2 AND ".
'UDBMOVEMENT '. "" TACTIONTIME "< TO_DATE(' 2011-05-05 12:00:00', 'syyyy-mm-dd hh24:mi:ss') AND
'UDBMOVEMENT '. ("' SDEVICE ' < 1000)
filter ("UDBMOVEMENT". "SCARDTYPE"= 2 AND "UDBMOVEMENT"." SDEVICE' < 1000 AND
'UDBMOVEMENT '. ("' SDEVICE ' > = 0)
Statistics
----------------------------------------------------------
449 recursive calls
0 db block Gets
6090 gets coherent
2837 physical reads
0 redo size
531987 bytes sent via SQL * Net to client
3953 bytes received via SQL * Net from client
331 SQL * Net back and forth to and from the client
168 sorts (memory)
0 sorts (disk)
4947 lines processed
SQL > spool off
Published by: MattSk on February 4, 2013 14:20>
The second query makes a full table of materialized view scan.
>
What you base that statement on?I do not see any table full scan in terms of the second query. All I see is
>
* 2 MAT_VIEW ACCESS BY INDEX ROWID TMP_MS_UDB_MV 2720 443K 2811 (1) 00:00:34
Maybe you are looking for
-
Satellite Pro A300: code 12 - this device cannot find enough resources
I use Vista Business 32 on my Toshiba Satellite Pro A300. Recently, I plugged my parallel to my laptop port adapter and the Device Manager, I had a device that said conflict error, "this device cannot find enough free resources that it can use. (Code
-
Drawing line with the mouse clicks on picture indicator
Hello I need to import a JPG file in an image control, draw a line in 2 clicks, read bothe XY positions and perform some basic trigonometry. Any simple or striaghtforward way to draw the line with the mouse and read thos passay on the bitmap (positio
-
Comment do pour enable management to create a dvd video with media center record tv
Hello. I own a pc windows xp media center 2005. After the failure of the United Nations; I have to make the United Nations for the complete matting; but media center won't be supported the creation of a dvd video taped tv programs. What to do do. Th
-
Cannot install Windows Vista SP2.
Original title: sick to death!. I tried for a VERY long time to install windows vista pck 2 AND IT WONT! I tried the solutions here and NOTHING. Help, please!
-
I can't the printer completely installed on my system. I was able to install it on the network to other computers, but mine says there is a Symantec Core LC: firewall that I have to disable. I have no firewall Symantec. I used to have Norton but i