Apress.Expert.Oracle.Database.Architecture.9i.and.10g.Programming.Techniques.and.Solutions.Sep.2005
CHAPTER 12 ■ DATATYPES 547 buffer cache to be used for this. Also, if there were some really large LOBs in there, we might not really want this data to be cached. This in-row/out-of-row storage will affect modifications as well as reads. If we were to update the first 100 rows with short strings and insert 100 new rows with short strings, and use the same techniques to monitor performance, we would observe the following: ops$tkyte@ORA10G> create sequence s start with 100000; Sequence created. ops$tkyte@ORA10G> declare 2 l_cnt number; 3 l_data varchar2(32765); 4 begin 5 dbms_monitor.session_trace_enable; 6 for i in 1 .. 100 7 loop 8 update t set in_row = to_char(sysdate,'dd-mon-yyyy hh24:mi:ss') where id = i; 9 update t set out_row = to_char(sysdate,'dd-mon-yyyy hh24:mi:ss') where id = i; 10 insert into t (id, in_row) values ( s.nextval, 'Hello World' ); 11 insert into t (id,out_row) values ( s.nextval, 'Hello World' ); 12 end loop; 13 end; 14 / PL/SQL procedure successfully completed. We would discover findings similar to this in the resulting TKPROF report: UPDATE T SET IN_ROW = TO_CHAR(SYSDATE,'dd-mon-yyyy hh24:mi:ss') WHERE ID = :B1 call count cpu elapsed disk query current rows ------- ------ -------- ---------- ---------- ---------- ---------- ---------- Parse 1 0.00 0.00 0 0 0 0 Execute 100 0.05 0.02 0 200 202 100 Fetch 0 0.00 0.00 0 0 0 0 ------- ------ -------- ---------- ---------- ---------- ---------- ---------- total 101 0.05 0.02 0 200 202 100 Rows Row Source Operation ------- --------------------------------------------------- 100 UPDATE (cr=200 pr=0 pw=0 time=15338 us) 100 INDEX UNIQUE SCAN SYS_C0011949 (cr=200 pr=0 pw=0 time=2437 us) ******************************************************************************** UPDATE T SET OUT_ROW = TO_CHAR(SYSDATE,'dd-mon-yyyy hh24:mi:ss') WHERE ID = :B1
548 CHAPTER 12 ■ DATATYPES call count cpu elapsed disk query current rows ------- ------ -------- ---------- ---------- ---------- ---------- ---------- Parse 1 0.00 0.00 0 0 0 0 Execute 100 0.07 0.14 0 1100 2421 100 Fetch 0 0.00 0.00 0 0 0 0 ------- ------ -------- ---------- ---------- ---------- ---------- ---------- total 101 0.07 0.14 0 1100 2421 100 Rows Row Source Operation ------- --------------------------------------------------- 100 UPDATE (cr=1100 pr=0 pw=100 time=134959 us) 100 INDEX UNIQUE SCAN SYS_C0011949 (cr=200 pr=0 pw=0 time=2180 us) Elapsed times include waiting on following events: Event waited on Times Max. Wait Total Waited ---------------------------------------- Waited ---------- ------------ direct path write 200 0.00 0.00 As you can see, the update of the out-of-line LOB consumed measurably more resources. It spent some amount of time doing direct path writes (physical I/O) and performed many more current mode gets as well as query mode gets. These were in response to the fact that the lobindex and lobsegment had to be maintained in addition to the table itself. The INSERT activity shows the same disparity: INSERT INTO T (ID, IN_ROW) VALUES ( S.NEXTVAL, 'Hello World' ) call count cpu elapsed disk query current rows ------- ------ -------- ---------- ---------- ---------- ---------- ---------- Parse 1 0.00 0.00 0 0 0 0 Execute 100 0.03 0.02 0 2 316 100 Fetch 0 0.00 0.00 0 0 0 0 ------- ------ -------- ---------- ---------- ---------- ---------- ---------- total 101 0.03 0.02 0 2 316 100 ******************************************************************************** INSERT INTO T (ID,OUT_ROW) VALUES ( S.NEXTVAL, 'Hello World' ) call count cpu elapsed disk query current rows ------- ------ -------- ---------- ---------- ---------- ---------- ---------- Parse 1 0.00 0.00 0 0 0 0 Execute 100 0.08 0.13 0 605 1839 100 Fetch 0 0.00 0.00 0 0 0 0 ------- ------ -------- ---------- ---------- ---------- ---------- ---------- total 101 0.08 0.13 0 605 1839 100 Elapsed times include waiting on following events: Event waited on Times Max. Wait Total Waited ---------------------------------------- Waited ---------- ------------ direct path write 200 0.00 0.00
- Page 542 and 543: CHAPTER 12 ■ DATATYPES 497 ops$tk
- Page 544 and 545: CHAPTER 12 ■ DATATYPES 499 Table
- Page 546 and 547: CHAPTER 12 ■ DATATYPES 501 The IN
- Page 548 and 549: CHAPTER 12 ■ DATATYPES 503 ops$tk
- Page 550 and 551: CHAPTER 12 ■ DATATYPES 505 • BI
- Page 552 and 553: CHAPTER 12 ■ DATATYPES 507 NUMBER
- Page 554 and 555: CHAPTER 12 ■ DATATYPES 509 MSG NU
- Page 556 and 557: CHAPTER 12 ■ DATATYPES 511 They a
- Page 558 and 559: CHAPTER 12 ■ DATATYPES 513 ■Not
- Page 560 and 561: CHAPTER 12 ■ DATATYPES 515 Coping
- Page 562 and 563: CHAPTER 12 ■ DATATYPES 517 Note t
- Page 564 and 565: CHAPTER 12 ■ DATATYPES 519 We are
- Page 566 and 567: CHAPTER 12 ■ DATATYPES 521 Format
- Page 568 and 569: CHAPTER 12 ■ DATATYPES 523 ops$tk
- Page 570 and 571: CHAPTER 12 ■ DATATYPES 525 You ca
- Page 572 and 573: CHAPTER 12 ■ DATATYPES 527 month
- Page 574 and 575: CHAPTER 12 ■ DATATYPES 529 DT2-DT
- Page 576 and 577: CHAPTER 12 ■ DATATYPES 531 DT TS
- Page 578 and 579: CHAPTER 12 ■ DATATYPES 533 ops$tk
- Page 580 and 581: CHAPTER 12 ■ DATATYPES 535 Since
- Page 582 and 583: CHAPTER 12 ■ DATATYPES 537 ops$tk
- Page 584 and 585: CHAPTER 12 ■ DATATYPES 539 ops$tk
- Page 586 and 587: CHAPTER 12 ■ DATATYPES 541 suppor
- Page 588 and 589: CHAPTER 12 ■ DATATYPES 543 Concep
- Page 590 and 591: CHAPTER 12 ■ DATATYPES 545 We can
- Page 594 and 595: CHAPTER 12 ■ DATATYPES 549 Note t
- Page 596 and 597: CHAPTER 12 ■ DATATYPES 551 13 dbm
- Page 598 and 599: CHAPTER 12 ■ DATATYPES 553 equall
- Page 600 and 601: CHAPTER 12 ■ DATATYPES 555 ROWID/
- Page 602 and 603: CHAPTER 13 ■ ■ ■ Partitioning
- Page 604 and 605: CHAPTER 13 ■ PARTITIONING 559 6 (
- Page 606 and 607: CHAPTER 13 ■ PARTITIONING 561 els
- Page 608 and 609: CHAPTER 13 ■ PARTITIONING 563 BIG
- Page 610 and 611: CHAPTER 13 ■ PARTITIONING 565 Enh
- Page 612 and 613: CHAPTER 13 ■ PARTITIONING 567 Tab
- Page 614 and 615: CHAPTER 13 ■ PARTITIONING 569 tha
- Page 616 and 617: CHAPTER 13 ■ PARTITIONING 571 PAR
- Page 618 and 619: CHAPTER 13 ■ PARTITIONING 573 35
- Page 620 and 621: CHAPTER 13 ■ PARTITIONING 575 If
- Page 622 and 623: CHAPTER 13 ■ PARTITIONING 577 We
- Page 624 and 625: CHAPTER 13 ■ PARTITIONING 579 14
- Page 626 and 627: CHAPTER 13 ■ PARTITIONING 581 ops
- Page 628 and 629: CHAPTER 13 ■ PARTITIONING 583 In
- Page 630 and 631: CHAPTER 13 ■ PARTITIONING 585 ops
- Page 632 and 633: CHAPTER 13 ■ PARTITIONING 587 | S
- Page 634 and 635: CHAPTER 13 ■ PARTITIONING 589 12
- Page 636 and 637: CHAPTER 13 ■ PARTITIONING 591 ops
- Page 638 and 639: CHAPTER 13 ■ PARTITIONING 593 •
- Page 640 and 641: CHAPTER 13 ■ PARTITIONING 595 Now
548<br />
CHAPTER 12 ■ DATATYPES<br />
call count cpu elapsed disk query current rows<br />
------- ------ -------- ---------- ---------- ---------- ---------- ----------<br />
Parse 1 0.00 0.00 0 0 0 0<br />
Execute 100 0.07 0.14 0 1100 2421 100<br />
Fetch 0 0.00 0.00 0 0 0 0<br />
------- ------ -------- ---------- ---------- ---------- ---------- ----------<br />
total 101 0.07 0.14 0 1100 2421 100<br />
Rows Row Source Operation<br />
------- ---------------------------------------------------<br />
100 UPDATE (cr=1100 pr=0 pw=100 time=134959 us)<br />
100 INDEX UNIQUE SCAN SYS_C0011949 (cr=200 pr=0 pw=0 time=2180 us)<br />
Elapsed times include waiting on following events:<br />
Event waited on Times Max. Wait Total Waited<br />
---------------------------------------- Waited ---------- ------------<br />
direct path write 200 0.00 0.00<br />
As you can see, the update of the out-of-line LOB consumed measurably more resources.<br />
It spent some amount of time doing direct path writes (physical I/O) <strong>and</strong> performed many<br />
more current mode gets as well as query mode gets. These were in response to the fact that<br />
the lobindex <strong>and</strong> lobsegment had to be maintained in addition to the table itself. The INSERT<br />
activity shows the same disparity:<br />
INSERT INTO T (ID, IN_ROW) VALUES ( S.NEXTVAL, 'Hello World' )<br />
call count cpu elapsed disk query current rows<br />
------- ------ -------- ---------- ---------- ---------- ---------- ----------<br />
Parse 1 0.00 0.00 0 0 0 0<br />
Execute 100 0.03 0.02 0 2 316 100<br />
Fetch 0 0.00 0.00 0 0 0 0<br />
------- ------ -------- ---------- ---------- ---------- ---------- ----------<br />
total 101 0.03 0.02 0 2 316 100<br />
********************************************************************************<br />
INSERT INTO T (ID,OUT_ROW) VALUES ( S.NEXTVAL, 'Hello World' )<br />
call count cpu elapsed disk query current rows<br />
------- ------ -------- ---------- ---------- ---------- ---------- ----------<br />
Parse 1 0.00 0.00 0 0 0 0<br />
Execute 100 0.08 0.13 0 605 1839 100<br />
Fetch 0 0.00 0.00 0 0 0 0<br />
------- ------ -------- ---------- ---------- ---------- ---------- ----------<br />
total 101 0.08 0.13 0 605 1839 100<br />
Elapsed times include waiting on following events:<br />
Event waited on Times Max. Wait Total Waited<br />
---------------------------------------- Waited ---------- ------------<br />
direct path write 200 0.00 0.00