I have a table with 600million rows. I want to create a materialized view that filters it down to 50 million records but also uses REFRESH FAST ON COMMIT
. To use REFRESH FAST
I need a MATERIALIZED VIEW LOG
on the base table.
I'm looking at how to create one and I see that I can do:
create materialized view log on t
create materialized view log on t WITH PRIMARY KEY ;
create materialized view log on t WITH ROWID ;
create materialized view log on t WITH ROWID, PRIMARY KEY ;
create materialized view log on t WITH SEQUENCE ;
create materialized view log on t WITH (column)
I don't see or understand the benefits or cons of this various options
This is what I'm thinking of creating:
CREATE MATERIALIZED VIEW LOG ON LLATTRDATA WITH PRIMARY KEY
CREATE MATERIALIZED VIEW MV_LLATTRDATA_TEST1
NOLOGGING
CACHE
BUILD IMMEDIATE
REFRESH FAST ON COMMIT
AS
SELECT *
FROM LLATTRDATA D
WHERE
(D.DEFID = 3070056 AND D.ATTRID IN (2, 3, 4)) OR
(D.DEFID = 3070055 AND D.ATTRID IN (3, 30, 31, 2, 24, 23, 4)) OR
(D.DEFID = 3071379 AND D.ATTRID IN (3, 5, 8)) OR
(D.DEFID = 3072256 AND D.ATTRID = 5);
BEGIN
DBMS_STATS.gather_table_stats(
ownname => 'me',
tabname => 'MV_LLATTRDATA_TEST1');
END;