3

2 つの巨大なテーブルがあり、約 6,000 万のレコードを更新しようとしています。以前は 30 分で更新されていましたが、現在は n 時間かかり、データの増加の 20% にも満たない. 詳細はこちら。「セルの単一ブロックの物理読み取り」「PX Deq: Table Q Normal」イベントで多くの待機があることがわかります。並列ヒントが機能しない理由がわかりません。それがセルシングルブロックの物理読み取りの理由ですか?または、パフォーマンスが低下する他の理由がありますか? 「WHERE EXISTS」句を取り除くことでパフォーマンスを向上させる理由はありますか?

table1(A) サイズ 316 GB レコード数 456,365,654

table2(B) 7GB レコード数 31,934,956

   UPDATE /*+  parallel (a, 8) */
          table1 a
       SET (c_age,
            c_age_de,
            wa_only_ind) =
              (SELECT c_age,
                      c_age_de,
                      wa_only_ind
                 FROM table2 b
                WHERE     B.ip = A.ip
                      AND a.c_age IS NULL
                      AND b.o_type IN ('TYPE12', 'TYPE14'))
     WHERE EXISTS
              (SELECT 1
                 FROM table2 b2
                WHERE     b2.ip = a.ip
                      AND a.c_age IS NULL
                      AND b2.o_type IN ('TYPE12', 'TYPE14'));

エクスレインプラン

   ----------------------------------------------------------------------------------------------------------------------------------------------------------
    | Id  | Operation                        | Name                    | E-Rows |E-Bytes| Cost (%CPU)| E-Time   | Pstart| Pstop |    TQ  |IN-OUT| PQ Distrib |
    ----------------------------------------------------------------------------------------------------------------------------------------------------------
    |   0 | UPDATE STATEMENT                 |                         |     17M|  9599M|  5076M (20)|999:59:59 |       |       |        |      |            |
    |   1 |  UPDATE                          | TABLE1                  |        |       |            |          |       |       |        |      |            |
    |   2 |   PX COORDINATOR                 |                         |        |       |            |          |       |       |        |      |            |
    |   3 |    PX SEND QC (RANDOM)           | :TQ10002                |     17M|  9599M|  1069K  (1)| 04:09:40 |       |       |  Q1,02 | P->S | QC (RAND)  |
    |*  4 |     HASH JOIN RIGHT SEMI BUFFERED|                         |     17M|  9599M|  1069K  (1)| 04:09:40 |       |       |  Q1,02 | PCWP |            |
    |   5 |      PX RECEIVE                  |                         |     29M|   476M| 23984   (2)| 00:05:36 |       |       |  Q1,02 | PCWP |            |
    |   6 |       PX SEND HASH               | :TQ10000                |     29M|   476M| 23984   (2)| 00:05:36 |       |       |  Q1,00 | P->P | HASH       |
    |   7 |        PX BLOCK ITERATOR         |                         |     29M|   476M| 23984   (2)| 00:05:36 |       |       |  Q1,00 | PCWC |            |
    |*  8 |         TABLE ACCESS STORAGE FULL| TABLE2                  |     29M|   476M| 23984   (2)| 00:05:36 |       |       |  Q1,00 | PCWP |            |
    |   9 |      PX RECEIVE                  |                         |     57M|    30G|  1045K  (1)| 04:04:04 |       |       |  Q1,02 | PCWP |            |
    |  10 |       PX SEND HASH               | :TQ10001                |     57M|    30G|  1045K  (1)| 04:04:04 |       |       |  Q1,01 | P->P | HASH       |
    |  11 |        PX BLOCK ITERATOR         |                         |     57M|    30G|  1045K  (1)| 04:04:04 |     1 |     3 |  Q1,01 | PCWC |            |
    |* 12 |         TABLE ACCESS STORAGE FULL| TABLE1                  |     57M|    30G|  1045K  (1)| 04:04:04 |     1 |     6 |  Q1,01 | PCWP |            |
    |* 13 |   FILTER                         |                         |        |       |            |          |       |       |        |      |            |
    |* 14 |    TABLE ACCESS BY INDEX ROWID   | TABLE2                  |      1 |   210 |     4   (0)| 00:00:01 |       |       |        |      |            |
    |* 15 |     INDEX RANGE SCAN             | TABLE2_IDX1             |      1 |       |     3   (0)| 00:00:01 |       |       |        |      |            |
    ----------------------------------------------------------------------------------------------------------------------------------------------------------


