Apress.Expert.Oracle.Database.Architecture.9i.and.10g.Programming.Techniques.and.Solutions.Sep.2005

rekharaghuram
from rekharaghuram More from this publisher
05.11.2015 Views

CHAPTER 9 ■ REDO AND UNDO 305 ops$tkyte@ORA10G> create or replace trigger after_insert_update_delete 2 after insert or update or delete on T 3 for each row 4 begin 5 null; 6 end; 7 / Trigger created. ops$tkyte@ORA10G> truncate table t; Table truncated. ops$tkyte@ORA10G> exec do_work( 'after trigger' ); insert redo size = 505972 rows = 200 2,529.9 bytes/row update redo size = 856636 rows = 200 4,283.2 bytes/row delete redo size = 474176 rows = 200 2,370.9 bytes/row PL/SQL procedure successfully completed. The preceding output was from a run where the size of Y was 2,000 bytes. After all of the runs were complete, we are able to query the LOG table and see the following: ops$tkyte@ORA10G> break on op skip 1 ops$tkyte@ORA10G> set numformat 999,999 ops$tkyte@ORA10G> select op, rowsize, no_trig, before_trig-no_trig, after_trig-no_trig 2 from 3 ( select op, rowsize, 4 sum(decode( what, 'no trigger', redo_size/rowcnt,0 ) ) no_trig, 5 sum(decode( what, 'before trigger', redo_size/rowcnt, 0 ) ) before_trig, 6 sum(decode( what, 'after trigger', redo_size/rowcnt, 0 ) ) after_trig 7 from log 8 group by op, rowsize 9 ) 10 order by op, rowsize 11 / OP ROWSIZE NO_TRIG BEFORE_TRIG-NO_TRIG AFTER_TRIG-NO_TRIG ---------- -------- -------- ------------------- ------------------------ delete 30 291 0 0 100 364 -1 -0 500 785 -0 0 1,000 1,307 -0 -0 2,000 2,371 0 -0

306 CHAPTER 9 ■ REDO AND UNDO insert 30 296 0 -0 100 367 0 0 500 822 1 1 1,000 1,381 -0 -0 2,000 2,530 0 0 update 30 147 358 152 100 288 363 157 500 1,103 355 150 1,000 2,125 342 137 2,000 4,188 300 94 15 rows selected. Now, I was curious if the log mode (ARCHIVELOG versus NOARCHIVELOG mode) would affect these results. I discovered that the answer is no, the numbers were identical in both modes. I was curious about why the results were very different from the first edition of Expert One-on- One Oracle, upon which this book you are reading is loosely based. That book was released when Oracle8i version 8.1.7 was current. The Oracle 10g results just shown differed greatly from Oracle8i, but the Oracle9i results shown in this table resembled the Oracle8i results closely: OP ROWSIZE NO_TRIG BEFORE_TRIG-NO_TRIG AFTER_TRIG-NO_TRIG ---------- -------- -------- ------------------- ------------------ delete 30 279 -0 -0 100 351 -0 -0 500 768 1 0 1,000 1,288 0 0 2,000 2,356 0 -11 insert 30 61 221 221 100 136 217 217 500 599 199 198 1,000 1,160 181 181 2,000 2,311 147 147 update 30 302 197 0 100 438 197 0 500 1,246 195 0 1,000 2,262 185 0 2,000 4,325 195 -1 15 rows selected.

306<br />

CHAPTER 9 ■ REDO AND UNDO<br />

insert 30 296 0 -0<br />

100 367 0 0<br />

500 822 1 1<br />

1,000 1,381 -0 -0<br />

2,000 2,530 0 0<br />

update 30 147 358 152<br />

100 288 363 157<br />

500 1,103 355 150<br />

1,000 2,125 342 137<br />

2,000 4,188 300 94<br />

15 rows selected.<br />

Now, I was curious if the log mode (ARCHIVELOG versus NOARCHIVELOG mode) would affect<br />

these results. I discovered that the answer is no, the numbers were identical in both modes. I<br />

was curious about why the results were very different from the first edition of <strong>Expert</strong> One-on-<br />

One <strong>Oracle</strong>, upon which this book you are reading is loosely based. That book was released<br />

when <strong>Oracle</strong>8i version 8.1.7 was current. The <strong>Oracle</strong> 10g results just shown differed greatly<br />

from <strong>Oracle</strong>8i, but the <strong>Oracle</strong>9i results shown in this table resembled the <strong>Oracle</strong>8i results<br />

closely:<br />

OP<br />

ROWSIZE NO_TRIG BEFORE_TRIG-NO_TRIG AFTER_TRIG-NO_TRIG<br />

---------- -------- -------- ------------------- ------------------<br />

delete 30 279 -0 -0<br />

100 351 -0 -0<br />

500 768 1 0<br />

1,000 1,288 0 0<br />

2,000 2,356 0 -11<br />

insert 30 61 221 221<br />

100 136 217 217<br />

500 599 199 198<br />

1,000 1,160 181 181<br />

2,000 2,311 147 147<br />

update 30 302 197 0<br />

100 438 197 0<br />

500 1,246 195 0<br />

1,000 2,262 185 0<br />

2,000 4,325 195 -1<br />

15 rows selected.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!