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 14 ■ PARALLEL EXECUTION 625 Figure 14-2. Parallel update (PDML) depiction The fact that the table is “parallel” is not sufficient, as it was for parallel query. The reasoning behind the need to explicitly enable PDML in your session is the fact that PDML has certain limitations associated with it, which I list after this example. In the same session, we do a bulk UPDATE that, because the table is “parallel enabled,” will in fact be done in parallel: big_table@ORA10GR1> update big_table set status = 'done'; In the other session, we’ll join V$SESSION to V$TRANSACTION to show the active sessions for our PDML operation, as well as their independent transaction information: ops$tkyte@ORA10GR1> select a.sid, a.program, b.start_time, b.used_ublk, 2 b.xidusn ||'.'|| b.xidslot || '.' || b.xidsqn trans_id 3 from v$session a, v$transaction b 4 where a.taddr = b.addr 5 and a.sid in ( select sid 6 from v$px_session 7 where qcsid = 162 ) 8 order by sid 9 /

626 CHAPTER 14 ■ PARALLEL EXECUTION SID PROGRAM START_TIME USED_UBLK TRANS_ID ---- -------------------------- -------------------- ---------- ------------ 136 oracle@dellpe (P009) 08/03/05 14:28:17 6256 18.9.37 137 oracle@dellpe (P013) 08/03/05 14:28:17 6369 21.39.225 138 oracle@dellpe (P015) 08/03/05 14:28:17 6799 24.16.1175 139 oracle@dellpe (P008) 08/03/05 14:28:17 6729 15.41.68 140 oracle@dellpe (P014) 08/03/05 14:28:17 6462 22.41.444 141 oracle@dellpe (P012) 08/03/05 14:28:17 6436 20.46.46 142 oracle@dellpe (P010) 08/03/05 14:28:17 6607 19.44.37 143 oracle@dellpe (P007) 08/03/05 14:28:17 1 17.12.46 144 oracle@dellpe (P006) 08/03/05 14:28:17 1 13.25.302 145 oracle@dellpe (P003) 08/03/05 14:28:17 1 1.21.1249 146 oracle@dellpe (P002) 08/03/05 14:28:17 1 14.42.49 147 oracle@dellpe (P005) 08/03/05 14:28:17 1 12.18.323 150 oracle@dellpe (P011) 08/03/05 14:28:17 6699 23.2.565 151 oracle@dellpe (P004) 08/03/05 14:28:17 1 16.26.46 152 oracle@dellpe (P001) 08/03/05 14:28:17 1 11.13.336 153 oracle@dellpe (P000) 08/03/05 14:28:17 1 2.29.1103 162 sqlplus@dellpe (TNS V1-V3) 08/03/05 14:25:46 2 3.13.2697 17 rows selected. As we can see, there is more happening here than when we simply queried the table in parallel. We have 17 processes working on this operation, not just 9 as before. This is because the plan that was developed includes a step to update the table and independent steps to update the index entries. Looking at an edited explain plan output from DBMS_XPLAN (trailing columns were removed to permit the output to fit on the page), we see the following: ---------------------------------------------- | Id | Operation | Name | ---------------------------------------------- | 0 | UPDATE STATEMENT | | | 1 | PX COORDINATOR | | | 2 | PX SEND QC (RANDOM) | :TQ10001 | | 3 | INDEX MAINTENANCE | BIG_TABLE | | 4 | PX RECEIVE | | | 5 | PX SEND RANGE | :TQ10000 | | 6 | UPDATE | BIG_TABLE | | 7 | PX BLOCK ITERATOR | | | 8 | TABLE ACCESS FULL| BIG_TABLE | ---------------------------------------------- As a result of the pseudo-distributed implementation of PDML, certain limitations are associated with it: • Triggers are not supported during a PDML operation. This is a reasonable limitation in my opinion, since triggers would tend to add a large amount of overhead to the update, and you are using PDML to go fast—the two features don’t go together.

626<br />

CHAPTER 14 ■ PARALLEL EXECUTION<br />

SID PROGRAM START_TIME USED_UBLK TRANS_ID<br />

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

136 oracle@dellpe (P009) 08/03/05 14:28:17 6256 18.9.37<br />

137 oracle@dellpe (P013) 08/03/05 14:28:17 6369 21.39.225<br />

138 oracle@dellpe (P015) 08/03/05 14:28:17 6799 24.16.1175<br />

139 oracle@dellpe (P008) 08/03/05 14:28:17 6729 15.41.68<br />

140 oracle@dellpe (P014) 08/03/05 14:28:17 6462 22.41.444<br />

141 oracle@dellpe (P012) 08/03/05 14:28:17 6436 20.46.46<br />

142 oracle@dellpe (P010) 08/03/05 14:28:17 6607 19.44.37<br />

143 oracle@dellpe (P007) 08/03/05 14:28:17 1 17.12.46<br />

144 oracle@dellpe (P006) 08/03/05 14:28:17 1 13.25.302<br />

145 oracle@dellpe (P003) 08/03/05 14:28:17 1 1.21.1249<br />

146 oracle@dellpe (P002) 08/03/05 14:28:17 1 14.42.49<br />

147 oracle@dellpe (P005) 08/03/05 14:28:17 1 12.18.323<br />

150 oracle@dellpe (P011) 08/03/05 14:28:17 6699 23.2.565<br />

151 oracle@dellpe (P004) 08/03/05 14:28:17 1 16.26.46<br />

152 oracle@dellpe (P001) 08/03/05 14:28:17 1 11.13.336<br />

153 oracle@dellpe (P000) 08/03/05 14:28:17 1 2.29.1103<br />

162 sqlplus@dellpe (TNS V1-V3) 08/03/05 14:25:46 2 3.13.2697<br />

17 rows selected.<br />

As we can see, there is more happening here than when we simply queried the table in<br />

parallel. We have 17 processes working on this operation, not just 9 as before. This is because<br />

the plan that was developed includes a step to update the table <strong>and</strong> independent steps to<br />

update the index entries. Looking at an edited explain plan output from DBMS_XPLAN (trailing<br />

columns were removed to permit the output to fit on the page), we see the following:<br />

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

| Id | Operation | Name |<br />

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

| 0 | UPDATE STATEMENT | |<br />

| 1 | PX COORDINATOR | |<br />

| 2 | PX SEND QC (RANDOM) | :TQ10001 |<br />

| 3 | INDEX MAINTENANCE | BIG_TABLE |<br />

| 4 | PX RECEIVE | |<br />

| 5 | PX SEND RANGE | :TQ10000 |<br />

| 6 | UPDATE | BIG_TABLE |<br />

| 7 | PX BLOCK ITERATOR | |<br />

| 8 | TABLE ACCESS FULL| BIG_TABLE |<br />

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

As a result of the pseudo-distributed implementation of PDML, certain limitations are<br />

associated with it:<br />

• Triggers are not supported during a PDML operation. This is a reasonable limitation in<br />

my opinion, since triggers would tend to add a large amount of overhead to the update,<br />

<strong>and</strong> you are using PDML to go fast—the two features don’t go together.

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

Saved successfully!

Ooh no, something went wrong!