Predicate Information (identified by operation id):
---------------------------------------------------

   4 - access("B2"."IP"="A"."IP")
   8 - storage("B2"."O_TYPE"='TYPE1' OR "B2"."O_TYPE"='TYPE12')
       filter("B2"."O_TYPE"='TYPE1' OR "B2"."O_TYPE"='TYPE12')
  12 - storage("A"."C_AGE" IS NULL)
       filter("A"."C_AGE" IS NULL)
  13 - filter(:B1 IS NULL)
  14 - filter("B"."O_TYPE"='TYPE1' OR "B"."O_TYPE"='TYPE12')
  15 - access("B"."IP"=:B1)


 SQL_ID  dd0ah20057j37
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
| Id  | Operation                        | Name                         | E-Rows |E-Bytes| Cost (%CPU)| E-Time   | Pstart| Pstop |    TQ  |IN-OUT| PQ Distrib |  OMem |  1Mem |  O/1/M   |
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|   0 | UPDATE STATEMENT                 |                              |        |       |    43T(100)|          |       |       |        |      |            |       |       |          |
|   1 |  UPDATE                          | TABLE1                   |        |       |            |          |       |       |        |      |            |       |       |          |
|   2 |   PX COORDINATOR                 |                              |        |       |            |          |       |       |        |      |            |       |       |          |
|   3 |    PX SEND QC (RANDOM)           | :TQ10002                     |     57M|    31G| 65326   (3)| 00:14:16 |       |       |  Q1,02 | P->S | QC (RAND)  |       |       |          |
|*  4 |     HASH JOIN RIGHT SEMI BUFFERED|                              |     57M|    31G| 65326   (3)| 00:14:16 |       |       |  Q1,02 | PCWP |            |  1537M|    25M|     2/0/0|
|   5 |      PX RECEIVE                  |                              |     32M|   550M|  2190  (20)| 00:00:29 |       |       |  Q1,02 | PCWP |            |       |       |          |
|   6 |       PX SEND HASH               | :TQ10000                     |     32M|   550M|  2190  (20)| 00:00:29 |       |       |  Q1,00 | P->P | HASH       |       |       |          |
|   7 |        PX BLOCK ITERATOR         |                              |     32M|   550M|  2190  (20)| 00:00:29 |       |       |  Q1,00 | PCWC |            |       |       |          |
|*  8 |         TABLE ACCESS STORAGE FULL| TABLE2 P1      |     32M|   550M|  2190  (20)| 00:00:29 |       |       |  Q1,00 | PCWP |            |  1025K|  1025K|     2/0/0|
|   9 |      PX RECEIVE                  |                              |     57M|    30G| 63100   (2)| 00:13:47 |       |       |  Q1,02 | PCWP |            |       |       |          |
|  10 |       PX SEND HASH               | :TQ10001                     |     57M|    30G| 63100   (2)| 00:13:47 |       |       |  Q1,01 | P->P | HASH       |       |       |          |
|  11 |        PX BLOCK ITERATOR         |                              |     57M|    30G| 63100   (2)| 00:13:47 |     1 |     3 |  Q1,01 | PCWC |            |       |       |          |
|* 12 |         TABLE ACCESS STORAGE FULL| TABLE1                   |     57M|    30G| 63100   (2)| 00:13:47 |     1 |     6 |  Q1,01 | PCWP |            |  1025K|  1025K|     2/0/0|
|* 13 |   FILTER                         |                              |        |       |            |          |       |       |        |      |            |       |       |          |
|* 14 |    TABLE ACCESS BY INDEX ROWID   | TABLE2          |    320K|   113M| 12787   (1)| 00:02:48 |       |       |        |      |            |       |       |          |
|* 15 |     INDEX RANGE SCAN             | TABLE2_IDX1          |    128K|       |     4  (25)| 00:00:01 |       |       |        |      |            |  1025K|  1025K|          |
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Predicate Information (identified by operation id):
---------------------------------------------------

   4 - access("U2"."IP"="I"."IP")
   8 - storage(:Z>=:Z AND :Z<=:Z AND (("U2"."OPERATION_TYPE"='TYPE1' OR "U2"."OPERATION_TYPE"='TYPE12')))
       filter(("U2"."OPERATION_TYPE"='TYPE1' OR "U2"."OPERATION_TYPE"='TYPE12'))
  12 - storage(:Z>=:Z AND :Z<=:Z AND "I"."AGE" IS NULL)
       filter("I"."AGE" IS NULL)
  13 - filter(:B1 IS NULL)
  14 - filter(("U"."OPERATION_TYPE"='TYPE1' OR "U"."OPERATION_TYPE"='TYPE12'))
  15 - access("U"."IP"=:B1)

