| CASE STUDY 1 How
to Handle Materialized View Refresh Performance? The
issue on hand: begin Elapsed: 00:00:23.79 The expectation for the materialized view refresh should complete within one second. v$session_wait
table output points that waits are occuring in the remote database.
Enabled
sql_trace on the local database for a short period. Ran the materialized view refresh from the local database, disabled sql_trace. alter system set events '10046 trace name context off'; Ram the tkprof on the trace file generated tkprof <infile trace file> <outputfile jp.log> waits=yes From
the tkprof output of the trace file(output from local db),
V$session_wait
table out put from the remote database shown, the waits are The trace files on the remote db pointed, 'db file scattered read' on file# 9. "WAIT #1: nam='db file scattered read' ela= 5968 p1=9 p2=107"
'db file scattered read' relates to FULL TABLE SCAN. Surprisingly, full table scan on a small table should not take long time. The
master table is having 1038 rows. The
size of the master table 0.18 mg. The materialized view log is not getting purged regularly. Fast refreshes on the materialized views do not purge the materialized view logs. As detailed in the oracle documentation, complete refresh on the materialized views is not purging the materialized view log. The materialized view log was manually purged. The
materialized view log on the remote table is purged: After purging the remote materialized view log the materialized view refresh came down to 5 seconds. begin PL/SQL procedure successfully completed. Elapsed: 00:00:04.83 The interesting part is the size of the materialized view log is still at 424 meg. Where
as the physical row count The
materialized view log and the master table are truncated with This time the size of the materialized view log got reduced: The
size of the master table 0.18 mg. begin PL/SQL procedure successfully completed. Elapsed: 00:00:00.25 The
effort is well paid, by tuning the query running in 23 seconds |