The size of redo writes varies depending on the amount of redo available for writing. In OLTP environments where redo writes are triggered quickly by frequent commits, it is normal for LGWR to write just a few log blocks in each write. Whereas in intensive batch environments with few commits, very large redo writes are common.
From Oracle 8i, LGWR tries to avoid waiting for incomplete copies into the log buffer (and for the subsequent application of the change vectors to their data blocks, during which the redo copy latch is retained). So, for background writes (cases 1 and 2 of redo write triggers) LGWR writes to the end of the redo thread, or to the last block that does not contain a redo record for which a redo copy latch is still being held. For COMMIT and DBWn sync writes (cases 3 and 4 of redo write triggers) if a redo copy latch is still held over a redo record below the intended sync RBA, then LGWR waits for that latch using the special LGWR wait for redo copy event. LGWR does not attempt to take the latch, and thus does not wait for it directly under the latch free event. Thereafter, LGWR writes at least up to the highest redo block that needs to be synced, and possibly further subject to the retention of redo copy latches over subsequent redo records.
LGWR does not constrain the size of its writes to the maximum physical I/O size. It writes all the intended redo in a single write operation, and allows the operating system to service that write request using multiple physical writes if necessary.
The total number of log blocks written is accumulated in the redo blocks written system statistic. The number of redo writes is accumulated in the redo writes system statistic. These two statistics can be used to calculate the average redo write size. This statistics is calculated by the APT script lgwr_stats.sql.
© Ixora Pty Ltd. All rights reserved.