我使用oracle10gR2 10.2.0.4和Solaris10的64位插入到VARCHAR2列從XMLType列選擇:極其緩慢
我需要從XML在XMLType列表中選擇數據值(word.testmeta ) 並插入到另一個表(word.testwordyy)
desc word.testmeta;
Name Null? Type
--------------------------------------
FILENAME CHAR(2000)
XMLDATA XMLTYPE
desc word.testwordyy;
Name Null? Type
---------------------------------------
ID VARCHAR2(255)
KEYWORD VARCHAR2(4000)
和我使用XMLTABLE並執行:
insert /*+append */ into word.testwordyy(KEYWORD)
select /*+ gather_plan_statistics */ dbms_lob.substr(xmltype.getclobval(b.KEWOR),254)
from word.testmeta , xmltable
(
'$B/mets/KEWOR'
passing
word.testmeta.XMLDATA as B
columns
KEWOR xmltype path '/KEWOR/text()'
)
b
這裏是解釋計劃select * from table(dbms_xplan.display_cursor(null,null,'iostats last'));
PLAN_TABLE_OUTPUT
-----------------------------------------------------------------------------------------------------------------------------------
SQL_ID 37ua3npnxx8su, child number 0
-------------------------------------
insert /*+append */ into word.testwordyy(KEYWORD) select /*+ gather_plan_statistics */
dbms_lob.substr(xmltype.getclobval(b.KEWOR),254) from word.testmeta , xmltable ('$B/mets/KEWOR' passing
> word.testmeta.XMLDATA as
B columns KEWOR xmltype path '/KEWOR/text()') b
Plan hash value: 875848213
-----------------------------------------------------------------------------------------------------------------------------------
PLAN_TABLE_OUTPUT
-----------------------------------------------------------------------------------------------------------------------------------
| Id | Operation | Name | Starts | E-Rows | A-Rows | A-Time | Buffers | Reads | Writes |
-----------------------------------------------------------------------------------------------------------------------------------
| 1 | LOAD AS SELECT | | 1 | | 1 |00:10:32.72 | 16832 | 7 | 90 |
| 2 | NESTED LOOPS | | 1 | 29M| 34688 |00:00:25.95 | 12639 | 5 | 0 |
| 3 | TABLE ACCESS FULL | TESTMETA | 1 | 3638 | 3999 |00:00:00.08 | 909 | 0 | 0 |
| 4 | COLLECTION ITERATOR PICKLER FETCH| XMLSEQUENCEFROMXMLTYPE | 3999 | | 34688 |00:00:24.50 | 11730 | 5 | 0 |
Note
-----
- dynamic sampling used for this statement
21 rows selected.
,並在表word.testmeta行的次數越多,時間越長,每行花費
我的XML很簡單,小而需要處理它們的數量很大(5000000) 並且處理速度非常慢,當行數超過8000時需要幾個小時。 有沒有優化或更快的方法?
爲什麼在'from'中有'word.testmeta'? – Mat 2014-10-19 08:49:26
testmeta在word schema中,所以word.testmeta – pangjiale 2014-10-21 13:12:08