extractvalue slow also with little XML
664587Oct 10 2008 — edited Oct 17 2008Hi,
I need to select data value from an xml in a xmltype column table (with only one row and one xml column) and I use extractvalue function; I have a simple small XML but I need to process a large quantity of them (50000) and the processing is very slow.
The XML table cannot be structured with xml schema, because I need to process many different schemas.
Is there any optimization or faster way?
Thank you very much for your help,
Marina
Example of my xml and select and resulting processing time:
The XML is < 10 K and is a 'flat' one, like a single table row with many columns:
<row>
<col1>val1</col1>
....
<col60>val60</col60>
</row>
MY SELECT:
select extractvalue(value(R),
'/ROW/COL1',
S3KADPUTILS.GET_ATTR_NS_DEF) C1,
..........................
extractvalue(value(R),
'/ROW/COL60',
S3KADPUTILS.GET_ATTR_NS_DEF) C60
from TABLE_XML,
TABLE(xmlsequence(extract(xml_data,
'/ROW',
S3KADPUTILS.GET_ATTR_NS_DEF))) R
if I apply extractvalue to all the 60 elements in the sequence the select takes about 0.15 seconds (if I extract only one value it takes 0.02 but I need all values).
I need to repeat 50000 times insert into xml table and select values, and the select total time become 50000 * 0.15 = 7500 sec = > 2h.