Plan hash value: 1669240984

----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
| Id  | Operation                         | Name                    | E-Rows |E-Bytes|E-Temp | Cost (%CPU)| E-Time   | Pstart| Pstop |    TQ  |IN-OUT| PQ Distrib |  OMem |  1Mem |  O/1/M   |
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|   0 | MERGE STATEMENT                   |                         |        |       |       |   374K(100)|          |       |       |        |      |            |       |       |          |
|   1 |  MERGE                            | TABLE1                    |        |       |       |            |          |       |       |        |      |            |       |       |          |
|   2 |   PX COORDINATOR                  |                         |        |       |       |            |          |       |       |        |      |            |       |       |          |
|   3 |    PX SEND QC (RANDOM)            | :TQ10002                |    413M|   574G|       |   374K  (2)| 01:21:50 |       |       |  Q1,02 | P->S | QC (RAND)  |       |       |          |
|   4 |     VIEW                          |                         |        |       |       |            |          |       |       |  Q1,02 | PCWP |            |       |       |          |
|*  5 |      HASH JOIN BUFFERED           |                         |    413M|   574G|  3583M|   374K  (2)| 01:21:50 |       |       |  Q1,02 | PCWP |            |  2047M|   100M|          |
|   6 |       PX RECEIVE                  |                         |     32M|    27G|       |  2199  (20)| 00:00:29 |       |       |  Q1,02 | PCWP |            |       |       |          |
|   7 |        PX SEND HASH               | :TQ10000                |     32M|    27G|       |  2199  (20)| 00:00:29 |       |       |  Q1,00 | P->P | HASH       |       |       |          |
|   8 |         PX BLOCK ITERATOR         |                         |     32M|    27G|       |  2199  (20)| 00:00:29 |       |       |  Q1,00 | PCWC |            |       |       |          |
|*  9 |          TABLE ACCESS STORAGE FULL| TABLE2           |     32M|    27G|       |  2199  (20)| 00:00:29 |       |       |  Q1,00 | PCWP |            |  1025K|  1025K|     2/0/0|
|  10 |       PX RECEIVE                  |                         |    413M|   218G|       | 67413   (9)| 00:14:44 |       |       |  Q1,02 | PCWP |            |       |       |          |
|  11 |        PX SEND HASH               | :TQ10001                |    413M|   218G|       | 67413   (9)| 00:14:44 |       |       |  Q1,01 | P->P | HASH       |       |       |          |
|  12 |         PX BLOCK ITERATOR         |                         |    413M|   218G|       | 67413   (9)| 00:14:44 |     1 |     3 |  Q1,01 | PCWC |            |       |       |          |
|* 13 |          TABLE ACCESS STORAGE FULL| TABLE1              |    413M|   218G|       | 67413   (9)| 00:14:44 |     1 |     6 |  Q1,01 | PCWP |            |  1025K|  1025K|     2/0/0|
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Predicate Information (identified by operation id):
---------------------------------------------------

   5 - access("I"."IP"="U"."IP")
   9 - storage(:Z>=:Z AND :Z<=:Z AND (("U"."OPERATION_TYPE"='TYPE1' OR "U"."OPERATION_TYPE"='TYPE12')))
       filter(("U"."OPERATION_TYPE"='TYPE1' OR "U"."OPERATION_TYPE"='TYPE12'))
  13 - storage(:Z>=:Z AND :Z<=:Z)
4

1 に答える 1