oracle xmltable performace - converting clob to xmltype and extracting for multiple records

1.5k Views Asked by At

I have a specific issue. i am trying to retrieve values from a xml clob field in a column. this xml is very large and i have of over 40 thousand records that have this xml_clob. I am currently able to retrieve information using the displayed query but found that performance is a big issue. Currently, its take hours to process the query. i need to be able to reduce this query processing time just a few minutes. There is not xml_schema provided. Access to the server is very limited so i can can create is temporary Table. But this has not been much help. These follow query only displays "Gender". It takes minimum of 15 minutes.

example of xml

<root>
<entry>....</entry>
<entry effective="2010012108354553" timestamp="2010012108354553" id="12345">
  <field name="Org" t="0" s="4" d="0">
    <nv>0000</nv>
  </field>
  <field name="FirstName" t="1" s="13" d="0">
    <nv>John</nv>
  </field>
  <field name="LastName" t="1" s="13" d="0">
    <nv>Doe</nv>
  </field>
<entry>
</root>

query:

SELECT X.*,X2.*

        From XML_TABLE XM,
        XMLTABLE (
           'for $e in /entry
                 where $e/@type = "create"
                 and $e/@effective > 20110229
                 and $e/@effective < 20140229
                 return $e'
        passing extract(xml, '/root/entry') 
                  COLUMNS 
                  effective VARCHAR(60)  PATH  '/entry/@effective'
                ) AS X ,
        XMLTABLE (

        'for $i in /field
                 where $i/@name = "Gender"
                 return $i'


        passing X.xml 
                  COLUMNS 
                  name VARCHAR(60)  PATH  '/field/@name',
                  old_value VARCHAR(60)  PATH  '/field/ov',
                  new_value VARCHAR(60)  PATH  '/field/nv'
                ) AS X2
0

There are 0 best solutions below