MV when detailed table consists of Millions of records [message #482020] |
Tue, 09 November 2010 02:43 |
ind9
Messages: 65 Registered: January 2009
|
Member |
|
|
Hi All,
I'm facing performance issue in our application which is similar to employee search.
We have a screen consists of 3 major tables fields based on the user inputs we are framing dynamic queries and fetching the desired output with the help of views which is a join of all the major 3 tables. Anyways view are not useful search on employee name takes more than 15 minutes. So to gain performance I would like to implement materialized views.
view structure is
create or replace view emp_dept_loc
as select
emp.*, dept.loc_id, loc.city, loc.zip, dept.dept_name
From employees emp, department dept, locations loc
Where emp.dept_no = dept.dept_no
AND dept.loc_id = loc.loc_id;
Now creating a MV as
CREATE MATERIALIZED VIEW MV_EMP_DEPT_LOC
PARALLEL
TABLESPACE "large"
PARTITION BY list (dept_no)
(PARTITION "mv_dept_1" VALUES (1)
TABLESPACE "large" ,
PARTITION "mv_dept_2" VALUES (2)
TABLESPACE "large" ,
PARTITION "mv_dept_3" VALUES (3)
TABLESPACE "large" ,
PARTITION "mv_dept_4" VALUES (4)
TABLESPACE "large" ,
PARTITION "mv_dept_5" VALUES (5)
TABLESPACE "large" ,
PARTITION "mv_dept_6" VALUES (6)
TABLESPACE "large" ,
PARTITION "mv_dept_7" VALUES (7)
TABLESPACE "large" ,
PARTITION "mv_dept_8" VALUES (8)
TABLESPACE "large" )
BUILD DEFERRED
REFRESH FAST ON COMMIT
ENABLE QUERY REWRITE AS
SELECT emp.rowid emp_rowid, dept.rowid dept_rowid, loc.row_id loc_rowid,
emp.*, dept.loc_id, loc.city, loc.zip, dept.dept_name
From employees emp, department dept, locations loc
Where emp.dept_no = dept.dept_no
AND dept.loc_id = loc.loc_id
I'm relatively new to materialized views so could you please guide me on the following points
1. In the above detailed tables employee and departments are partitioned on department ID but locations table is not a partioned one .
So is it madatory to create a Materialized view log when the materialized view is partitioned and refresh mode is FAST ON COMMIT
2. I'm enabling query rewrite so due to this will it impact on performance?
3. what is use of parallel option here?
4. Detailed table of employee is frequently updatable so how can I improve performance?
5. As per my understanding logs are not required when PCT is enabled but when I'm MV as shown above getting error as
SQL Error: ORA-23413: table "HR"."locations" does not have a materialized view log
23413. 00000 - "table \"%s\".\"%s\" does not have a materialized view log"
*Cause: The fast refresh can not be performed because the master table
does not contain a materialized view log.
*Action: Use the CREATE MATERIALIZED VIEW LOG command to create a
materialized view log on the master table.
Please guide me on the above points.
Appreciate your help on this.
Thanks in advance
Regards,
Ind9
|
|
|
|
Re: MV when detailed table consists of Millions of records [message #482024 is a reply to message #482021] |
Tue, 09 November 2010 02:56 |
ind9
Messages: 65 Registered: January 2009
|
Member |
|
|
Thanks for your quick reply.
My problem is across the search screen not on emp-name alone. emp-name is an example that i've highlighted. When ever partitioned column i.e. dept_no is not provided in the search screen, search is going across all the partitions.
Tuning queries hasn't helped us so we thought of moving to MV.
Because of this I would like to implement MV concept which actually stores all these table information at one place. So search will be faster.
|
|
|
|
|
Re: MV when detailed table consists of Millions of records [message #482049 is a reply to message #482045] |
Tue, 09 November 2010 04:47 |
ind9
Messages: 65 Registered: January 2009
|
Member |
|
|
Thanks for your information. I would consider all your suggestions and would try to implement.
Each of the table consists of
employee - 4 million
department - 2 Million
Locations - 8 Million
Anyways I've to demonstrate the performance using MVs to clients so could you please suggest on this?
|
|
|