I want detail info about materialized views?
I want detail info about materialized views?
The best place to start is the documentation available free online:
http://www.oracle.com/pls/db102/
Similar Messages
-
I want to know about Materialized Views
Hi,
I am very new to this Oracle.
In my project, we are using Materialized Views to refresh. but I am not having the good Idea on this. and in our project we golden gate also. both are refreshing purpose i think so. So could you please help me...
Best Regards,
Naresh.Tuser13405404 wrote:
yes,
I have gone through the pages. And please i ahve dought, like
1)How it is going to be refreshed..?(Manuall/Auto)That depends on how you define the materialized view. You can (subject to various restrictions) have the materialized view refresh as part of the transaction that modifies the underlying tables, on a fixed schedule, or on demand.
2)will occupie space(No, because its a view)A materialized view does occupy space. You are creating a copy of the underlying data.
Justin -
Hi,
Can you please give me some link or info about Materilized view.I want to know in what cases Materilized views are most efficient.Can you also send me advantages and disadvantages of Materialized views
Thanks
AnandData warehousing guide
http://download.oracle.com/docs/cd/B19306_01/server.102/b14223/toc.htm
Four chapters:
Basic materialized views
Advanced materialized views
Basic Query Rewrite
Advanced Query Rewrite
Gints Plivna
http://www.gplivna.eu -
Detailed info about AMD CPU models
Detailed info about AMD CPU models numbers and more
http://www.thedigerati.us/info/amdcpuchart.html#xp
http://fab51.com/index-e.html
http://www.techpowerup.com/cpudb/
http://www.cpu-world.com/
Quote from: russellmrgn on 17-July-06, 09:51:31
For AMD K8's AMD have this page:-
http://www.amdcompare.com/us-en/desktop/Quote from: russellmrgn on 17-July-06, 09:51:31
For AMD K8's AMD have this page:-
http://www.amdcompare.com/us-en/desktop/
added to the 1st post, thanks for the link. -
Want more info about optimizing battery lifespan and performance
I have read Apple Support's basic article on iPhone battery charging, but it doesnt answer all of my questions. i am kind of a fanatic about maintaining the health and longevity of my battery. I usually run it down to 3% or less before plugging in, then charge it all the way up. This creates some inconvenience, but after one year, my iPhone 5 battery is still performing much better than any previous iPhone ever did. Here are a few questions I have:
1. Is it really neccessary to wait for the battery to drop to 3%, or could I charge it after it goes below 20%, if it is more convenient?
2. Is there any harm in charging to less than 100% if I am in a hurry?
3. If I regularly plugged it in at over 50%, would it develop a memory and hold less charge?
4. What effect, if any, do Mophie Juick Packs have on iPhone battery health (I just got one)?
If there were no memory issues, the most convenient thing to do would be to plug it in every night at bedtime. Any knowledgable commentary would be welcome.There's a few aspects to this - and such several "correct" answers.
First, what exactly will you be doing? Are you just editing or will there be vfx/color grading etc? If it is the latter, and you're in SD, I'd personally go with uncompressed 10-bit. The files will be large, but it will be worth it if you do a lot of processing.
ProRes files will be much smaller, and still look very good, but may not hold up as well to heavy processing.
Not sure what you mean with #2... what other codec(s) are you looking at. Saying it is "unnecessary for SD" is an interesting comment - depends on what you want to do with the footage.
Some info about ProRes (and uncompressed) bitrates:
http://www.appleinsider.com/articles/07/04/18/acloser_look_at_apples_new_prores_422_videoformat.html
http://www.apple.com/finalcutstudio/finalcutpro/apple-prores.html
http://sportsvideo.org/main/blog/2009/08/11/apple-final-cut-prores-lowers-bitrat e/
http://documentation.apple.com/en/finalcutpro/professionalformatsandworkflows/in dex.html#chapter=10%26section=1%26tasks=true -
Dears,
I apprecaited providing me with online link that I can use to get detailed information about Oracle MDM process(profile,consolidate,govern,share,leverage)...
I have seen an Oracle white paper tilted "Master data Managemnet Spetemer 2011" ; but it exaplain the MDM process at high level ; any help is highly appreciated Regards, OmranIf you don't have much data on the server then I would advise a reinstall, I was having issues with profile manager initially as I've noticed it can be slightly tempermental when installing for know apparent reason.
Can you bind a network directory and login with that? -
A peculiar matter about Materialized Views
Hi ,
I have created successfully some months ago some MV. Later on , I was made to destroy the database and create a new one , using the DBCA. The peculiar is that whenever i issue the command :
sql> drop materialized view stat_biox_f_mv;
Oracle displays the error ORA-12003: the materialized view stat_biox_f_mv does not exist.
When i issue the command:
sql>create materialized view stat_biox_f_mv
build immediate
refresh start with (sysdate)+(10/1440)
next (sysdate)+10/1440
as
select count(f) N_f,sum(f) Sx_f,round(avg(f),3) x_f,round(stddev(f),3) SD_f,
round(avg(f)+2*stddev(f),3) Ru_f,round(avg(f)-2*stddev(f),3) Rd_f,
round(stddev(f)/sqrt(count(f)),3) SE_f,round((100*stddev(f))/avg(f),3) CV_f,
round(count(f)*((sum(power(f,4))-(power(sum(f),4)/count(f)))/
(power((sum(power(f,2))-(power(sum(f),2)/count(f))),2)))-3,3) Sk_f,
round((sum(power(f,2))-(power(sum(f),3)/count(f)))/
(power(stddev(f),2)*count(f)),3) Sa_f
from biox
Oracle displays the error ORA-00955: the object does exist
Eventually , the object exists or does not...?????
Thanks , a lot
SimonHave you queried all_objects? Perhaps the materialized view doesn't exist but a table with the same name does. If you do find any objects with that name, drop them.
SELECT * FROM all_objects WHERE object_name = UPPER('stat_biox_f_mv');
Have you tried creating this MV with a different name? Does that work? -
Hi,
I need a quick advice about how to display in the error cluster the information about the path and VI which has thrown an error.
When I don't prepare my own error message, and the error is captured automatically, the information about the path, Vi name and calling VIs is presented automatically.
When I prepare/define my own basic error cluster I have only what I define in the string part of the cluster.
How to cause tha apperance the path and VI name in my defined error message?MimiKLM wrote:
You mean this link
That's helpful too but, I had read "When I prepare/define my own basic error cluster I have only what I define in the string part of the cluster" as you wanted to use a file to expose those custom error codes and ultimately ship them with your solution dynamically rather than statically
The error ring will pick up any custom errors you define in the error file(s). Including formatting! this then populates the explain errors and error dialogs just like any error definition that ships with any LabVIEW component or toolkit.
Certainly, an error ring can also STATICALLY define or re-define an error within the application instance the ring is called from. Those Error Rings are quite flexible!
Jeff -
Need detailed info about Active,New and Change log table in BI 7.0
Dear Experts,
I am new to this technology. Can you any one explain in very detail about ACTIVE, NEW and CHANGE LOG tables workflows.
And also i am requesting you all to give tips to how to study BI 7.0
Regards,
Ameer.NFor your first problem solution is this note: 936644
You might have not mapped the filed in your tarnsfer/update rules? -
Materialized view long transaction time
I am using Oracle DB 11g R2 and created a materialized view log WITH SEQUENCE. I need to find out the exact date/time the transaction was made. I see that my MV log has the 'XID$$' column (NUMBER 22), but not sure how to determine the date/time from that. Is there another view/table I can join to get me that info? I see some have 'XID' column but they are RAW(8).
Thanks
Edited by: bobmagan on Feb 27, 2013 11:57 AM- CDC is at least as performant as materialized view logs. If you do asynchronous CDC, it performs better since you're not burdening the source transactions with the overhead of synchronously maintaining the materialized view logs.
- CDC is at least as effective as materialized view logs. Since CDC is designed to publish changes to custom consumers where materialized view logs are designed to be used by Oracle to refresh a materialized view, it strikes me as a much safer solution. If someone comes along and creates a materialized view that starts using your materialized view log, for example, a solution that involves custom code to manipulate the materialized view is almost certainly going to fail.
- CDC isn't an extra cost option so there shouldn't be a cost difference
That leaves the question of simplicity. I'll certainly grant you that a materialized view log solution may appear simpler. But a lot of that simplicity advantage disappears over time. The fact that we're talking about doing things like querying relatively obscure data dictionary tables like all_summap, for example, is added complexity that a CDC-based solution doesn't need. But over time, I'd much rather maintain a CDC-based solution rather than hooking in to materialized view logs. If someone wants to build a materialized view and Oracle happens to be able to use the materialized view log you've created for your own CDC, the custom solution will stop working. Over time, Oracle introduces more and more functionality that allows the ROWID of a row to change (shrinking a table, flashback, etc.). If you're using CDC, Oracle will take care of making sure that all those things are presented to you correctly. If you're rolling your own solution, you have to test and ensure that your code handles all those cases correctly. When Oracle makes a change in some future release that you hadn't considered, you've got to notice the potential problem, code the fix, and test it. Most places are probably going to miss something and only discover that there is a problem when they do something like shrink a table and then find that their custom solution doesn't handle that gracefully.
Justin -
Materialized View, ORA-12008: error in materialized view refresh path
I want to refresh a materialized view, but I get an ORA-12008 error.
Does anybody have an idea? I do not find any errors in my refresh statement.
CREATE MATERIALIZED VIEW scott.dummy_mv
TABLESPACE test
BUILD IMMEDIATE
USING INDEX TABLESPACE idx_test
REFRESH
START WITH sysdate
NEXT ROUND(SYSDATE)+5/24
WITH PRIMARY KEY
ENABLE QUERY REWRITE
AS
SELECT KM.ID ID
,KM.USERNAME USERNAME
,KM.ABTID ABTID
FROM my_table KM
scott@orcl>desc dummy_mv
Name Null? Typ
ID NOT NULL NUMBER(4)
USERNAME NOT NULL VARCHAR2(30)
ABTID NOT NULL NUMBER(4)
scott@orcl>
BEGIN
SYS.DBMS_JOB.REMOVE(6579);
COMMIT;
END;
DECLARE
X NUMBER;
BEGIN
SYS.DBMS_JOB.SUBMIT
( job => X
,what => 'dbms_refresh.refresh(''"scott"."dummy_mv"'');'
,next_date => to_date('07.01.2009 05:00:00','dd/mm/yyyy hh24:mi:ss')
,interval => 'ROUND(SYSDATE)+5/24 '
,no_parse => FALSE
SYS.DBMS_OUTPUT.PUT_LINE('Job Number is: ' || to_char(x));
COMMIT;
END;
scott@orcl>exec dbms_refresh.refresh('dummy_mv');
BEGIN dbms_refresh.refresh('dummy_mv'); END;
FEHLER in Zeile 1:
ORA-12008: error in materialized view refresh path
ORA-00947: not enough values
ORA-06512: in "SYS.DBMS_SNAPSHOT", Zeile 820
ORA-06512: in "SYS.DBMS_SNAPSHOT", Zeile 877
ORA-06512: in "SYS.DBMS_IREFRESH", Zeile 683
ORA-06512: in "SYS.DBMS_REFRESH", Zeile 195
ORA-06512: in Zeile 1
scott@orcl>crupper wrote:
I get the same error:
scott@orcl>exec dbms_mview.refresh('dummy_mv','c');
BEGIN dbms_mview.refresh('dummy_mv','c'); END;
FEHLER in Zeile 1:
ORA-12008: error in materialized view refresh path
ORA-00947: not enough values
ORA-06512: in "SYS.DBMS_SNAPSHOT", Zeile 820
ORA-06512: in "SYS.DBMS_SNAPSHOT", Zeile 877
ORA-06512: in "SYS.DBMS_SNAPSHOT", Zeile 858
ORA-06512: in Zeile 1
I would first check the "query" information of the DBA_SNAPSHOTS/DBA_MVIEWS dictionary views if it reveals anything obvious.
But it looks more like an internal error while processing the refresh. You can get more information about the error by tracing the session. A "alter session set sql_trace = true;" before running the refresh should be sufficient. Disconnect afterwards and check the generated trace file for errors either using "tkprof" and checking the output or by manually searching for "err=" in the trace file.
Which 4-digit version of Oracle are you using?
Regards,
Randolf
Oracle related stuff blog:
http://oracle-randolf.blogspot.com/
SQLTools++ for Oracle (Open source Oracle GUI for Windows):
http://www.sqltools-plusplus.org:7676/
http://sourceforge.net/projects/sqlt-pp/ -
Updatable Materialized View with Union ALL
(please don't ask about db structure)
DB: 11gR2
create table table_1 (
id number primary key,
val varchar2(100)
create table table_2 (
id number primary key,
val varchar2(100)
insert into table_1(id) values (0);
insert into table_1(id) values (2);
insert into table_1(id) values (3);
insert into table_1(id) values (4);
insert into table_1(id) values (5);
insert into table_2(id) values (10);
insert into table_2(id) values (12);
insert into table_2(id) values (13);
insert into table_2(id) values (14);
insert into table_2(id) values (15);
update table_1 set val='Table1 val:'||id;
update table_2 set val='Table2 val:'||id;
create view v_table_all as
select * from table_1
view V_TABLE_ALL created.
select * from v_table_all;
ID VAL
0 Table1 val:0
2 Table1 val:2
3 Table1 val:3
4 Table1 val:4
5 Table1 val:5
select column_name, updatable, insertable, deletable
from user_updatable_columns
where table_name = 'V_TABLE_ALL'
COLUMN_NAME UPDATABLE INSERTABLE DELETABLE
ID YES YES YES
VAL YES YES YES
update v_table_all set val='XXX changed' where id = 3;
1 row updated.
select * from table_1;
ID VAL
0 Table1 val:0
2 Table1 val:2
3 XXX changed
4 Table1 val:4
5 Table1 val:5
rollback;
select * from table_1;
ID VAL
0 Table1 val:0
2 Table1 val:2
3 Table1 val:3
4 Table1 val:4
5 Table1 val:5
create or replace view v_table_all as
select * from table_1
union select * from table_2;
view V_TABLE_ALL created.
select * from v_table_all;
ID VAL
0 Table1 val:0
2 Table1 val:2
3 Table1 val:3
4 Table1 val:4
5 Table1 val:5
10 Table2 val:10
12 Table2 val:12
13 Table2 val:13
14 Table2 val:14
15 Table2 val:15
select column_name, updatable, insertable, deletable
from user_updatable_columns
where table_name = 'V_TABLE_ALL'
COLUMN_NAME UPDATABLE INSERTABLE DELETABLE
ID NO NO NO
VAL NO NO NO
trying update:
update v_table_all set val='XXX changed' where id = 3;
SQL-Fehler: ORA-01732: Datenmanipulationsoperation auf dieser View nicht zulässig
01732. 00000 - "data manipulation operation not legal on this view"
*Cause:
*Action:
drop view v_table_all;
view V_TABLE_ALL dropped.all is ok before this point.
now we want create a new materialized view with some query
create materialized view v_table_all
as
select * from table_1
union all select * from table_2 ;
materialized view V_TABLE_ALL created.
select column_name, updatable, insertable, deletable
from user_updatable_columns
where table_name = 'V_TABLE_ALL'
COLUMN_NAME UPDATABLE INSERTABLE DELETABLE
ID YES YES YES
VAL YES YES YES it seems to be ok with update.
but...
update v_table_all set val='XXX changed' where id = 3;
SQL-Fehler: ORA-01732: Datenmanipulationsoperation auf dieser View nicht zulässig
01732. 00000 - "data manipulation operation not legal on this view"
*Cause:
*Action:How can solve this issue??
Any suggestionLooks like user_updatable_columns sort of thinks the MV is just a table - I don't know about that...
An MV on a single table can be updated - I tried that and it works:
create materialized view mv_table_1 for update
as
select * from table_1;I noticed [url http://download.oracle.com/docs/cd/E11882_01/server.112/e16579/advmv.htm#sthref294]examples stating the UNION ALL needs a "marker" so Oracle can know from the data which source table a row in the MV originates from - like this:
create materialized view v_table_all for update
as
select 'T1' tab_id, table_1.* from table_1
union all
select 'T2' tab_id, table_2.* from table_2 ;But that also fails (the "marker" requirement was specifically for FAST REFRESH, so it was just a long shot ;-) )
What are you planning to do?
<li>Create the MV.
<li>Update records in the MV - which then is no longer consistent with the source data.
<li>Schedule a complete refresh once in a while - thereby overwriting/losing the updates in the MV.
If that is the case, I suggest using a true table rather than an MV.
<li>Create table t_table_all as select ... .
<li>Update records in the table - which then is no longer consistent with the source data.
<li>Schedule a job to delete table and insert into table select ... once in a while - thereby overwriting/losing the updates in the table.
In other words a kind of "do it yourself MV".
I cannot see another way at the moment? But perhaps try in the data warehousing forum - the people there may have greater experience with MV's ;-) -
Query rewrites with Nested materialized views with different aggregations
Platform used : Oracle 11g.
Here is a simple fact table (with measures m1,m2) and dimensions (a) Location (b) Calendar and (c) Product. The business problem is that aggregation operator for measure m1,m2 are different along location dimension and Calendar dimension. The intention is to preaggregate the measures for a product along the calendar dimension and Location dimension and store it as materialized views.
The direct option is to define a materialized view with Inline queries (Because of the different aggrergation operator, it is not possible to write a query without Inline query). http://download-uk.oracle.com/docs/cd/B28359_01/server.111/b28313/qradv.htm#BABEAJBF documents the limitations that it works only for 'Text match' and 'Equivalent queries' and that is too limiting.
So decided to have nested materialized view, with first view having just joins(my_dim_mvw_joins), the second view having aggregations along Calendar dimension (my_dim_mvw_calendar) and third view having aggregations along the Location dimension(my_dim_mvw_location). Obviously I do not want the query I fire to know about materialized views and I fire it against the fact table. I see that for the fired query (Which needs aggregations along both Calendar and Location), is rewritten with just second materialized view but not the third. (Had set QUERY_REWRITE_INTEGRITY as TRUSTED) .
Wanted to know whether there are limitations on Query Writes with nested materialized views? Thanks
(Have given a simple testable example below. Pls ignore the values given in 'CALENDAR_IDs', 'PRODUCT_IDs' etc as they are the same for all the queries)
-- Calendar hierarchy table
CREATE TABLE CALENDAR_HIERARCHY_TREE
( "CALENDAR_ID" NUMBER(5,0) NOT NULL ENABLE,
"HIERARCHY1_ID" NUMBER(5,0),
"HIERARCHY2_ID" NUMBER(5,0),
"HIERARCHY3_ID" NUMBER(5,0),
"HIERARCHY4_ID" NUMBER(5,0),
CONSTRAINT "CALENDAR_HIERARCHY_TREE_PK" PRIMARY KEY ("CALENDAR_ID")
-- Location hierarchy table
CREATE TABLE LOCATION_HIERARCHY_TREE
( "LOCATION_ID" NUMBER(3,0) NOT NULL ENABLE,
"HIERARCHY1_ID" NUMBER(3,0),
"HIERARCHY2_ID" NUMBER(3,0),
"HIERARCHY3_ID" NUMBER(3,0),
"HIERARCHY4_ID" NUMBER(3,0),
CONSTRAINT "LOCATION_HIERARCHY_TREE_PK" PRIMARY KEY ("LOCATION_ID")
-- Product hierarchy table
CREATE TABLE PRODUCT_HIERARCHY_TREE
( "PRODUCT_ID" NUMBER(3,0) NOT NULL ENABLE,
"HIERARCHY1_ID" NUMBER(3,0),
"HIERARCHY2_ID" NUMBER(3,0),
"HIERARCHY3_ID" NUMBER(3,0),
"HIERARCHY4_ID" NUMBER(3,0),
"HIERARCHY5_ID" NUMBER(3,0),
"HIERARCHY6_ID" NUMBER(3,0),
CONSTRAINT "PRODUCT_HIERARCHY_TREE_PK" PRIMARY KEY ("PRODUCT_ID")
-- Fact table
CREATE TABLE RETAILER_SALES_TBL
( "PRODUCT_ID" NUMBER,
"PRODUCT_KEY" VARCHAR2(50 BYTE),
"PLAN_ID" NUMBER,
"PLAN_PERIOD_ID" NUMBER,
"PERIOD_ID" NUMBER(5,0),
"M1" NUMBER,
"M2" NUMBER,
"M3" NUMBER,
"M4" NUMBER,
"M5" NUMBER,
"M6" NUMBER,
"M7" NUMBER,
"M8" NUMBER,
"LOCATION_ID" NUMBER(3,0),
"M9" NUMBER,
CONSTRAINT "RETAILER_SALES_TBL_LOCATI_FK1" FOREIGN KEY ("LOCATION_ID")
REFERENCES LOCATION_HIERARCHY_TREE ("LOCATION_ID") ENABLE,
CONSTRAINT "RETAILER_SALES_TBL_PRODUC_FK1" FOREIGN KEY ("PRODUCT_ID")
REFERENCES PRODUCT_HIERARCHY_TREE ("PRODUCT_ID") ENABLE,
CONSTRAINT "RETAILER_SALES_TBL_CALEND_FK1" FOREIGN KEY ("PERIOD_ID")
REFERENCES CALENDAR_HIERARCHY_TREE ("CALENDAR_ID") ENABLE
-- Location dimension definition to promote query rewrite
create DIMENSION LOCATION_DIM
LEVEL CHAIN IS LOCATION_HIERARCHY_TREE.HIERARCHY1_ID
LEVEL CONSUMER_SEGMENT IS LOCATION_HIERARCHY_TREE.HIERARCHY3_ID
LEVEL STORE IS LOCATION_HIERARCHY_TREE.LOCATION_ID
LEVEL TRADING_AREA IS LOCATION_HIERARCHY_TREE.HIERARCHY2_ID
HIERARCHY PROD_ROLLUP (
STORE CHILD OF
CONSUMER_SEGMENT CHILD OF
TRADING_AREA CHILD OF
CHAIN
-- Calendar dimension definition
create DIMENSION CALENDAR_DIM
LEVEL MONTH IS CALENDAR_HIERARCHY_TREE.HIERARCHY3_ID
LEVEL QUARTER IS CALENDAR_HIERARCHY_TREE.HIERARCHY2_ID
LEVEL WEEK IS CALENDAR_HIERARCHY_TREE.CALENDAR_ID
LEVEL YEAR IS CALENDAR_HIERARCHY_TREE.HIERARCHY1_ID
HIERARCHY CALENDAR_ROLLUP (
WEEK CHILD OF
MONTH CHILD OF
QUARTER CHILD OF
YEAR
-- Materialized view with just joins needed for other views
CREATE MATERIALIZED VIEW my_dim_mvw_joins build immediate refresh complete enable query rewrite as
select product_id, lht.HIERARCHY1_ID, lht.HIERARCHY2_ID, lht.HIERARCHY3_ID, lht.location_id, cht.HIERARCHY1_ID year,
cht.HIERARCHY2_ID quarter, cht.HIERARCHY3_ID month, cht.calendar_id week, m1, m3, m7, m9
from retailer_sales_tbl RS, calendar_hierarchy_tree cht, location_hierarchy_tree lht
WHERE RS.period_id = cht.CALENDAR_ID
and RS.location_id = lht.location_id
and cht.CALENDAR_ID in (10,236,237,238,239,608,609,610,611,612,613,614,615,616,617,618,619,1426,1427,1428,1429,1430,1431,1432,1433,1434,1435,1436,1437,1438,1439,1440,1441,1442,1443,1444,1445,1446,1447,1448,1449,1450,1451,1452,1453,1454,1455,1456,1457,1458,1459,1460,1461,1462,1463,1464,1465,1466,1467,1468,1469,1470,1471,1472,1473,1474,1475,1476,1477)
AND product_id IN (5, 6, 7, 8, 11, 12, 13, 14, 17, 18, 19, 20)
AND lht.location_id IN (2, 3, 11, 12, 13, 14, 15, 4, 16, 17, 18, 19, 20)
-- Materialized view which aggregate along calendar dimension
CREATE MATERIALIZED VIEW my_dim_mvw_calendar build immediate refresh complete enable query rewrite as
select product_id, HIERARCHY1_ID , HIERARCHY2_ID , HIERARCHY3_ID ,location_id, year, quarter, month, week,
sum(m1) m1_total, sum(m3) m3_total, sum(m7) m7_total, sum(m9) m9_total,
GROUPING_ID(product_id, location_id, year, quarter, month, week) dim_mvw_gid
from my_dim_mvw_joins
GROUP BY product_id, HIERARCHY1_ID , HIERARCHY2_ID , HIERARCHY3_ID , location_id,
rollup (year, quarter, month, week);
-- Materialized view which aggregate along Location dimension
CREATE MATERIALIZED VIEW my_dim_mvw_location build immediate refresh complete enable query rewrite as
select product_id, year, quarter, month, week, HIERARCHY1_ID, HIERARCHY2_ID, HIERARCHY3_ID, location_id,
sum(m1_total) m1_total_1, sum(m3_total) m3_total_1, sum(m7_total) m7_total_1, sum(m9_total) m9_total_1,
GROUPING_ID(product_id, HIERARCHY1_ID, HIERARCHY2_ID, HIERARCHY3_ID, location_id, year, quarter, month, week) dim_mvw_gid
from my_dim_mvw_calendar
GROUP BY product_id, year, quarter, month, week,
rollup (HIERARCHY1_ID, HIERARCHY2_ID, HIERARCHY3_ID, location_id)
-- SQL Query Fired (for simplicity have used SUM as aggregation operator for both, but they will be different)
select product_id, year, HIERARCHY1_ID, HIERARCHY2_ID,
sum(m1_total) m1_total_1, sum(m3_total) m3_total_1, sum(m7_total) m7_total_1, sum(m9_total) m9_total_1
from
select product_id, HIERARCHY1_ID , HIERARCHY2_ID , year,
sum(m1) m1_total, sum(m3) m3_total, sum(m7) m7_total, sum(m9) m9_total
from
select product_id, lht.HIERARCHY1_ID , lht.HIERARCHY2_ID , lht.HIERARCHY3_ID ,lht.location_id, cht.HIERARCHY1_ID year, cht.HIERARCHY2_ID quarter, cht.HIERARCHY3_ID month, cht.calendar_id week,m1,m3,m7,m9
from
retailer_sales_tbl RS, calendar_hierarchy_tree cht, location_hierarchy_tree lht
WHERE RS.period_id = cht.CALENDAR_ID
and RS.location_id = lht.location_id
and cht.CALENDAR_ID in (10,236,237,238,239,608,609,610,611,612,613,614,615,616,617,618,619,1426,1427,1428,1429,1430,1431,1432,1433,1434,1435,1436,1437,1438,1439,1440,1441,1442,1443,1444,1445,1446,1447,1448,1449,1450,1451,1452,1453,1454,1455,1456,1457,1458,1459,1460,1461,1462,1463,1464,1465,1466,1467,1468,1469,1470,1471,1472,1473,1474,1475,1476,1477)
AND product_id IN (5, 6, 7, 8, 11, 12, 13, 14, 17, 18, 19, 20)
AND lht.location_id IN (2, 3, 11, 12, 13, 14, 15, 4, 16, 17, 18, 19, 20)
GROUP BY product_id, HIERARCHY1_ID , HIERARCHY2_ID , HIERARCHY3_ID , location_id, year
) sales_time
GROUP BY product_id, year,HIERARCHY1_ID, HIERARCHY2_ID
This Query rewrites only with my_dim_mvw_calendar. (as saw in Query Plan and EXPLAIN_MVIEW). But we would like it to use my_dim_mvw_location as that has aggregations for both dimensions.blackhole001 wrote:
Hi all,
I'm trying to make my programmer's life easier by creating a database view for them to query the data, so they don't have to worry about joining tables. This sounds like a pretty horrible idea. I say this because you will eventually end up with programmers that know nothing about your data model and how to properly interact with it.
Additionally, what you will get is a developer that takes one of your views and see's that of the 20 columns in it, it has 4 that he needs. If all those 4 columns comes from a simple 2 table join, but the view has 8 tables, you're wasting a tonne of resources by using the view (and heaven forbid they have to join that view to another view to get 4 of the 20 columns from that other view as well).
Ideally you'd write stored routines that satisfy exactly what is required (if you are the database resource and these other programmers are java, .net, etc... based) and the front end developers would call those routines customized for an exact purpose.
Creating views is not bad, but it's by no means a proper solution to having developers not learn or understand SQL and/or the data model. -
Materialized View - Point in time refresh
I have a MV group which refreshes from a bunch of master tables. The master tables are constantly getting updated from an OLTP application. In this scenario, I want all the MVs to hold data which was available at the time the refresh started and not the changes after that.
Eg:
Master tables are T1, T2 ... T20 refresh to MVs T1_MV, T2_MV ...T20_MV
All the MVs T1_MV to T20_MV are in a refresh group.
At 3 PM: Execute an explicit refresh for the MV refresh group
At 3:05 PM: OLTP application inserts a record into table T5 & commits
At 3:06 PM (rather any time after 3:05 PM): Refresh of T5_MV happens. Will the latest insert get captured in T5_MV? I actually don't want this to happen for my requirement, because I want the data captured as of 3 PM into the MVs.
The Oracle Advanced Replication guide says the following about Materialized Views -
+"A materialized view is a replica of a target master from a single point in time."+
From the above line, it looks like by default this will not be captured in the MV. Can someone please confirm my understanding ?MVs in a Refresh Group when refreshed as a Refresh Group are refreshed as of the same point in time.
So if the Refresh Group begins at 3:00pm and ends at 3:25pm, all the MVs in that group reflect the data as in the source tables as of 3:00pm, ignoring any updates to source tables after 3:00pm (i.e. while the Group is being refreshed).
However, if you refresh MVs individually, then each MV is refreshed at it's relative point in time -- so individual Refreshs of MVs would not be to the same point in time.
How have you defined the Refresh Group ?
How do you execute the Refresh for the whole Group ? What PLSQL procedure do you use ? What parameters do you use ?
Ensure that you do not execute an individual MV Refresh.
Hemant K Chitale
http://hemantoracledba.blogspot.com -
Create a fast refresh materialized view with partitioned primary index
Hi,
I have a materialized view that is based on a table with primary key.
I want to create a materialized view with a partitioned primary index . do you have any way of doing it?
I tried to create a materialized view with rowid and then I created a partitioned primary index on it.
It did not work as what I expected. I could not perform a fast refresh on it. the materialized view can only complete refresh
thank youHi,
Here is some info from the Oracle Documentation.
http://download.oracle.com/docs/cd/E11882_01/server.112/e10706/repmview.htm
http://download.oracle.com/docs/cd/E11882_01/server.112/e10810/basicmv.htm
Determining the Fast Refresh Capabilities of a Materialized View
http://download.oracle.com/docs/cd/E11882_01/server.112/e10706/repmview.htm#BABEDIAH
Regards,
Maybe you are looking for
-
Hi, This problem only started occurring from yesterday, but I'm getting very poor FTP download speeds. I use a dedicated server to store my work files then download at home but I'm finding it impossible now. Speeds no higher than 150kb/s even though
-
Adobe Acrobat X Pro - Importing Images
Hello all, Short Version. I want to overlay an Image ontop of an already Exsisting PDF? I have a PDF i created by printing to PDF off a set of Architectural Drawings. I have this PDF but want to import a photo overtop of it. The PDF is an Isometri
-
hi again, well im slowly getting there with my site, im not really to sure how to explain what id like to do but here goes, on my site i have text in an editable area, that area has a background image, id like the text to be in a box which is a diffe
-
How do you delete an inspection rule in MARS
-
Help with OVI 3.04 on X6
Can somebody please help me, have installed OVI maps 3.04 on my X6 and hate it no GPS bar and most of the time comes up wtith " no route found" even with the wifi off. How do I roll back to 3.03 which was quite stable, have tried uninstalling but it