Performance on XMLTYPE

Trying to issue simple existsNode & extract queries on a table with 160K XML docs (unstructured) and the performance is an issue. Without an index its 2 minutes with a CTXXPATH index its 2 minutes and even with a function based index with the CTXPATH index its still two minutes! I did check the plan and saw the index being used however performance did not go well. Any ideas?
Running 9.2.0.4 on Solaris 64bit
Thanks

What %age of the documents does the existsNode return. With unstructured storeage each docuement will need to be parsed and a DOM built to get the results of extract. Also did you sync the index after inserting the records. In general you should only use unstructured storage when queries will result in a small number of small documents being processed.

Similar Messages

  • How to boost performance on XMLType column

    Hello everyone,
    I've a serious question on improving the performance of XMLType Column. In fact, I've created view on top on XMLType column and found out that the retreival time is quite unexceptal. Although I've applied indices on those element seems no help. One note is that the XMLType column is unstructured.. Does this could be the reason?
    My question is that does the indices only apply to structured docs?
    Appreciated your advice. Thanks.

    Please post the question on XML DB forum

  • [9i] poor performance with XMLType.transform

    Hello,
    I've got a problem with the Oracle function XMLType.transform.
    When I try to apply a XSL to a big XML, it is very very slow, and it evens consumes all the CPU, and other users are not able to work until the processing is complete...
    So I was wondering if my XSL was corrupted, but it does not seem so, because when i apply it with Internet Explorer (by just double-clicking on the .xml), it is immediately applied. I've also even tried with oraxsl, and the processing is quick and good.
    So, i tried to use XDB, but it does not work, maybe I should upgrade to a newer version of XDB?
    Please find the ZIP file here :
    http://perso.modulonet.fr/~tleoutre/Oracle/samples.zip
    Please find in this file :
    1) The XSL file k_xsl.xsl
    2) The "big" XML file big_xml.xml
    Here you can try to apply the XSL on the XML with Internet Explorer : processing is very quick...
    3) The batch file transform.bat
    Here you can launch it, it calls oraxsl, and produces a result very quickly...
    4) The SQL file test_xsl_with_xmltype_transform.sql.
    You can try to launch it... First, it applies the same XSL with a little XML, and it's OK... And then, it applies the XSL to the same big XML as in point 1), and then, it takes a lot of time and CPU...
    5) The SQL file test_xsl_with_xdb_1.sql ...
    On my server, it fails... So I tried to change the XSL in the next point :
    6) The SQL file test_xsl_with_xdb_2.sql with a "cleaned" XSL...
    And then, it fails with exactly the same problem as in :
    TransformerConfigurationException  (Unknown expression at EOF: *|/.)
    Any help would be greatly appreciated!
    Thank you!
    P.S. : Sorry for my bad english, I'm a French man :-)

    This is what I see...
    Your tests are measuring the wrong thing. You are measuring the time to create the sample documents, which is being done very innefficiently, as well
    as the time take to do the transform.
    Below is the correct way to get mesasurements for each task..
    Here's what I see on a PIV 2.4Ghz with 10.2.0.2.0 and 2GB of RAM
    Fragments SourceSize  TargetSize createSource       Parse     Transform
            50      28014      104550  00:00:00.04 00:00:00.04   00:00:00.12
           100      55964      209100  00:00:00.03 00:00:00.05   00:00:00.23
           500     279564     1045500  00:00:00.16 00:00:00.23   00:00:01.76
          1000     559064     2091000  00:00:00.28 00:00:00.28   00:00:06.04
          2000    1118064     4182000  00:00:00.34 00:00:00.42   00:00:24.43
          5000    2795064    10455000  00:00:00.87 00:00:02.02   00:03:19.02I think this clearly shows the pattern.
    Of course what this testing really shows is that you've clearly missed the point of performing XSLT transformation inside the database.
    The idea behind database based transformation is to optimize XSLT processing by
    (1), not having to parse the XML and build a DOM tree before commencing the XSLT processing. In this example this is not possible since the
    XML is being created from a CLOB based XMLType, not a schema based XMLType.
    (2) Leveraging the Lazily Loaded Virtual DOM when doing sparse transformation ( A Sparse transformation is one where there are large parts of the
    source document that are not required to create the target document. Again in this case the XSL requires you to walk all the nodes to generate the
    required output.
    If is necessary to process all of the nodes in the source document to generate the entire output it probably makes more sense to use a midtier XSL engine.
    Here's the code I used to generate the numbers in the above example
    BTW in terms of BIG XML we've successully processed 12G documents with Schema Based Storage...So nothing you have hear comes any where our defintion of big.- 1 with Oracle 10g Express on Linux
    Also, please remember that 9.2.0.1.0 is not a supported release for any XML DB related features.
    SQL*Plus: Release 10.2.0.2.0 - Production on Fri Feb 10 07:44:59 2006
    Copyright (c) 1982, 2005, Oracle.  All Rights Reserved.
    SQL> spool createDocument.log
    SQL> --
    SQL> connect &1/&2
    Connected.
    SQL> --
    SQL> create or replace directory &1 as '&3'
      2  /
    old   1: create or replace directory &1 as '&3'
    new   1: create or replace directory SCOTT as '/home/mdrake/bugs/xslTest'
    Directory created.
    SQL> drop table source_data_table
      2  /
    Table dropped.
    SQL> create table source_data_table
      2  (
      3    fragCount number,
      4    xml_text  clob,
      5    xml       xmlType,
      6    result    clob
      7  )
      8  /
    Table created.
    SQL> create or replace procedure createDocument(fragmentCount number)
      2  as
      3    fragmentText clob :=
      4  '<AFL LIGNUM="1999">
      5    <mat>20000001683</mat>
      6    <name>DOE</name>
      7    <firstname>JOHN</firstname>
      8    <name2>JACK</name2>
      9    <SEX>MALE</SEX>
    10    <birthday>1970-05-06</birthday>
    11    <salary>5236</salary>
    12    <code1>5</code1>
    13    <code2>6</code2>
    14    <code3>7</code3>
    15    <date>2006-05-06</date>
    16    <dsp>8.665</dsp>
    17    <dsp_2000>455.45</dsp_2000>
    18    <darr04>5.3</darr04>
    19    <darvap04>6</darvap04>
    20    <rcrr>8</rcrr>
    21    <rcrvap>9</rcrvap>
    22    <rcrvav>10</rcrvav>
    23    <rinet>11.231</rinet>
    24    <rmrr>12</rmrr>
    25    <rmrvap>14</rmrvap>
    26    <ro>15</ro>
    27    <rr>189</rr>
    28    <date2>2004-05-09</date2>
    29  </AFL>';
    30
    31    xmlText CLOB;
    32
    33  begin
    34    dbms_lob.createTemporary(xmlText,true,DBMS_LOB.CALL);
    35    dbms_lob.write(xmlText,5,1,'<PRE>');
    36    for i in 1..fragmentCount loop
    37       dbms_lob.append(xmlText,fragmentText);
    38    end loop;
    39    dbms_lob.append(xmlText,xmlType('<STA><COD>TER</COD><MSG>Op?ation R?ssie</MSG></STA>').getClobVal());
    40    dbms_lob.append(xmlText,'</PRE>');
    41    insert into source_data_table (fragCount,xml_text) values (fragmentCount, xmlText);
    42    commit;
    43    dbms_lob.freeTemporary(xmlText);
    44  end;
    45  /
    Procedure created.
    SQL> show errors
    No errors.
    SQL> --
    SQL> set timing on
    SQL> --
    SQL> call createDocument(50)
      2  /
    Call completed.
    Elapsed: 00:00:00.04
    SQL> call createDocument(100)
      2  /
    Call completed.
    Elapsed: 00:00:00.03
    SQL> call createDocument(500)
      2  /
    Call completed.
    Elapsed: 00:00:00.16
    SQL> call createDocument(1000)
      2  /
    Call completed.
    Elapsed: 00:00:00.28
    SQL> call createDocument(2000)
      2  /
    Call completed.
    Elapsed: 00:00:00.34
    SQL> call createDocument(5000)
      2  /
    Call completed.
    Elapsed: 00:00:00.87
    SQL> select fragCount dbms_lob.getLength(xmlText)
      2    from sample_data_table
      3  /
    select fragCount dbms_lob.getLength(xmlText)
    ERROR at line 1:
    ORA-00923: FROM keyword not found where expected
    Elapsed: 00:00:00.00
    SQL> quit
    Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.2.0 - Production
    With the Partitioning, OLAP and Data Mining options
    SQL*Plus: Release 10.2.0.2.0 - Production on Fri Feb 10 07:45:01 2006
    Copyright (c) 1982, 2005, Oracle.  All Rights Reserved.
    SQL> spool testcase_&3..log
    SQL> --
    SQL> connect &1/&2
    Connected.
    SQL> --
    SQL> set timing on
    SQL> --
    SQL> update source_data_table
      2     set xml = xmltype(xml_text)
      3   where fragCount = &3
      4  /
    old   3:  where fragCount = &3
    new   3:  where fragCount = 50
    1 row updated.
    Elapsed: 00:00:00.04
    SQL> commit
      2  /
    Commit complete.
    Elapsed: 00:00:00.01
    SQL> update source_data_table
      2     set result = xmltransform(xml,xmltype(bfilename(USER,'&4'),nls_charset_id('WE8ISO8859P1'))).getClobVal()
      3   where fragCount = &3
      4  /
    old   2:    set result = xmltransform(xml,xmltype(bfilename(USER,'&4'),nls_charset_id('WE8ISO8859P1'))).getClobVal()
    new   2:    set result = xmltransform(xml,xmltype(bfilename(USER,'k_xsl.xsl'),nls_charset_id('WE8ISO8859P1'))).getClobVal()
    old   3:  where fragCount = &3
    new   3:  where fragCount = 50
    1 row updated.
    Elapsed: 00:00:00.12
    SQL> commit
      2  /
    Commit complete.
    Elapsed: 00:00:00.01
    SQL> select fragCount, dbms_lob.getLength(xml_text),dbms_lob.getLength(result)
      2    from source_data_table
      3  /
    FRAGCOUNT DBMS_LOB.GETLENGTH(XML_TEXT) DBMS_LOB.GETLENGTH(RESULT)
            50                        28014                     104550
           100                        55964
           500                       279564
          1000                       559064
          2000                      1118064
          5000                      2795064
    6 rows selected.
    Elapsed: 00:00:00.01
    SQL> quit
    Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.2.0 - Production
    With the Partitioning, OLAP and Data Mining options
    SQL*Plus: Release 10.2.0.2.0 - Production on Fri Feb 10 07:45:02 2006
    Copyright (c) 1982, 2005, Oracle.  All Rights Reserved.
    SQL> spool testcase_&3..log
    SQL> --
    SQL> connect &1/&2
    Connected.
    SQL> --
    SQL> set timing on
    SQL> --
    SQL> update source_data_table
      2     set xml = xmltype(xml_text)
      3   where fragCount = &3
      4  /
    old   3:  where fragCount = &3
    new   3:  where fragCount = 100
    1 row updated.
    Elapsed: 00:00:00.05
    SQL> commit
      2  /
    Commit complete.
    Elapsed: 00:00:00.01
    SQL> update source_data_table
      2     set result = xmltransform(xml,xmltype(bfilename(USER,'&4'),nls_charset_id('WE8ISO8859P1'))).getClobVal()
      3   where fragCount = &3
      4  /
    old   2:    set result = xmltransform(xml,xmltype(bfilename(USER,'&4'),nls_charset_id('WE8ISO8859P1'))).getClobVal()
    new   2:    set result = xmltransform(xml,xmltype(bfilename(USER,'k_xsl.xsl'),nls_charset_id('WE8ISO8859P1'))).getClobVal()
    old   3:  where fragCount = &3
    new   3:  where fragCount = 100
    1 row updated.
    Elapsed: 00:00:00.23
    SQL> commit
      2  /
    Commit complete.
    Elapsed: 00:00:00.03
    SQL> select fragCount, dbms_lob.getLength(xml_text),dbms_lob.getLength(result)
      2    from source_data_table
      3  /
    FRAGCOUNT DBMS_LOB.GETLENGTH(XML_TEXT) DBMS_LOB.GETLENGTH(RESULT)
            50                        28014                     104550
           100                        55964                     209100
           500                       279564
          1000                       559064
          2000                      1118064
          5000                      2795064
    6 rows selected.
    Elapsed: 00:00:00.01
    SQL> quit
    Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.2.0 - Production
    With the Partitioning, OLAP and Data Mining options
    SQL*Plus: Release 10.2.0.2.0 - Production on Fri Feb 10 07:45:02 2006
    Copyright (c) 1982, 2005, Oracle.  All Rights Reserved.
    SQL> spool testcase_&3..log
    SQL> --
    SQL> connect &1/&2
    Connected.
    SQL> --
    SQL> set timing on
    SQL> --
    SQL> update source_data_table
      2     set xml = xmltype(xml_text)
      3   where fragCount = &3
      4  /
    old   3:  where fragCount = &3
    new   3:  where fragCount = 500
    1 row updated.
    Elapsed: 00:00:00.12
    SQL> commit
      2  /
    Commit complete.
    Elapsed: 00:00:00.03
    SQL> update source_data_table
      2     set result = xmltransform(xml,xmltype(bfilename(USER,'&4'),nls_charset_id('WE8ISO8859P1'))).getClobVal()
      3   where fragCount = &3
      4  /
    old   2:    set result = xmltransform(xml,xmltype(bfilename(USER,'&4'),nls_charset_id('WE8ISO8859P1'))).getClobVal()
    new   2:    set result = xmltransform(xml,xmltype(bfilename(USER,'k_xsl.xsl'),nls_charset_id('WE8ISO8859P1'))).getClobVal()
    old   3:  where fragCount = &3
    new   3:  where fragCount = 500
    1 row updated.
    Elapsed: 00:00:01.76
    SQL> commit
      2  /
    Commit complete.
    Elapsed: 00:00:00.00
    SQL> select fragCount, dbms_lob.getLength(xml_text),dbms_lob.getLength(result)
      2    from source_data_table
      3  /
    FRAGCOUNT DBMS_LOB.GETLENGTH(XML_TEXT) DBMS_LOB.GETLENGTH(RESULT)
            50                        28014                     104550
           100                        55964                     209100
           500                       279564                    1045500
          1000                       559064
          2000                      1118064
          5000                      2795064
    6 rows selected.
    Elapsed: 00:00:00.00
    SQL> quit
    Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.2.0 - Production
    With the Partitioning, OLAP and Data Mining options
    SQL*Plus: Release 10.2.0.2.0 - Production on Fri Feb 10 07:45:04 2006
    Copyright (c) 1982, 2005, Oracle.  All Rights Reserved.
    SQL> spool testcase_&3..log
    SQL> --
    SQL> connect &1/&2
    Connected.
    SQL> --
    SQL> set timing on
    SQL> --
    SQL> update source_data_table
      2     set xml = xmltype(xml_text)
      3   where fragCount = &3
      4  /
    old   3:  where fragCount = &3
    new   3:  where fragCount = 1000
    1 row updated.
    Elapsed: 00:00:00.28
    SQL> commit
      2  /
    Commit complete.
    Elapsed: 00:00:00.01
    SQL> update source_data_table
      2     set result = xmltransform(xml,xmltype(bfilename(USER,'&4'),nls_charset_id('WE8ISO8859P1'))).getClobVal()
      3   where fragCount = &3
      4  /
    old   2:    set result = xmltransform(xml,xmltype(bfilename(USER,'&4'),nls_charset_id('WE8ISO8859P1'))).getClobVal()
    new   2:    set result = xmltransform(xml,xmltype(bfilename(USER,'k_xsl.xsl'),nls_charset_id('WE8ISO8859P1'))).getClobVal()
    old   3:  where fragCount = &3
    new   3:  where fragCount = 1000
    1 row updated.
    Elapsed: 00:00:06.04
    SQL> commit
      2  /
    Commit complete.
    Elapsed: 00:00:00.00
    SQL> select fragCount, dbms_lob.getLength(xml_text),dbms_lob.getLength(result)
      2    from source_data_table
      3  /
    FRAGCOUNT DBMS_LOB.GETLENGTH(XML_TEXT) DBMS_LOB.GETLENGTH(RESULT)
            50                        28014                     104550
           100                        55964                     209100
           500                       279564                    1045500
          1000                       559064                    2091000
          2000                      1118064
          5000                      2795064
    6 rows selected.
    Elapsed: 00:00:00.00
    SQL> quit
    Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.2.0 - Production
    With the Partitioning, OLAP and Data Mining options
    SQL*Plus: Release 10.2.0.2.0 - Production on Fri Feb 10 07:45:11 2006
    Copyright (c) 1982, 2005, Oracle.  All Rights Reserved.
    SQL> spool testcase_&3..log
    SQL> --
    SQL> connect &1/&2
    Connected.
    SQL> --
    SQL> set timing on
    SQL> --
    SQL> update source_data_table
      2     set xml = xmltype(xml_text)
      3   where fragCount = &3
      4  /
    old   3:  where fragCount = &3
    new   3:  where fragCount = 2000
    1 row updated.
    Elapsed: 00:00:00.42
    SQL> commit
      2  /
    Commit complete.
    Elapsed: 00:00:00.02
    SQL> update source_data_table
      2     set result = xmltransform(xml,xmltype(bfilename(USER,'&4'),nls_charset_id('WE8ISO8859P1'))).getClobVal()
      3   where fragCount = &3
      4  /
    old   2:    set result = xmltransform(xml,xmltype(bfilename(USER,'&4'),nls_charset_id('WE8ISO8859P1'))).getClobVal()
    new   2:    set result = xmltransform(xml,xmltype(bfilename(USER,'k_xsl.xsl'),nls_charset_id('WE8ISO8859P1'))).getClobVal()
    old   3:  where fragCount = &3
    new   3:  where fragCount = 2000
    1 row updated.
    Elapsed: 00:00:24.43
    SQL> commit
      2  /
    Commit complete.
    Elapsed: 00:00:00.03
    SQL> select fragCount, dbms_lob.getLength(xml_text),dbms_lob.getLength(result)
      2    from source_data_table
      3  /
    FRAGCOUNT DBMS_LOB.GETLENGTH(XML_TEXT) DBMS_LOB.GETLENGTH(RESULT)
            50                        28014                     104550
           100                        55964                     209100
           500                       279564                    1045500
          1000                       559064                    2091000
          2000                      1118064                    4182000
          5000                      2795064
    6 rows selected.
    Elapsed: 00:00:00.00
    SQL> quit
    Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.2.0 - Production
    With the Partitioning, OLAP and Data Mining options
    SQL*Plus: Release 10.2.0.2.0 - Production on Fri Feb 10 07:45:36 2006
    Copyright (c) 1982, 2005, Oracle.  All Rights Reserved.
    SQL> spool testcase_&3..log
    SQL> --
    SQL> connect &1/&2
    Connected.
    SQL> --
    SQL> set timing on
    SQL> --
    SQL> update source_data_table
      2     set xml = xmltype(xml_text)
      3   where fragCount = &3
      4  /
    old   3:  where fragCount = &3
    new   3:  where fragCount = 5000
    1 row updated.
    Elapsed: 00:00:02.02
    SQL> commit
      2  /
    Commit complete.
    Elapsed: 00:00:00.05
    SQL> update source_data_table
      2     set result = xmltransform(xml,xmltype(bfilename(USER,'&4'),nls_charset_id('WE8ISO8859P1'))).getClobVal()
      3   where fragCount = &3
      4  /
    old   2:    set result = xmltransform(xml,xmltype(bfilename(USER,'&4'),nls_charset_id('WE8ISO8859P1'))).getClobVal()
    new   2:    set result = xmltransform(xml,xmltype(bfilename(USER,'k_xsl.xsl'),nls_charset_id('WE8ISO8859P1'))).getClobVal()
    old   3:  where fragCount = &3
    new   3:  where fragCount = 5000
    1 row updated.
    Elapsed: 00:03:19.02
    SQL> commit
      2  /
    Commit complete.
    Elapsed: 00:00:00.01
    SQL> select fragCount, dbms_lob.getLength(xml_text),dbms_lob.getLength(result)
      2    from source_data_table
      3  /
    FRAGCOUNT DBMS_LOB.GETLENGTH(XML_TEXT) DBMS_LOB.GETLENGTH(RESULT)
            50                        28014                     104550
           100                        55964                     209100
           500                       279564                    1045500
          1000                       559064                    2091000
          2000                      1118064                    4182000
          5000                      2795064                   10455000
    6 rows selected.
    Elapsed: 00:00:00.04
    SQL> quit
    Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.2.0 - Production
    With the Partitioning, OLAP and Data Mining options
    bash-2.05b$

  • Slow Performance with XMLType table

    Hi Mark,
    We are trying to implement a new interface program based on XML DB.
    We have a table named BO_XML.
    Create table BO_XML (Circuit_ID Varchar2(12), BO_XMLDOC XMLTYPE);
    Then, we inserted an xml document with an XSD into this BO_XML table.
    The xml document has 15 elements and it has around 6000 records.
    Once we insert the xml documents, the next step will be extract the contents of
    the xml documents and insert the record into the STG_TEMP table.
    But the following query for this takes more than 5 minutes and since we have
    many jobs like this to run, this query will need to be optimized.(please note
    that the same query run faster if it has few records in the xml document like 5
    to 10.)
    We are using xPath with XMLSequnce to parse the xml document.
    Please help.
    Thanks,
    Ron
    INSERT INTO STG_TEMP
    (Circuit_Number,
    Unit_Number,
    Unit_Name,
    Release,
    Release_Name,
    PlayDate,
    Show_Category,
    Admission_Type_ID,
    Ticket_Price,
    Tickets_Sold,
    Tickets_Refunded,
    Ticket_Tax,
    Total_Tax,
    Ticket_Open,
    Ticket_Close,
    FROM_EDI_INDICATOR,
    Updater,
    Time_Stamp
    SELECT
    x.Circuit_Id,
    TRIM(SUBSTR(extractValue(VALUE(t1),'//TheatreNumber'), 1, 12)) ,
    TRIM(SUBSTR(extractValue(VALUE(t1),'//TheatreName'), 1, 25) ) ,
    TRIM(SUBSTR(extractValue(VALUE(t1),'//MovieNumber'), 1, 12 ) ) ,
    TRIM(SUBSTR(extractValue(VALUE(t1),'//MovieTitle'), 1, 30) ),
    TRIM(SUBSTR(extractValue(VALUE(t1),'//DatePlayed'),1, 10) ),
    TRIM(SUBSTR(extractValue(VALUE(t1),'//ShowCategory'),1, 12)) ,
    TRIM(SUBSTR(extractValue(VALUE(t1),'//AdmissionType'),1, 12)) ,
    TRIM(SUBSTR(extractValue(VALUE(t1),'//TicketPrice'), 1, 10)),
    TRIM(SUBSTR(extractValue(VALUE(t1),'//TicketsSold'),1, 9)),
    TRIM(SUBSTR(extractValue(VALUE(t1),'//TicketRefund'),1, 5)),
    TRIM(SUBSTR(extractValue(VALUE(t1),'//TaxAmount'),1, 10)),
    TRIM(SUBSTR(extractValue(VALUE(t1),'//TaxAmount'),1, 10)),
    TRIM(SUBSTR(extractValue(VALUE(t1),'//OpeningTicket'),1, 10)),
    TRIM(SUBSTR(extractValue(VALUE(t1),'//ClosingTicket') , 1, 10)),
    'N',
    USER,
    SYSDATE
    FROM BO_XML x,
    TABLE ( xmlsequence ( EXTRACT( x.BO_XMLDOC,'BO/BO_RECORD'))) t1 ;

    I also have a performance issue with a xmltype column
    without an associated schema. If you're recommanding
    to associate a schema, I would like to understand why.
    Can you please explain this a bit more?
    Tnx,
    Jeroen

  • Bad performance of XMLType.appendChildXML

    declare
      l_xml  xmltype;
      l_xml2 xmltype;
    begin
      l_xml := xmltype.createxml(xmlData => bfilename('XMLDIR2', 'demo.xml'),
                                 csid    => 0,
                                 schema  => null);
      if l_xml.existsNode('/UNIVERSITY/PKU/DEP/PHY') = 0 then
        l_xml2 := l_xml;
        for i in 1 .. 1000000 loop
          l_xml2 := l_xml2.appendChildXML('/UNIVERSITY/PKU/DEP',
                                          xmltype('<PHY' || i || '/>')); --
        end loop;
      end if;
    end;
    line 11 take me whole day to execute , it seems a bottleneck , why ? many thanks!!!

    Database version please?
    line 11 take me whole day to execute , it seems a bottleneck , why ?
    Is it that suprising?
    Inserting 1,000,000 nodes one by one like this requires building a DOM object every single time out of a growing XML content. It ought to take time.
    This should be way faster :
    declare 
      l_xml  xmltype;
      l_xml2 xmltype;
    begin 
      l_xml := xmltype('<UNIVERSITY><PKU><DEP></DEP></PKU></UNIVERSITY>'); 
      if l_xml.existsNode('/UNIVERSITY/PKU/DEP/PHY') = 0 then
        select xmlagg(xmlelement(evalname('PHY'||to_char(level))))
        into l_xml2
        from dual
        connect by level <= 1000000;
         l_xml := l_xml.appendChildXML('/UNIVERSITY/PKU/DEP', l_xml2); 
      end if; 
    end;

  • Index don't improve the performance

    Hello everyone,
    I've a problem on improving the performance of XMLType Column. In fact, I've created a table with tow column a Number column and a XMLType column and found out that the retreival time is quite unexceptal for the following SQL Statement:
    Select id, extractValue(data, '/requestor/name') From
    requestor Where extractValue(data, '/requestor/name')
    = 'Req1640'
    So I have created an Index like this:
    create index req_name_index on requestor
    extractValue(data, '/requestor/name')
    but it don't improve the performance.
    What's wrong?
    Thanks

    Hi David,
    Once you had defined the 2 entries for the Browsing Index, have you rebuilt the indexes for the database ?
    You can either use db2index or export and re-import the data.
    Regards,
    Ludovic.

  • JDBC Batching and XMLTYPEs

    So, this question was originally asked here...
    http://stackoverflow.com/questions/4327337/does-oracles-xmltype-support-jdbc-batch-updates
    However, that was three years ago.  Does JDBC batching still not help with performance with XMLType objects as of 11.2.0.3?

    Hi William,
    Assumming that you are batching only Statements and CallableStatements.
    When a batch of say 10 statements are send and the 5th one fails, then Oracle JDBC returns an array of update counts till the
    no of successfully executed statements , in this case it will be an array containing 4 elements( since the 5th failed).
    from this we can find out which statement has failed.
    note: this feature does not work with PreparedStatement. (to my knowledge there is no way of getting it)
    Hope this helps
    Elango.

  • How to improve performance of a query that is based on an xmltype table

    Dear Friends,
    I have a query that is pulling records from an xmltype table with 9000 rows and it is running very slow.
    I am using XMLTABLE command to retreive the rows. It is taking upto 30 minutes to finish.
    Would you be able to suggest how I can make it faster. Thanks.
    Below is the query.....
    INSERT INTO temp_sap_po_receipt_history_t
    (po_number, po_line_number, doc_year,
    material_doc, material_doc_item, quantity, sap_ref_doc_no_long,
    reference_doc, movement_type_code,
    sap_ref_doc_no, posting_date, entry_date, entry_time, hist_type)
    SELECT :pin_po_number po_number,
    b.po_line_number, b.doc_year,
    b.material_doc, b.material_doc_item, b.quantity, b.sap_ref_doc_no_long,
    b.reference_doc, b.movement_type_code,
    b.sap_ref_doc_no, to_date(b.posting_date,'rrrr-mm-dd'),
    to_date(b.entry_date,'rrrr-mm-dd'), b.entry_time, b.hist_type
    FROM temp_xml t,
    XMLTABLE(XMLNAMESPACES('urn:sap-com:document:sap:rfc:functions' AS "n0"),
    '/n0:BAPI_PO_GETDETAIL1Response/POHISTORY/item'
    PASSING t.object_value
    COLUMNS PO_LINE_NUMBER VARCHAR2(20) PATH 'PO_ITEM',
    DOC_YEAR varchar2(4) PATH 'DOC_YEAR',
    MATERIAL_DOC varchar2(30) PATH 'MAT_DOC',
    MATERIAL_DOC_ITEM VARCHAR2(10) PATH 'MATDOC_ITEM',
    QUANTITY NUMBER(20,6) PATH 'QUANTITY',
    SAP_REF_DOC_NO_LONG VARCHAR2(20) PATH 'REF_DOC_NO_LONG',
    REFERENCE_DOC VARCHAR2(20) PATH 'REF_DOC',
    MOVEMENT_TYPE_CODE VARCHAR2(4) PATH 'MOVE_TYPE',
    SAP_REF_DOC_NO VARCHAR2(20) PATH 'REF_DOC_NO',
    POSTING_DATE VARCHAR2(10) PATH 'PSTNG_DATE',
    ENTRY_DATE VARCHAR2(10) PATH 'ENTRY_DATE',
    ENTRY_TIME VARCHAR2(8) PATH 'ENTRY_TIME',
    HIST_TYPE VARCHAR2(5) PATH 'HIST_TYPE') b;

    Based on response from mdrake on this thread:
    Re: XML file processing into oracle
    For large XML's, you can speed up the processing of XMLTABLE by using a registered schema...
    declare
      SCHEMAURL VARCHAR2(256) := 'http://xmlns.example.org/xsd/testcase.xsd';
      XMLSCHEMA VARCHAR2(4000) := '<?xml version="1.0" encoding="UTF-8"?>
         <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xdb="http://xmlns.oracle.com/xdb" xdb:storeVarrayAsTable="true">
            <xs:element name="cust_order" type="cust_orderType" xdb:defaultTable="CUST_ORDER_TBL"/>
            <xs:complexType name="groupType" xdb:maintainDOM="false">
                    <xs:sequence>
                            <xs:element name="item" type="itemType" maxOccurs="unbounded"/>
                    </xs:sequence>
                    <xs:attribute name="id" type="xs:byte" use="required"/>
            </xs:complexType>
            <xs:complexType name="itemType" xdb:maintainDOM="false">
                    <xs:simpleContent>
                            <xs:extension base="xs:string">
                                    <xs:attribute name="id" type="xs:short" use="required"/>
                                    <xs:attribute name="name" type="xs:string" use="required"/>
                            </xs:extension>
                    </xs:simpleContent>
            </xs:complexType>
            <xs:complexType name="cust_orderType" xdb:maintainDOM="false">
                    <xs:sequence>
                            <xs:element name="group" type="groupType" maxOccurs="unbounded"/>
                    </xs:sequence>
                    <xs:attribute name="cust_id" type="xs:short" use="required"/>
            </xs:complexType>
         </xs:schema>';
      INSTANCE  CLOB :=
    '<cust_order cust_id="12345">
      <group id="1">
        <item id="1" name="Standard Mouse">100</item>
        <item id="2" name="Keyboard">100</item>
        <item id="3" name="Memory Module 2Gb">200</item>
        <item id="4" name="Processor 3Ghz">25</item>
        <item id="5" name="Processor 2.4Ghz">75</item>
      </group>
      <group id="2">
        <item id="1" name="Graphics Tablet">15</item>
        <item id="2" name="Keyboard">15</item>
        <item id="3" name="Memory Module 4Gb">15</item>
        <item id="4" name="Processor Quad Core 2.8Ghz">15</item>
      </group>
      <group id="3">
        <item id="1" name="Optical Mouse">5</item>
        <item id="2" name="Ergo Keyboard">5</item>
        <item id="3" name="Memory Module 2Gb">10</item>
        <item id="4" name="Processor Dual Core 2.4Ghz">5</item>
        <item id="5" name="Dual Output Graphics Card">5</item>
        <item id="6" name="28inch LED Monitor">10</item>
        <item id="7" name="Webcam">5</item>
        <item id="8" name="A3 1200dpi Laser Printer">2</item>
      </group>
    </cust_order>';                
    begin
      dbms_xmlschema.registerSchema
         schemaurl       => SCHEMAURL
        ,schemadoc       => XMLSCHEMA
        ,local           => TRUE
        ,genTypes        => TRUE
        ,genBean         => FALSE
        ,genTables       => TRUE
        ,ENABLEHIERARCHY => DBMS_XMLSCHEMA.ENABLE_HIERARCHY_NONE
      execute immediate 'insert into CUST_ORDER_TBL values (XMLTYPE(:INSTANCE))' using INSTANCE;
    end;
    SQL> desc CUST_ORDER_TBL
    Name                                                                                                                                    Null?    Type
    TABLE of SYS.XMLTYPE(XMLSchema "http://xmlns.example.org/xsd/testcase.xsd" Element "cust_order") STORAGE Object-relational TYPE "cust_orderType222_T"
    SQL> set autotrace on explain
    SQL> set pages 60 lines 164 heading on
    SQL> col cust_id format a8
    SQL> select extract(object_value,'/cust_order/@cust_id') as cust_id
      2        ,grp.id as group_id, itm.id as item_id, itm.inm as item_name, itm.qty as item_qty
      3  from   CUST_ORDER_TBL
      4        ,XMLTABLE('/cust_order/group'
      5                  passing object_value
      6                  columns id   number       path '@id'
      7                         ,item xmltype      path 'item'
      8                 ) grp
      9        ,XMLTABLE('/item'
    10                  passing grp.item
    11                  columns id   number       path '@id'
    12                         ,inm  varchar2(30) path '@name'
    13                         ,qty  number       path '.'
    14                 ) itm
    15  /
    CUST_ID    GROUP_ID    ITEM_ID ITEM_NAME                        ITEM_QTY
    12345             1          1 Standard Mouse                        100
    12345             1          2 Keyboard                              100
    12345             1          3 Memory Module 2Gb                     200
    12345             1          4 Processor 3Ghz                         25
    12345             1          5 Processor 2.4Ghz                       75
    12345             2          1 Graphics Tablet                        15
    12345             2          2 Keyboard                               15
    12345             2          3 Memory Module 4Gb                      15
    12345             2          4 Processor Quad Core 2.8Ghz             15
    12345             3          1 Optical Mouse                           5
    12345             3          2 Ergo Keyboard                           5
    12345             3          3 Memory Module 2Gb                      10
    12345             3          4 Processor Dual Core 2.4Ghz              5
    12345             3          5 Dual Output Graphics Card               5
    12345             3          6 28inch LED Monitor                     10
    12345             3          7 Webcam                                  5
    12345             3          8 A3 1200dpi Laser Printer                2
    17 rows selected.Need at least 10.2.0.3 for performance i.e. to avoid COLLECTION ITERATOR PICKLER FETCH in execution plan...
    On 10.2.0.1:
    Execution Plan
    Plan hash value: 3741473841
    | Id  | Operation                          | Name                   | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT                   |                        | 24504 |    89M|   873   (1)| 00:00:11 |
    |   1 |  NESTED LOOPS                      |                        | 24504 |    89M|   873   (1)| 00:00:11 |
    |   2 |   NESTED LOOPS                     |                        |     3 | 11460 |   805   (1)| 00:00:10 |
    |   3 |    TABLE ACCESS FULL               | CUST_ORDER_TBL         |     1 |  3777 |     3   (0)| 00:00:01 |
    |*  4 |    INDEX RANGE SCAN                | SYS_IOT_TOP_774117     |     3 |   129 |     1   (0)| 00:00:01 |
    |   5 |   COLLECTION ITERATOR PICKLER FETCH| XMLSEQUENCEFROMXMLTYPE |       |       |            |       |
    Predicate Information (identified by operation id):
       4 - access("NESTED_TABLE_ID"="CUST_ORDER_TBL"."SYS_NC0000900010$")
           filter("SYS_NC_TYPEID$" IS NOT NULL)
    Note
       - dynamic sampling used for this statementOn 10.2.0.3:
    Execution Plan
    Plan hash value: 1048233240
    | Id  | Operation               | Name              | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT        |                   |    17 |   132K|   839   (0)| 00:00:11 |
    |   1 |  NESTED LOOPS           |                   |    17 |   132K|   839   (0)| 00:00:11 |
    |   2 |   MERGE JOIN CARTESIAN  |                   |    17 |   131K|   805   (0)| 00:00:10 |
    |   3 |    TABLE ACCESS FULL    | CUST_ORDER_TBL    |     1 |  3781 |     3   (0)| 00:00:01 |
    |   4 |    BUFFER SORT          |                   |    17 | 70839 |   802   (0)| 00:00:10 |
    |*  5 |     INDEX FAST FULL SCAN| SYS_IOT_TOP_56154 |    17 | 70839 |   802   (0)| 00:00:10 |
    |*  6 |   INDEX UNIQUE SCAN     | SYS_IOT_TOP_56152 |     1 |    43 |     2   (0)| 00:00:01 |
    |*  7 |    INDEX RANGE SCAN     | SYS_C006701       |     1 |       |     0   (0)| 00:00:01 |
    Predicate Information (identified by operation id):
       5 - filter("SYS_NC_TYPEID$" IS NOT NULL)
       6 - access("SYS_NTpzENS1H/RwSSC7TVzvlqmQ=="."NESTED_TABLE_ID"="SYS_NTnN5b8Q+8Txi9V
                  w5Ysl6x9w=="."SYS_NC0000600007$")
           filter("SYS_NC_TYPEID$" IS NOT NULL AND
                  "NESTED_TABLE_ID"="CUST_ORDER_TBL"."SYS_NC0000900010$")
       7 - access("SYS_NTpzENS1H/RwSSC7TVzvlqmQ=="."NESTED_TABLE_ID"="SYS_NTnN5b8Q+8Txi9V
                  w5Ysl6x9w=="."SYS_NC0000600007$")
    Note
       - dynamic sampling used for this statement----------------------------------------------------------------------------------------------------------
    -- CLEAN UP
    DROP TABLE CUST_ORDER_TBL purge;
    exec dbms_xmlschema.deleteschema('http://xmlns.example.org/xsd/testcase.xsd');

  • Oracle XQuery performance issue in XMLType column

    Dear All,
    As for oracle I'm using oracle 11g to measure the performance.
    I'm using data from XMark project which is a >100MB data of XML for bencmarking purposes.
    I make a table that contains an XMLType column and upload the data into that column, after doing that I try to do a query like this:
    select xmlquery(
    'for $i in /site/people/person
    where $i/id = "person0"
    return $i/name'
    passing BookXMLContent Returning Content)
    from Book;
    The purpose of this query is to retrieve the name of a person that have id = 'person0'
    My questions are:
    1. Did I do something wrong with my query?
    2. Is there any setting on the database that I should done prior to doing the query to done significantly better result?
    3. Is there any other approach that are much better than I currently used?
    Regards,
    Anthony Steven
    Edited by: mdrake on Nov 4, 2009 6:01 AM

    Anthony
    First, please read the licencing terms for Oracle ( And I suspect DB2, MSFT) . You are not allowed to publish externally (in any form, including forum posts :) ) the results of any benchmarking activities. I have edited your post accordingly. I hope this research is not part of a thesis or similar work that would intend making public as you and your institution would be in violation of your licence agreeement were you to do so.
    Now back to your question, how can you improve performance for XMark
    #1. Can you show us the create table statement you used, so we can see how you created your XMLType column BOOKXMLCONTENT.
    #2. Did you create any indexes
    #3. Did you look at the explain plan output.
    -Mark
    Edited by: mdrake on Nov 4, 2009 6:06 AM

  • Structured storage XMLType but disappointing performance

    Hi,
    This relates to Oracle 11g, but maybe the same question can be asked for 10g.
    I'm having a lot of big XML files which are structured following this xsd:
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <xs:schema
       xmlns="http://localhost/public/xsd/simple.xsd"
       targetNamespace="http://localhost/public/xsd/simple.xsd"
       xmlns:xs="http://www.w3.org/2001/XMLSchema"
       xmlns:xdb="http://xmlns.oracle.com/xdb"
       elementFormDefault="qualified"
       attributeFormDefault="unqualified"
       xdb:storeVarrayAsTable="true">
      <xs:element name="root" xdb:defaultTable="simple_or" xdb:maintainDOM="false">
        <xs:complexType>
          <xs:sequence>
            <xs:element name="ea">
              <xs:complexType>
                <xs:sequence>
                  <xs:element name="eb" minOccurs="1" maxOccurs="unbounded">
                    <xs:complexType>
                      <xs:sequence>
                        <xs:element name="c1" type="xs:double" />
                        <xs:element name="c2" type="xs:double" />
                        <xs:element name="c3" type="xs:double" />
                      </xs:sequence>
                    </xs:complexType>
                  </xs:element>
                </xs:sequence>
               </xs:complexType>
            </xs:element>
          </xs:sequence>
        </xs:complexType>
      </xs:element>
    </xs:schema>I create a VARRAY (the order is important) based structured storage table using the following commands:
    declare
      l_bfile bfile;
      res boolean;
    begin
      l_bfile := bfilename('EXDIR', 'simple.xsd');
      dbms_lob.open(l_bfile);
      dbms_xdb.deleteResource('/public/simple.xsd',4);
      res := dbms_xdb.createResource('/public/simple.xsd',l_bfile);
    end;
    BEGIN
      DBMS_XMLSchema.deleteSchema(
        schemaurl=>'http://localhost/public/xsd/simple.xsd',
        delete_option=>DBMS_XMLSchema.Delete_Cascade_Force);
    END;
    begin
       dbms_xmlschema.registerSchema(schemaurl => 'http://localhost/public/xsd/simple.xsd',
                                     schemadoc => xdbUriType('/public/simple.xsd').getXML(),
                                     local     => true,
                                     gentypes  => true,
                                     genbean   => false,
                                     gentables => true,
                                     force     => false,
                                     owner     => user);
    end;
    CREATE TABLE simple_or_1 OF XMLType
      XMLSCHEMA "http://localhost/public/xsd/simple.xsd"
      ELEMENT "root"
      VARRAY "XMLDATA"."ea"."eb"
        STORE AS TABLE simple_nested1
            ((PRIMARY KEY (NESTED_TABLE_ID, SYS_NC_ARRAY_INDEX$)))
    /And I load some XML files of the following form:
    <?xml version="1.0" encoding="UTF-8"?>
    <root xmlns="http://localhost/public/xsd/simple.xsd">
    <ea>
    <eb>
    <c1>4.0</c1>
    <c2>5.0</c2>
    <c3>6.0</c3>
    </eb>
    <eb>
    <c1>7.0</c1>
    <c2>8.0</c2>
    <c3>9.0</c3>
    </eb>
    <eb>
    <c1>7.0</c1>
    ... etc ...
    </ea>
    </root>
    Every document has about 50.000 <eb> elements and I loaded 6 sample documents.
    A simple query like the following takes about 5 minutes:
    SELECT XMLQuery('
      declare default element namespace "http://localhost/public/xsd/simple.xsd"; (: :)
      for $i in /root
      return max($i/a/b/c2)
    ' PASSING OBJECT_VALUE RETURNING CONTENT)
    FROM simple_or_1;The explain plan shows the following:
    | Id  | Operation                    | Name           | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT             |                |     6 |    60 |     3   (0)| 00:00:01 |
    |   1 |  SORT AGGREGATE              |                |     1 |  1901 |            |          |
    |*  2 |   TABLE ACCESS BY INDEX ROWID| SIMPLE_NESTED1 |  1969 |  3655K|     6   (0)| 00:00:01 |
    |*  3 |    INDEX RANGE SCAN          | SYS_C009750    |   787 |       |     2   (0)| 00:00:01 |
    |   4 |  SORT AGGREGATE              |                |     1 |       |            |          |
    |   5 |   FAST DUAL                  |                |     1 |       |     2   (0)| 00:00:01 |
    |   6 |  TABLE ACCESS FULL           | SIMPLE_OR_1    |     6 |    60 |     3   (0)| 00:00:01 |
    Predicate Information (identified by operation id):
       2 - filter(SYS_XMLCONV("SYS_ALIAS_2"."SYS_XDBPD$",0,32,'3952ABE048DCF8D6E040007F0101
                  7EA4',1,5561,1) IS NOT NULL)
       3 - access("NESTED_TABLE_ID"=:B1)I'm not understanding the low performance of 5 minutes... is there anyone who can explain and help out?

    Note with DOM Fidelity disabled on all types the SYS_XMLCONV is replaced with the more efficeint SYS_XMLGEN. However this is still not as efficient as the XMLTable approach..
    C:\Documents and Settings\Mark D Drake>sqlplus sys/oracle as sysdba
    SQL*Plus: Release 11.1.0.6.0 - Production on Fri Sep 7 06:03:39 2007
    Copyright (c) 1982, 2007, Oracle.  All rights reserved.
    Connected to:
    Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - Beta
    With the Partitioning, OLAP, Data Mining and Real Application Testing options
    SQL> connect / as sysdba
    Connected.
    SQL> --
    SQL> drop user Tijink cascade
      2  /
    drop user Tijink cascade
    ERROR at line 1:
    ORA-01918: user 'TIJINK' does not exist
    SQL> grant connect, resource, alter session, create view to Tijink  identified by  Tijink
      2  /
    Grant succeeded.
    SQL> conn Tijink/Tijink
    Connected.
    SQL> --
    SQL> set long 10000000
    SQL> set pages 5000
    SQL> var schemaPath varchar2(256)
    SQL> var schemaURL  varchar2(256)
    SQL> var xmlSchema  clob;
    SQL> --
    SQL> begin
      2     :schemaURL := 'http://localhost/public/xsd/simple.xsd';
      3     :schemaPath := '/public/simple.xsd';
      4     :xmlSchema :=
      5  '<?xml version="1.0" encoding="ISO-8859-1"?>
      6  <xs:schema
      7     xmlns="http://localhost/public/xsd/simple.xsd"
      8     targetNamespace="http://localhost/public/xsd/simple.xsd"
      9     xmlns:xs="http://www.w3.org/2001/XMLSchema"
    10     xmlns:xdb="http://xmlns.oracle.com/xdb"
    11     elementFormDefault="qualified"
    12     attributeFormDefault="unqualified"
    13     xdb:storeVarrayAsTable="true">
    14    <xs:element name="root" xdb:defaultTable="simple_or">
    15      <xs:complexType xdb:maintainDOM="false">
    16        <xs:sequence>
    17          <xs:element name="ea">
    18            <xs:complexType xdb:maintainDOM="false">
    19              <xs:sequence>
    20                <xs:element name="eb" minOccurs="1" maxOccurs="unbounded">
    21                  <xs:complexType xdb:maintainDOM="false">
    22                    <xs:sequence>
    23                      <xs:element name="c1" type="xs:double" />
    24                      <xs:element name="c2" type="xs:double" />
    25                      <xs:element name="c3" type="xs:double" />
    26                    </xs:sequence>
    27                  </xs:complexType>
    28                </xs:element>
    29              </xs:sequence>
    30             </xs:complexType>
    31          </xs:element>
    32        </xs:sequence>
    33      </xs:complexType>
    34    </xs:element>
    35  </xs:schema>';
    36  end;
    37  /
    PL/SQL procedure successfully completed.
    SQL> alter session set events='31098 trace name context forever'
      2  /
    Session altered.
    SQL> DECLARE
      2    BINARY_XML boolean:=FALSE;
      3  BEGIN
      4     IF (BINARY_XML)
      5     THEN
      6        dbms_xmlschema.registerSchema(SCHEMAURL => :schemaURL,
      7                                      SCHEMADOC => :xmlschema,
      8                                      LOCAL     => TRUE,
      9                                      GENTYPES  => FALSE,
    10                                      GENBEAN   => FALSE,
    11                                      GENTABLES => FALSE,
    12                                      ENABLEHIERARCHY => DBMS_XMLSCHEMA.ENABLE_HIERARCHY_NONE,
    13                                      FORCE     => FALSE,
    14                                      OPTIONS   => DBMS_XMLSCHEMA.REGISTER_BINARYXML,
    15                                      OWNER     => USER);
    16     ELSE
    17        dbms_xmlschema.registerSchema(SCHEMAURL => :schemaURL,
    18                                      SCHEMADOC => :xmlSchema,
    19                                      LOCAL     => TRUE,
    20                                      GENTYPES  => TRUE,
    21                                      GENBEAN   => FALSE,
    22                                      GENTABLES => TRUE,
    23                                      ENABLEHIERARCHY => DBMS_XMLSCHEMA.ENABLE_HIERARCHY_NONE,
    24                                      FORCE     => FALSE,
    25                                      OWNER     => USER);
    26     END IF;
    27  END;
    28  /
    PL/SQL procedure successfully completed.
    SQL> --
    SQL> set timing on
    SQL> set long 1000000
    SQL> set pages 50000
    SQL> set lines 200
    SQL> --
    SQL> call  dbms_stats.GATHER_SCHEMA_STATS('TIJINK')
      2  /
    Call completed.
    Elapsed: 00:00:01.67
    SQL> set autotrace on explain
    SQL> --
    SQL> SELECT XMLQuery
      2         ('
      3      declare default element namespace "http://localhost/public/xsd/simple.xsd"; (: :)
      4      for $i in /root
      5      return max($i/ea/eb/c2)
      6      ' PASSING OBJECT_VALUE RETURNING CONTENT)
      7    FROM "simple_or"
      8  /
    no rows selected
    Elapsed: 00:00:00.28
    Execution Plan
    Plan hash value: 3716725992
    | Id  | Operation                    | Name                           | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT             |                                |     1 |    10 |     2   (0)| 00:00:01 |
    |   1 |  SORT AGGREGATE              |                                |     1 |    23 |            |       |
    |*  2 |   TABLE ACCESS BY INDEX ROWID| SYS_NTobq/uFrTQGaOrq3BeDy9Eg== |     1 |    23 |     0   (0)| 00:00:01 |
    |*  3 |    INDEX RANGE SCAN          | SYS_C009648                    |     1 |       |     0   (0)| 00:00:01 |
    |   4 |  SORT AGGREGATE              |                                |     1 |       |            |       |
    |   5 |   FAST DUAL                  |                                |     1 |       |     2   (0)| 00:00:01 |
    |   6 |  TABLE ACCESS FULL           | simple_or                      |     1 |    10 |     2   (0)| 00:00:01 |
    Predicate Information (identified by operation id):
       2 - filter(SYS_XMLGEN(TO_CHAR("SYS_ALIAS_1"."c2")) IS NOT NULL)
       3 - access("NESTED_TABLE_ID"=:B1)
    SQL> select max(c2)
      2    from "simple_or",
      3         xmltable
      4         (
      5           xmlnamespaces
      6           (
      7              default 'http://localhost/public/xsd/simple.xsd'
      8           ),
      9           '/root/ea/eb'
    10           passing OBJECT_VALUE
    11           columns
    12           C2 PATH 'c2'
    13         )
    14  /
       MAX(C2)
    Elapsed: 00:00:00.15
    Execution Plan
    Plan hash value: 1041340395
    | Id  | Operation                     | Name                           | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT              |                                |     1 |    33 |     0   (0)| 00:00:01 |
    |   1 |  SORT AGGREGATE               |                                |     1 |    33 |            |          |
    |   2 |   NESTED LOOPS                |                                |       |       |            |          |
    |   3 |    NESTED LOOPS               |                                |     1 |    33 |     0   (0)| 00:00:01 |
    |   4 |     INDEX FULL SCAN           | SYS_C009649                    |     1 |    10 |     0   (0)| 00:00:01 |
    |*  5 |     INDEX RANGE SCAN          | SYS_C009648                    |     1 |       |     0   (0)| 00:00:01 |
    |   6 |    TABLE ACCESS BY INDEX ROWID| SYS_NTobq/uFrTQGaOrq3BeDy9Eg== |     1 |    23 |     0   (0)| 00:00:01 |
    Predicate Information (identified by operation id):
       5 - access("NESTED_TABLE_ID"="simple_or"."SYS_NC0000700008$")
    SQL> desc "simple_or"
    Name                                                                                                      Null?    Type
    TABLE of SYS.XMLTYPE(XMLSchema "http://localhost/public/xsd/simple.xsd" Element "root") STORAGE Object-relational TYPE "root648_T"
    SQL> desc "root648_T"
    Name                                                                                                      Null?    Type
    ea                                                                                                                 ea649_T
    SQL> desc "ea649_T"
    Name                                                                                                      Null?    Type
    eb                                                                                                                 eb651_COLL
    SQL> desc "eb651_COLL"
    "eb651_COLL" VARRAY(2147483647) OF eb650_T
    Name                                                                                                      Null?    Type
    c1                                                                                                                 NUMBER
    c2                                                                                                                 NUMBER
    c3                                                                                                                 NUMBER
    SQL>

  • Insert performance on a table with schema based XMLType column

    Hi,
    We are inserting around 500K rows into a table which has one XMLType column (schema based). Schema is simple and the size of the XMLType column is also not very large (on an average only around 100 bytes (max might be around 1k-2k), but it takes around 1 hr for every 20K rows, which seems very slow.
    The schema is like this :
    <schema targetNamespace="http://www.citadon.com/xml/test.xsd"
    xmlns="http://www.w3.org/2001/XMLSchema"
    xmlns:xdb="http://xmlns.oracle.com/xdb"
    xdb:storeVarrayAsTable="true"
    version="1.0" elementFormDefault="qualified">
    <element name="cas">
    <complexType>
    <sequence>
    <element name="ca" minOccurs="0" maxOccurs="unbounded">
    <complexType>
    <sequence>
    <element name="id" type="string"/>
    <element name="value" type="string"/>
    </sequence>
    </complexType>
    </element>
    </sequence>
    </complexType>
    </element>
    </schema>
    Any thoughts on how to improve performance?
    -Srini

    You need to have sufficient data.. Also the event show in the following code may help depending on the nature of the query....
    Note in the PurchaseOrder Example if I only have 133 docs, instead of 10,000 I will get tablescan and index full scans
    C:\oracle\xdb\bugs\xdbBasicDemo>sqlplus /nolog @testcase XDBTEST XDBTEST
    SQL*Plus: Release 10.1.0.3.0 - Production on Fri Aug 27 22:57:36 2004
    Copyright (c) 1982, 2004, Oracle. All rights reserved.
    SQL> spool testcase.log
    SQL> set trimspool on
    SQL> connect &1/&2
    Connected.
    SQL> --
    SQL> set timing on
    SQL> set long 10000
    SQL> set pages 10000
    SQL> set feedback on
    SQL> set lines 132
    SQL> set pages 50
    SQL> --
    SQL> drop index iPartNumberIndex
    2 /
    Index dropped.
    Elapsed: 00:00:02.25
    SQL> alter index LINEITEM_LIST rebuild
    2 /
    Index altered.
    Elapsed: 00:00:02.15
    SQL> desc PURCHASEORDER
    Name Null? Type
    TABLE of SYS.XMLTYPE(XMLSchema "http://localhost:8080/home/SCOTT/poSource/xsd/purchaseOrder.xsd" Element "Pu
    ject-relational TYPE "PURCHASEORDER_T"
    SQL> --
    SQL> col level format 99999
    SQL> col parent_table_column format A32
    SQL> col table_name format A32
    SQL> col table_type_name format A32
    SQL> --
    SQL> select level, PARENT_TABLE_COLUMN, TABLE_TYPE_NAME, TABLE_NAME
    2 from USER_NESTED_TABLES
    3 connect by PRIOR TABLE_NAME = PARENT_TABLE_NAME
    4 start with PARENT_TABLE_NAME = 'PURCHASEORDER'
    5 /
    LEVEL PARENT_TABLE_COLUMN TABLE_TYPE_NAME TABLE_NAME
    1 "XMLDATA"."ACTIONS"."ACTION" ACTION_V ACTION_TABLE
    1 "XMLDATA"."LINEITEMS"."LINEITEM" LINEITEM_V LINEITEM_TABLE
    2 rows selected.
    Elapsed: 00:00:13.60
    SQL> desc LINEITEM_T
    LINEITEM_T is NOT FINAL
    Name Null? Type
    SYS_XDBPD$ XDB.XDB$RAW_LIST_T
    ITEMNUMBER NUMBER(38)
    DESCRIPTION VARCHAR2(256 CHAR)
    PART PART_T
    SQL> --
    SQL> desc PART_T
    PART_T is NOT FINAL
    Name Null? Type
    SYS_XDBPD$ XDB.XDB$RAW_LIST_T
    PART_NUMBER VARCHAR2(14 CHAR)
    QUANTITY NUMBER(12,2)
    UNITPRICE NUMBER(8,4)
    SQL> --
    SQL> select count(*)
    2 from purchaseorder
    3 /
    COUNT(*)
    10000
    1 row selected.
    Elapsed: 00:00:05.31
    SQL> select count(*)
    2 from purchaseorder,
    3 table (xmlsequence(extract(object_value,'/PurchaseOrder/LineItems/LineItem'))) l
    4 /
    COUNT(*)
    148814
    1 row selected.
    Elapsed: 00:09:40.54
    SQL> create index iPartNumberIndex
    2 on LINEITEM_TABLE l
    3 ( l.PART.PART_NUMBER,NESTED_TABLE_ID)
    4 /
    Index created.
    Elapsed: 00:00:36.11
    SQL> explain plan for
    2 select count(*)
    3 from purchaseorder
    4 where existsNode(object_value,'/PurchaseOrder/LineItems/LineItem[Part/@Id="717951002372"]') = 1
    5 /
    Explained.
    Elapsed: 00:00:01.14
    SQL> select plan_table_output from table(dbms_xplan.display('plan_table',null,'serial'))
    2 /
    PLAN_TABLE_OUTPUT
    Plan hash value: 2571550067
    | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
    | 0 | SELECT STATEMENT | | 1 | 116 | 93 (2)| 00:00:02 |
    | 1 | SORT AGGREGATE | | 1 | 116 | | |
    | 2 | NESTED LOOPS | | 25 | 2900 | 93 (2)| 00:00:02 |
    | 3 | SORT UNIQUE | | 25 | 1675 | 79 (0)| 00:00:01 |
    |* 4 | INDEX UNIQUE SCAN | LINEITEM_DATA | 25 | 1675 | 79 (0)| 00:00:01 |
    |* 5 | INDEX RANGE SCAN | IPARTNUMBERINDEX | 25 | | 3 (0)| 00:00:01 |
    |* 6 | TABLE ACCESS BY INDEX ROWID| PURCHASEORDER | 1 | 49 | 1 (0)| 00:00:01 |
    |* 7 | INDEX UNIQUE SCAN | LINEITEM_LIST | 1 | | 0 (0)| 00:00:01 |
    Predicate Information (identified by operation id):
    4 - access("SYS_NC00011$"='717951002372')
    5 - access("SYS_NC00011$"='717951002372')
    6 - filter(SYS_CHECKACL("ACLOID","OWNERID",xmltype(''<privilege
    xmlns="http://xmlns.oracle.com/xdb/acl.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-in
    stance" xsi:schemaLocation="http://xmlns.oracle.com/xdb/acl.xsd
    http://xmlns.oracle.com/xdb/acl.xsd DAV:http://xmlns.oracle.com/xdb/dav.xsd"><read-propert
    ies/><read-contents/></privilege>''))=1)
    7 - access("NESTED_TABLE_ID"="PURCHASEORDER"."SYS_NC0003400035$")
    26 rows selected.
    Elapsed: 00:00:03.12
    SQL> select count(*)
    2 from purchaseorder
    3 where existsNode(object_value,'/PurchaseOrder/LineItems/LineItem[Part/@Id="717951002372"]') = 1
    4 /
    COUNT(*)
    33
    1 row selected.
    Elapsed: 00:00:04.63
    SQL> select count(*)
    2 from purchaseorder,
    3 table (xmlsequence(extract(object_value,'/PurchaseOrder/LineItems/LineItem'))) l
    4 where existsNode(value(l),'/LineItem[Part/@Id="717951002372"]') = 1
    5 /
    COUNT(*)
    33
    1 row selected.
    Elapsed: 00:00:00.32
    SQL> select plan_table_output from table(dbms_xplan.display('plan_table',null,'serial'))
    2 /
    PLAN_TABLE_OUTPUT
    Plan hash value: 2571550067
    | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
    | 0 | SELECT STATEMENT | | 1 | 116 | 93 (2)| 00:00:02 |
    | 1 | SORT AGGREGATE | | 1 | 116 | | |
    | 2 | NESTED LOOPS | | 25 | 2900 | 93 (2)| 00:00:02 |
    | 3 | SORT UNIQUE | | 25 | 1675 | 79 (0)| 00:00:01 |
    |* 4 | INDEX UNIQUE SCAN | LINEITEM_DATA | 25 | 1675 | 79 (0)| 00:00:01 |
    |* 5 | INDEX RANGE SCAN | IPARTNUMBERINDEX | 25 | | 3 (0)| 00:00:01 |
    |* 6 | TABLE ACCESS BY INDEX ROWID| PURCHASEORDER | 1 | 49 | 1 (0)| 00:00:01 |
    |* 7 | INDEX UNIQUE SCAN | LINEITEM_LIST | 1 | | 0 (0)| 00:00:01 |
    Predicate Information (identified by operation id):
    4 - access("SYS_NC00011$"='717951002372')
    5 - access("SYS_NC00011$"='717951002372')
    6 - filter(SYS_CHECKACL("ACLOID","OWNERID",xmltype(''<privilege
    xmlns="http://xmlns.oracle.com/xdb/acl.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-in
    stance" xsi:schemaLocation="http://xmlns.oracle.com/xdb/acl.xsd
    http://xmlns.oracle.com/xdb/acl.xsd DAV:http://xmlns.oracle.com/xdb/dav.xsd"><read-propert
    ies/><read-contents/></privilege>''))=1)
    7 - access("NESTED_TABLE_ID"="PURCHASEORDER"."SYS_NC0003400035$")
    26 rows selected.
    Elapsed: 00:00:00.04
    SQL> explain plan for
    2 select extractValue(object_value,'/PurchaseOrder/Reference')
    3 from purchaseorder,
    4 table (xmlsequence(extract(object_value,'/PurchaseOrder/LineItems/LineItem'))) l
    5 where existsNode(value(l),'/LineItem[Part/@Id="717951002372"]') = 1
    6 /
    Explained.
    Elapsed: 00:00:00.07
    SQL> select plan_table_output from table(dbms_xplan.display('plan_table',null,'serial'))
    2 /
    PLAN_TABLE_OUTPUT
    Plan hash value: 713363872
    | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
    | 0 | SELECT STATEMENT | | 25 | 8000 | 104 (0)| 00:00:02 |
    | 1 | NESTED LOOPS | | 25 | 8000 | 104 (0)| 00:00:02 |
    |* 2 | INDEX UNIQUE SCAN | LINEITEM_DATA | 25 | 1675 | 79 (0)| 00:00:01 |
    |* 3 | INDEX RANGE SCAN | IPARTNUMBERINDEX | 25 | | 3 (0)| 00:00:01 |
    |* 4 | TABLE ACCESS BY INDEX ROWID| PURCHASEORDER | 1 | 253 | 1 (0)| 00:00:01 |
    |* 5 | INDEX UNIQUE SCAN | LINEITEM_LIST | 1 | | 0 (0)| 00:00:01 |
    Predicate Information (identified by operation id):
    2 - access("SYS_NC00011$"='717951002372')
    3 - access("SYS_NC00011$"='717951002372')
    4 - filter(SYS_CHECKACL("ACLOID","OWNERID",xmltype(''<privilege
    xmlns="http://xmlns.oracle.com/xdb/acl.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-i
    nstance" xsi:schemaLocation="http://xmlns.oracle.com/xdb/acl.xsd
    http://xmlns.oracle.com/xdb/acl.xsd DAV:http://xmlns.oracle.com/xdb/dav.xsd"><read-proper
    ties/><read-contents/></privilege>''))=1)
    5 - access("NESTED_TABLE_ID"="PURCHASEORDER"."SYS_NC0003400035$")
    24 rows selected.
    Elapsed: 00:00:00.04
    SQL> select extractValue(object_value,'/PurchaseOrder/Reference')
    2 from purchaseorder,
    3 table (xmlsequence(extract(object_value,'/PurchaseOrder/LineItems/LineItem'))) l
    4 where existsNode(value(l),'/LineItem[Part/@Id="717951002372"]') = 1
    5 /
    EXTRACTVALUE(OBJECT_VALUE,'/PU
    MWEISS-20030616154327385GMT
    NSARCHAN-20030703170041824GMT
    HBAER-20030206173836987GMT
    LOZER-20031110131149107GMT
    WTAYLOR-20030120174534374GMT
    MHARTSTE-20031103172937613GMT
    KGEE-20030919215826550GMT
    PSULLY-20030712141634504GMT
    JPATEL-20030630175356693GMT
    RMATOS-2003072920455000GMT
    DRAPHEAL-20030528180033254GMT
    JRUSSEL-20031121213026539GMT
    PTUCKER-20030918160532301GMT
    SVOLLMAN-20031027120838903GMT
    WGIETZ-20030208185026303GMT
    TFOX-20030110164614994GMT
    JPATEL-20030304214301386GMT
    GGEONI-20030606135257846GMT
    STOBIAS-20030817120358785GMT
    COLSEN-20030525200717658GMT
    SBAIDA-20030224182546606GMT
    IMIKKILI-20030118180347537GMT
    ABULL-20030429162730766GMT
    NSARCHAN-20031113183134873GMT
    LBISSOT-20030809134114505GMT
    JKING-20030420162058859GMT
    JMALLIN-20030506152048261GMT
    AFRIPP-20030311153808601GMT
    SHIGGINS-20030831151756257GMT
    DBERNSTE-20030626122725631GMT
    KPARTNER-20031021160248962GMT
    ABANDA-2003062721524842GMT
    DOCONNEL-20030904214708637GMT
    33 rows selected.
    Elapsed: 00:00:00.07
    SQL> explain plan for
    2 select extractValue(object_value,'/PurchaseOrder/Reference')
    3 from purchaseorder
    4 where existsNode
    5 (
    6 object_value,
    7 '/PurchaseOrder/LineItems/LineItem/Part[@Id="717951002372"]'
    8 ) = 1
    9 /
    Explained.
    Elapsed: 00:00:00.02
    SQL> select plan_table_output from table(dbms_xplan.display('plan_table',null,'serial'))
    2 /
    PLAN_TABLE_OUTPUT
    Plan hash value: 849879259
    | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
    | 0 | SELECT STATEMENT | | 25 | 8000 | 93 (2)| 00:00:02 |
    | 1 | NESTED LOOPS | | 25 | 8000 | 93 (2)| 00:00:02 |
    | 2 | SORT UNIQUE | | 25 | 1675 | 79 (0)| 00:00:01 |
    |* 3 | INDEX UNIQUE SCAN | LINEITEM_DATA | 25 | 1675 | 79 (0)| 00:00:01 |
    |* 4 | INDEX RANGE SCAN | IPARTNUMBERINDEX | 25 | | 3 (0)| 00:00:01 |
    |* 5 | TABLE ACCESS BY INDEX ROWID| PURCHASEORDER | 1 | 253 | 1 (0)| 00:00:01 |
    |* 6 | INDEX UNIQUE SCAN | LINEITEM_LIST | 1 | | 0 (0)| 00:00:01 |
    Predicate Information (identified by operation id):
    3 - access("SYS_NC00011$"='717951002372')
    4 - access("SYS_NC00011$"='717951002372')
    5 - filter(SYS_CHECKACL("ACLOID","OWNERID",xmltype(''<privilege
    xmlns="http://xmlns.oracle.com/xdb/acl.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-i
    nstance" xsi:schemaLocation="http://xmlns.oracle.com/xdb/acl.xsd
    http://xmlns.oracle.com/xdb/acl.xsd DAV:http://xmlns.oracle.com/xdb/dav.xsd"><read-proper
    ties/><read-contents/></privilege>''))=1)
    6 - access("NESTED_TABLE_ID"="PURCHASEORDER"."SYS_NC0003400035$")
    25 rows selected.
    Elapsed: 00:00:00.03
    SQL> select extractValue(object_value,'/PurchaseOrder/Reference')
    2 from purchaseorder
    3 where existsNode
    4 (
    5 object_value,
    6 '/PurchaseOrder/LineItems/LineItem/Part[@Id="717951002372"]'
    7 ) = 1
    8 /
    EXTRACTVALUE(OBJECT_VALUE,'/PU
    MWEISS-20030616154327385GMT
    NSARCHAN-20030703170041824GMT
    HBAER-20030206173836987GMT
    LOZER-20031110131149107GMT
    WTAYLOR-20030120174534374GMT
    MHARTSTE-20031103172937613GMT
    KGEE-20030919215826550GMT
    PSULLY-20030712141634504GMT
    JPATEL-20030630175356693GMT
    RMATOS-2003072920455000GMT
    DRAPHEAL-20030528180033254GMT
    JRUSSEL-20031121213026539GMT
    PTUCKER-20030918160532301GMT
    SVOLLMAN-20031027120838903GMT
    WGIETZ-20030208185026303GMT
    TFOX-20030110164614994GMT
    JPATEL-20030304214301386GMT
    GGEONI-20030606135257846GMT
    STOBIAS-20030817120358785GMT
    COLSEN-20030525200717658GMT
    SBAIDA-20030224182546606GMT
    IMIKKILI-20030118180347537GMT
    ABULL-20030429162730766GMT
    NSARCHAN-20031113183134873GMT
    LBISSOT-20030809134114505GMT
    JKING-20030420162058859GMT
    JMALLIN-20030506152048261GMT
    AFRIPP-20030311153808601GMT
    SHIGGINS-20030831151756257GMT
    DBERNSTE-20030626122725631GMT
    KPARTNER-20031021160248962GMT
    ABANDA-2003062721524842GMT
    DOCONNEL-20030904214708637GMT
    33 rows selected.
    Elapsed: 00:00:00.04
    SQL> alter session set events ='19027 trace name context forever, level 0x800000'
    2 /
    Session altered.
    Elapsed: 00:00:00.00
    SQL> explain plan for
    2 select count(*)
    3 from purchaseorder
    4 where existsNode(object_value,'/PurchaseOrder/LineItems/LineItem[Part/@Id="717951002372"]') = 1
    5 /
    Explained.
    Elapsed: 00:00:00.03
    SQL> select plan_table_output from table(dbms_xplan.display('plan_table',null,'serial'))
    2 /
    PLAN_TABLE_OUTPUT
    Plan hash value: 3049344732
    | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
    | 0 | SELECT STATEMENT | | 1 | 69 | 17 (6)| 00:00:01 |
    | 1 | SORT AGGREGATE | | 1 | 69 | | |
    | 2 | NESTED LOOPS | | 25 | 1725 | 17 (6)| 00:00:01 |
    | 3 | SORT UNIQUE | | 25 | 750 | 3 (0)| 00:00:01 |
    |* 4 | INDEX RANGE SCAN | IPARTNUMBERINDEX | 25 | 750 | 3 (0)| 00:00:01 |
    |* 5 | TABLE ACCESS BY INDEX ROWID| PURCHASEORDER | 1 | 39 | 1 (0)| 00:00:01 |
    |* 6 | INDEX UNIQUE SCAN | LINEITEM_LIST | 1 | | 0 (0)| 00:00:01 |
    Predicate Information (identified by operation id):
    4 - access("SYS_NC00011$"='717951002372')
    5 - filter(SYS_CHECKACL("ACLOID","OWNERID",xmltype(''<privilege
    xmlns="http://xmlns.oracle.com/xdb/acl.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-in
    stance" xsi:schemaLocation="http://xmlns.oracle.com/xdb/acl.xsd
    http://xmlns.oracle.com/xdb/acl.xsd DAV:http://xmlns.oracle.com/xdb/dav.xsd"><read-propert
    ies/><read-contents/></privilege>''))=1)
    6 - access("NESTED_TABLE_ID"="PURCHASEORDER"."SYS_NC0003400035$")
    24 rows selected.
    Elapsed: 00:00:00.03
    SQL> select count(*)
    2 from purchaseorder
    3 where existsNode(object_value,'/PurchaseOrder/LineItems/LineItem[Part/@Id="717951002372"]') = 1
    4 /
    COUNT(*)
    33
    1 row selected.
    Elapsed: 00:00:00.01
    SQL> select count(*)
    2 from purchaseorder,
    3 table (xmlsequence(extract(object_value,'/PurchaseOrder/LineItems/LineItem'))) l
    4 where existsNode(value(l),'/LineItem[Part/@Id="717951002372"]') = 1
    5 /
    COUNT(*)
    33
    1 row selected.
    Elapsed: 00:00:00.01
    SQL> select plan_table_output from table(dbms_xplan.display('plan_table',null,'serial'))
    2 /
    PLAN_TABLE_OUTPUT
    Plan hash value: 3049344732
    | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
    | 0 | SELECT STATEMENT | | 1 | 69 | 17 (6)| 00:00:01 |
    | 1 | SORT AGGREGATE | | 1 | 69 | | |
    | 2 | NESTED LOOPS | | 25 | 1725 | 17 (6)| 00:00:01 |
    | 3 | SORT UNIQUE | | 25 | 750 | 3 (0)| 00:00:01 |
    |* 4 | INDEX RANGE SCAN | IPARTNUMBERINDEX | 25 | 750 | 3 (0)| 00:00:01 |
    |* 5 | TABLE ACCESS BY INDEX ROWID| PURCHASEORDER | 1 | 39 | 1 (0)| 00:00:01 |
    |* 6 | INDEX UNIQUE SCAN | LINEITEM_LIST | 1 | | 0 (0)| 00:00:01 |
    Predicate Information (identified by operation id):
    4 - access("SYS_NC00011$"='717951002372')
    5 - filter(SYS_CHECKACL("ACLOID","OWNERID",xmltype(''<privilege
    xmlns="http://xmlns.oracle.com/xdb/acl.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-in
    stance" xsi:schemaLocation="http://xmlns.oracle.com/xdb/acl.xsd
    http://xmlns.oracle.com/xdb/acl.xsd DAV:http://xmlns.oracle.com/xdb/dav.xsd"><read-propert
    ies/><read-contents/></privilege>''))=1)
    6 - access("NESTED_TABLE_ID"="PURCHASEORDER"."SYS_NC0003400035$")
    24 rows selected.
    Elapsed: 00:00:00.03
    SQL> explain plan for
    2 select extractValue(object_value,'/PurchaseOrder/Reference')
    3 from purchaseorder,
    4 table (xmlsequence(extract(object_value,'/PurchaseOrder/LineItems/LineItem'))) l
    5 where existsNode(value(l),'/LineItem[Part/@Id="717951002372"]') = 1
    6 /
    Explained.
    Elapsed: 00:00:00.06
    SQL> select plan_table_output from table(dbms_xplan.display('plan_table',null,'serial'))
    2 /
    PLAN_TABLE_OUTPUT
    Plan hash value: 1516269755
    | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
    | 0 | SELECT STATEMENT | | 25 | 2450 | 28 (0)| 00:00:01 |
    | 1 | NESTED LOOPS | | 25 | 2450 | 28 (0)| 00:00:01 |
    |* 2 | INDEX RANGE SCAN | IPARTNUMBERINDEX | 25 | 750 | 3 (0)| 00:00:01 |
    |* 3 | TABLE ACCESS BY INDEX ROWID| PURCHASEORDER | 1 | 68 | 1 (0)| 00:00:01 |
    |* 4 | INDEX UNIQUE SCAN | LINEITEM_LIST | 1 | | 0 (0)| 00:00:01 |
    Predicate Information (identified by operation id):
    2 - access("SYS_NC00011$"='717951002372')
    3 - filter(SYS_CHECKACL("ACLOID","OWNERID",xmltype(''<privilege
    xmlns="http://xmlns.oracle.com/xdb/acl.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-i
    nstance" xsi:schemaLocation="http://xmlns.oracle.com/xdb/acl.xsd
    http://xmlns.oracle.com/xdb/acl.xsd DAV:http://xmlns.oracle.com/xdb/dav.xsd"><read-proper
    ties/><read-contents/></privilege>''))=1)
    4 - access("NESTED_TABLE_ID"="PURCHASEORDER"."SYS_NC0003400035$")
    22 rows selected.
    Elapsed: 00:00:00.04
    SQL> select extractValue(object_value,'/PurchaseOrder/Reference')
    2 from purchaseorder,
    3 table (xmlsequence(extract(object_value,'/PurchaseOrder/LineItems/LineItem'))) l
    4 where existsNode(value(l),'/LineItem[Part/@Id="717951002372"]') = 1
    5 /
    EXTRACTVALUE(OBJECT_VALUE,'/PU
    MWEISS-20030616154327385GMT
    NSARCHAN-20030703170041824GMT
    HBAER-20030206173836987GMT
    LOZER-20031110131149107GMT
    WTAYLOR-20030120174534374GMT
    MHARTSTE-20031103172937613GMT
    KGEE-20030919215826550GMT
    PSULLY-20030712141634504GMT
    JPATEL-20030630175356693GMT
    RMATOS-2003072920455000GMT
    DRAPHEAL-20030528180033254GMT
    JRUSSEL-20031121213026539GMT
    PTUCKER-20030918160532301GMT
    SVOLLMAN-20031027120838903GMT
    WGIETZ-20030208185026303GMT
    TFOX-20030110164614994GMT
    JPATEL-20030304214301386GMT
    GGEONI-20030606135257846GMT
    STOBIAS-20030817120358785GMT
    COLSEN-20030525200717658GMT
    SBAIDA-20030224182546606GMT
    IMIKKILI-20030118180347537GMT
    ABULL-20030429162730766GMT
    NSARCHAN-20031113183134873GMT
    LBISSOT-20030809134114505GMT
    JKING-20030420162058859GMT
    JMALLIN-20030506152048261GMT
    AFRIPP-20030311153808601GMT
    SHIGGINS-20030831151756257GMT
    DBERNSTE-20030626122725631GMT
    KPARTNER-20031021160248962GMT
    ABANDA-2003062721524842GMT
    DOCONNEL-20030904214708637GMT
    33 rows selected.
    Elapsed: 00:00:00.01
    SQL> explain plan for
    2 select extractValue(object_value,'/PurchaseOrder/Reference')
    3 from purchaseorder
    4 where existsNode
    5 (
    6 object_value,
    7 '/PurchaseOrder/LineItems/LineItem/Part[@Id="717951002372"]'
    8 ) = 1
    9 /
    Explained.
    Elapsed: 00:00:00.03
    SQL> select plan_table_output from table(dbms_xplan.display('plan_table',null,'serial'))
    2 /
    PLAN_TABLE_OUTPUT
    Plan hash value: 1197255270
    | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
    | 0 | SELECT STATEMENT | | 25 | 2450 | 17 (6)| 00:00:01 |
    | 1 | NESTED LOOPS | | 25 | 2450 | 17 (6)| 00:00:01 |
    | 2 | SORT UNIQUE | | 25 | 750 | 3 (0)| 00:00:01 |
    |* 3 | INDEX RANGE SCAN | IPARTNUMBERINDEX | 25 | 750 | 3 (0)| 00:00:01 |
    |* 4 | TABLE ACCESS BY INDEX ROWID| PURCHASEORDER | 1 | 68 | 1 (0)| 00:00:01 |
    |* 5 | INDEX UNIQUE SCAN | LINEITEM_LIST | 1 | | 0 (0)| 00:00:01 |
    Predicate Information (identified by operation id):
    3 - access("SYS_NC00011$"='717951002372')
    4 - filter(SYS_CHECKACL("ACLOID","OWNERID",xmltype(''<privilege
    xmlns="http://xmlns.oracle.com/xdb/acl.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-i
    nstance" xsi:schemaLocation="http://xmlns.oracle.com/xdb/acl.xsd
    http://xmlns.oracle.com/xdb/acl.xsd DAV:http://xmlns.oracle.com/xdb/dav.xsd"><read-proper
    ties/><read-contents/></privilege>''))=1)
    5 - access("NESTED_TABLE_ID"="PURCHASEORDER"."SYS_NC0003400035$")
    23 rows selected.
    Elapsed: 00:00:00.03
    SQL> select extractValue(object_value,'/PurchaseOrder/Reference')
    2 from purchaseorder
    3 where existsNode
    4 (
    5 object_value,
    6 '/PurchaseOrder/LineItems/LineItem/Part[@Id="717951002372"]'
    7 ) = 1
    8 /
    EXTRACTVALUE(OBJECT_VALUE,'/PU
    MWEISS-20030616154327385GMT
    NSARCHAN-20030703170041824GMT
    HBAER-20030206173836987GMT
    LOZER-20031110131149107GMT
    WTAYLOR-20030120174534374GMT
    MHARTSTE-20031103172937613GMT
    KGEE-20030919215826550GMT
    PSULLY-20030712141634504GMT
    JPATEL-20030630175356693GMT
    RMATOS-2003072920455000GMT
    DRAPHEAL-20030528180033254GMT
    JRUSSEL-20031121213026539GMT
    PTUCKER-20030918160532301GMT
    SVOLLMAN-20031027120838903GMT
    WGIETZ-20030208185026303GMT
    TFOX-20030110164614994GMT
    JPATEL-20030304214301386GMT
    GGEONI-20030606135257846GMT
    STOBIAS-20030817120358785GMT
    COLSEN-20030525200717658GMT
    SBAIDA-20030224182546606GMT
    IMIKKILI-20030118180347537GMT
    ABULL-20030429162730766GMT
    NSARCHAN-20031113183134873GMT
    LBISSOT-20030809134114505GMT
    JKING-20030420162058859GMT
    JMALLIN-20030506152048261GMT
    AFRIPP-20030311153808601GMT
    SHIGGINS-20030831151756257GMT
    DBERNSTE-20030626122725631GMT
    KPARTNER-20031021160248962GMT
    ABANDA-2003062721524842GMT
    DOCONNEL-20030904214708637GMT
    33 rows selected.
    Elapsed: 00:00:00.03
    SQL> quit
    Disconnected from Oracle Database 10g Enterprise Edition Release 10.1.0.3.0 - Production
    With the Partitioning, OLAP and Data Mining options

  • JDBC XMLType Insert/Update Performance

    I am writing a backend Java EE application that inserts or updates XML documents into a table backed by XMLType.  I'm using Oracle 11.2.0.3 with associated drivers and XDK, with connections obtained from an oracle.jdbc.poo.OracleDataSource.  Unfortunately, I can't get my application to perform faster than 7 transactions a second, with or without JDBC batching.  I've tried several different table structures; here are the two that have shown the most promise:
    CREATE TABLE mrbook_raw
      id  RAW(16),
      created_date TIMESTAMP,
      last_modified_ts TIMESTAMP,
      bk_typ_cd VARCHAR2(16),
      bk_invt XMLType,
      PRIMARY KEY(id),
      FOREIGN KEY (id) REFERENCES mrbook(id)
    ) XMLTYPE COLUMN bk_invt ELEMENT "http://www.mrbook.com/BookData/Vers1#BK_INVT";
    --Also tried the below...
    CREATE TABLE book_master OF XMLTYPE
    XMLTYPE STORE AS SECUREFILE BINARY XML
    VIRTUAL COLUMNS
      isbn_nbr AS ( XmlCast(
                    XmlQuery('declare namespace plh="http://www.mrbook.com/BookData/Vers1/Header";
                              declare namespace bk_invt="www.mrbook.com/BookData/Vers1/InventoryData";
                              /bk_invt:BK_INVT/plh:HDR/plh:ISBN_NBR'
                              PASSING object_value RETURNING CONTENT) AS VARCHAR2(64)) ),
      book_id AS ( XmlCast(
                    XmlQuery('declare namespace plh="http://www.mrbook.com/BookData/Vers1/Header";
                              declare namespace invtdata="http://www.mrbook.com/BookData/Vers1/InventoryData";
                              /bk_invt:BK_INVT/plh:HDR/plh:BOOK_ID'
                              PASSING object_value RETURNING CONTENT) AS VARCHAR2(64)) )
    Here is the code that inserts into the first table:
        private static final String INS_MRBOOK_RAW =
                "INSERT INTO MRBOOK_RAW " +
                        "(id, bk_invt, last_modified_ts, created_date) " +
                "VALUES (?, ?, ?, ?)";
        private static final String UPD_MRBOOK_RAW =
                "UPDATE MRBOOK_RAW " +
                "SET " +
                    "bk_invt = ?, " +
                    "last_modified_ts = ? " +
                "WHERE id = ?";
    protected void updateBookRaw(BookRecord record, Connection con)
            PreparedStatement stmt = null;
            SQLXML sqlxml = null;
            Timestamp now = new Timestamp(System.currentTimeMillis());
            try
                stmt = con.prepareStatement(UPD_MRBOOK_RAW);
                sqlxml = con.createSQLXML();
                DOMResult result = sqlxml.setResult(DOMResult.class);
                result.setNode(record.getExistingInvtData());
                stmt.setSQLXML(1, sqlxml);
                stmt.setTimestamp(2, now);
                stmt.setBytes(3, record.getId());
                stmt.executeUpdate();
            catch(SQLException e)
                throw new RuntimeException(e);
            finally
                if(sqlxml != null)
                    try
                        sqlxml.free();
                    catch(SQLException e)
                        log.error("Unable to free SQLXML!", e);
                if(stmt != null)
                    try
                        stmt.close();
                    catch(SQLException e)
                        log.error("Unable to close statement!", e);
        protected void insertBookRaw(BookRecord record, Connection con)
            PreparedStatement stmt = null;
            SQLXML sqlxml = null;
            Timestamp now = new Timestamp(System.currentTimeMillis());
            XMLDocument bookDoc = parser.getInvtDataDoc(record.getNewBook());
            try
                stmt = con.prepareStatement(INS_MRBOOK_RAW);
                sqlxml = con.createSQLXML();
                DOMResult domResult = sqlxml.setResult(DOMResult.class);
                domResult.setNode(bookDoc);
                stmt.setBytes(1, record.getId());
                stmt.setSQLXML(2, sqlxml);
                stmt.setTimestamp(3, now);
                stmt.setTimestamp(4, now);
                stmt.executeUpdate();
            catch(SQLException e)
                throw new RuntimeException(e);
            finally
                if(sqlxml != null)
                    try
                        sqlxml.free();
                    catch(SQLException e)
                        log.error("Unable to free SQLXML object!", e);
                if(stmt != null)
                    try
                        stmt.close();
                    catch(SQLException e)
                        log.error("Unable to close statement!", e);
    I've tried every storage method possible; CLOBs, Binary XMLType, and structured storage, but I just cannot get the application to go faster than 7 records/second.
    I understand that this may or may not be an XMLType question, but I don't know where to start.  From everything above, it looks like I should be getting good performance inserting and updating XMLType records; and I do indeed get pretty good performance from retrieval, but not from insert or update.  Does anyone have any suggestions on what I might try or a reference I might look at to start?

    Perhaps a more specific question... should I use PreparedStatements with SQLXML or should I use the OracleXMLSave class?  Are SQLXML types batchable under Oracle?

  • Sys.Xmltype.Createxml performance

    Hello all,
    I have these two functions,these functions are present in a package and this package is being called from .net code.There is a lot of performance issue with this code,It is taking 27 minutes for inserting 1000 rows,please help me fine tune this piece of code.And also there is a before insert trigger for the table XXXXXX
    since we are using the concept of VPD here
    There are close to 14000 rows to be inserted,please help.
    Database version
    Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bi
    PL/SQL Release 10.2.0.5.0 - Production
    CORE     10.2.0.5.0     Production
    TNS for Solaris: Version 10.2.0.5.0 - Production
    NLSRTL Version 10.2.0.5.0 - Production
    Procedure Some_Information(in_Some_Details In Clob, in_Batch_Id In Varchar2, in_Modified_User_Uid In Varchar2, in_Modified_Date In Varchar2, out_Status Out Varchar2, out_Error Out Varchar2)
    As
    Begin
    Xml_Type:=Sys.Xmltype.Createxml(in_Some_Details);
    Insert Into XXXXXX(I_Batch_Id,I_Client_Account_Id,V_Client_Legal_Name,
    V_Old_Office_Code, V_Old_Office_Business_Name,V_New_Office_Code,V_New_Office_Business_Name,
    V_Old_Cost_Center_Code,V_Old_Cost_Center_Name,V_New_Cost_Center_Code, V_New_Cost_Center_Name,
    V_Client_Status,D_Client_Inactivation_Date,V_Select_Ynflag,
    V_Replace_Ynflag,V_Replace_All_Policy_Ynflag,V_Replace_All_Service_Ynflag,
    I_Created_By_Uid,I_Modified_By_Uid,
    D_Created_Timestamp,D_Modified_Timestamp,
    V_Batch_Status,D_Pol_Eff_Date_From,D_Pol_Eff_Date_To
    (Select in_Batch_Id, A.CLIENT_ACCOUNT_ID, A.CLIENT_LEGAL_NAME, A.OLD_OFFICE_CODE, A.OLD_OFFICE_BUSINESS_NAME,
    A.NEW_OFFICE_CODE, A.NEW_OFFICE_BUSINESS_NAME, A.OLD_COST_CENTER_CODE, A.OLD_COST_CENTER_NAME,
    A.NEW_COST_CENTER_CODE, A.NEW_COST_CENTER_NAME, A.CLIENT_STATUS,
    CASE
    WHEN A.CLIENT_INACTIVATION_DATE =' ' THEN NULL
    ELSE To_Date(A.CLIENT_INACTIVATION_DATE,'DD/MM/YYYY')
    END ,
    A.SELECT_FLAG, A.REPLACE_FLAG, A.REPLACE_ALL_POLICY_FLAG, A.REPLACE_ALL_SERVICE_FLAG,
    in_Modified_User_Uid,in_Modified_User_Uid,
    To_Date(in_Modified_Date,'yyyyMMddhh24miss'),To_Date(in_Modified_Date,'yyyyMMddhh24miss'),'A',
    CASE
    WHEN A.POL_EFF_DATE_FROM =' ' THEN NULL
    ELSE To_Date(A.POL_EFF_DATE_FROM,'DD/MM/YYYY')
    END ,
    CASE
    WHEN A.POL_EFF_DATE_TO =' ' THEN NULL
    ELSE To_Date(A.POL_EFF_DATE_TO,'DD/MM/YYYY')
    END
    From (
    SELECT
    (CLIDETAIL.EXTRACT('//InformationSet/I_CLIENT_ACCOUNT_ID/text()').getstringval()) as CLIENT_ACCOUNT_ID,
    Escape_Chars(CLIDETAIL.EXTRACT('//InformationSet/V_CLIENT_LEGAL_NAME/text()').getstringval()) as CLIENT_LEGAL_NAME,
    (CLIDETAIL.EXTRACT('//InformationSet/V_OLD_OFFICE_CODE/text()').getstringval()) as OLD_OFFICE_CODE,
    Escape_Chars(CLIDETAIL.EXTRACT('//InformationSet/V_OLD_OFFICE_NAME/text()').getstringval()) as OLD_OFFICE_BUSINESS_NAME,
    (CLIDETAIL.EXTRACT('//InformationSet/V_NEW_OFFICE_CODE/text()').getstringval()) as NEW_OFFICE_CODE,
    Escape_Chars(CLIDETAIL.EXTRACT('//InformationSet/V_NEW_OFFICE_NAME/text()').getstringval()) as NEW_OFFICE_BUSINESS_NAME,
    (CLIDETAIL.EXTRACT('//InformationSet/V_OLD_COSTCENTER_CODE/text()').getstringval()) as OLD_COST_CENTER_CODE,
    Escape_Chars(CLIDETAIL.EXTRACT('//InformationSet/V_OLD_COSTCENTER_NAME/text()').getstringval()) as OLD_COST_CENTER_NAME,
    (CLIDETAIL.EXTRACT('//InformationSet/V_NEW_COSTCENTER_CODE/text()').getstringval()) as NEW_COST_CENTER_CODE,
    Escape_Chars(CLIDETAIL.EXTRACT('//InformationSet/V_NEW_COSTCENTER_NAME/text()').getstringval()) as NEW_COST_CENTER_NAME,
    Escape_Chars(CLIDETAIL.EXTRACT('//InformationSet/V_CLIENT_STATUS/text()').getstringval()) as CLIENT_STATUS,
    (CLIDETAIL.EXTRACT('//InformationSet/V_CLIENT_INACTIVATION_DATE/text()').getstringval()) as CLIENT_INACTIVATION_DATE,
    Escape_Chars(CLIDETAIL.EXTRACT('//InformationSet/V_SELECT_FLAG/text()').getstringval()) as SELECT_FLAG,
    Escape_Chars(CLIDETAIL.EXTRACT('//InformationSet/V_REPLACE_FLAG/text()').getstringval()) as REPLACE_FLAG,
    Escape_Chars(CLIDETAIL.EXTRACT('//InformationSet/V_REPLACE_ALL_POLICY_FLAG/text()').getstringval()) as REPLACE_ALL_POLICY_FLAG,
    Escape_Chars(CLIDETAIL.EXTRACT('//InformationSet/V_REPLACE_ALL_SERVICE_FLAG/text()').getstringval()) as REPLACE_ALL_SERVICE_FLAG,
    (CLIDETAIL.EXTRACT('//InformationSet/V_POL_EFF_DATE_FROM/text()').getstringval()) as POL_EFF_DATE_FROM,
    (CLIDETAIL.EXTRACT('//InformationSet/V_POL_EFF_DATE_TO/text()').getstringval()) as POL_EFF_DATE_TO
    FROM TABLE(XMLSEQUENCE(Xml_Type.EXTRACT('//NewDataSet/InformationSet')))CLIDETAIL
    ) A
    Where Not Exists (Select 1 From XXXXX1 M Where M.I_Batch_Id=in_Batch_Id And M.I_Client_Account_Id=A.Client_Account_Id)
    out_Status:='0';
    out_Error:='No Error 2';
    dbms_output.put_line(out_Status);
    EXCEPTION WHEN OTHERS THEN
    out_Status:='100';
    out_Error:= SQLERRM;
    End;
    Function Escape_Chars(in_Details Varchar2) Return Varchar2 Is
    Begin
    If Replace(Replace(Replace(Replace(Replace(Trim(in_Details),
    ''||'&'||' amp;',''||'&'||''),
    ''||'&'||' quot;','"'),
    ''||'&'||' lt;','<'),
    ''||'&'||' gt;','>'),
    ''||'&'||' apos;',''''
    ) = '' Then
    Return Null;
    Else
    Return Replace(Replace(Replace(Replace(Replace(Trim(in_Details),
    ''||'&'||'amp;',''||'&'||''),
    ''||'&'||'quot;','"'),
    ''||'&'||'lt;','<'),
    ''||'&'||'gt;','>'),
    ''||'&'||'apos;',''''
    End If;
    End;

    Hello Marco,
    I am a novice in Oracle with xml,please help me out with the following question listed in the points below
    1) re-write the whole
    From (
    SELECT (CLIDETAIL.EXTRACT('//InformationSet/I_CLIENT_ACCOUNT_ID/text()').getstringval()) as CLIENT_ACCOUNT_ID,
    Escape
    bit to 1 XMLTABLE statement, if not only you will be easily see issues and/or get rid of all the clutter via "extract"
    Point 1 I am exploring it,since I do not know anything about XMLTABLE.
    2) Use the full XPath path in this statement - do not use // everywhere in the statement (this alone will be drastically improve your performance).
    I have made the change mentioned in point 2 except for this section in the previous post,please let me know if i have to make the change here also,
    FROM TABLE(XMLSEQUENCE(Xml_Type.EXTRACT('//NewDataSet/InformationSet')))
    My Xml will be of the format
    <NewDataSet>
    <InformationSet>
    <I_CLIENT_ACCOUNT_ID>Some value</I_CLIENT_ACCOUNT_ID>
    </NewDataSet>
    </InformationSet>
    3) Do not use the OO notation. eg. "user.table.xmltype.extract.operator" but the supported notation, eg. "extract(user.table.xmltype, '$XPath', '$namspce').operator"
    Point 3 I have made the changes
    4) Do not use XML/SQL operators anymore, they will be deprecated/desupported in future versions (11, 12, xx). Use the offcial W3 XML standards, in the case XQuery alternatives like XMLTABLE. If not only they do already support XPath V2 while the XML/SQL stuff only supports XPath V1.
    Point 4 can you please elaborate on XML/SQL operators that I am using in my code,so sorry this is dumb but still.
    5) escape handling can also be done by a by Oracle supported function in package DBMS_XMLGEN (convert? and other procedures/functions), why write your own (would something like a regular expression comparison etc not be easier instead of replace(replace(replace...)
    Thank you very much,I have handled the point 5 by using the DBMS_XMLGEN.convert

  • The simplest way to get more performance on select on xmltype column?

    We have a table with xmltype column:
    CREATE TABLE "TK"."PLAN_2" ("UNID" NUMBER NOT
    NULL,
    "XMLSTRING" "TK"."XMLTYPE",
    CONSTRAINT "SYS_C001142583" PRIMARY KEY("UNID")
    USING INDEX
    TABLESPACE "TX"
    STORAGE ( INITIAL 64K NEXT 0K MINEXTENTS 1 MAXEXTENTS
    2147483645 PCTINCREASE 0) PCTFREE 10 INITRANS 2 MAXTRANS 255)
    The data in column xmlstring looks like this:
    <Agent>
    <OP End="2520000" Id="001_8232_0_91" Origin="Autos" Quantity="1.0 ea" Start="2520000">
    <OSP Key="ADM_ID" String="001_8232_0" />
    <OSP Key="AddAutoNr" String="0" />
    <OSP Key="CURRENT_STATE" String="Tages-Vorgabe" />
    <OLP Key="ChUser">
    <OIP Key="(T_SP) test2" Long="1218125408541" />
    <OIP Key="(T_SP) admin" Long="1219071385346" />
    <OIP Key="(T_SP) test2" Long="1237540381906" />
    </OLP>
    <OSP Key="Debicode" String="9903" />
    <OSP Key="Resource" String="SBN" />
    <OSP Key="TrafficDay" String="91" />
    <OSP Key="AutoNrSchema" String="001" />
    <OSP Key="AutoNumber" String="8232" />
    <OPE End="0" Id="Prod" Origin="Autos|Prod" Start="0">
    <OProd Duration="0" End="0" Id="Produce" OriginDirect="Autos|Prod|Produce" Quantity="1.0 ea" Start="0" Type="Produce">
    <OSP Key="RESelection.Parameter" String="Resource" />
    <Resource Id="Autos" />
    <Alloc From="OP|001_8232_0_91|Prod|Produce" Id="" Quantity="1.0 ea" To="CO|001_8232_0_91|001_8232_0_91" Type="PRODUCEREQ_TO_CONSUMEREQ" />
    </OProd>
    </OPE>
    <OPE End="2520000" Id="Step_0" Origin="Autos|Step" Start="0">
    <OQP Key="Delay" Overridden="true" Quantity="0.0 s" />
    <OQP Key="Distance" Quantity="44.84 km" />
    <OQP Key="Duration" Quantity="2520.0 s" />
    <OQP Key="Fahrt" Quantity="2520.0 s" />
    <OSP Key="From" String="BS" />
    <OSP Key="I1" String="0" />
    <OSP Key="PLACE" String="1" />
    <OQP Key="StartDelay" Overridden="true" Quantity="0.0 s" />
    <OQP Key="TWait" Overridden="true" Quantity="0.0 s" />
    <OSP Key="To" String="OL" />
    <OUse Duration="2520000" End="2520000" Id="LStep_0" Name="L" OriginDirect="Autos|Step|LStep" Quantity="1.0 ea" Start="0" Type="Step">
    <OSP Key="I2" String="0" />
    <OIP Key="LPOSITION" Long="1" Overridden="true" />
    <OSP Key="PLACE" String="1" />
    <OQP Key="Wait" Overridden="true" Quantity="0.0 s" />
    <Resource Id="vs_RABe525_13" />
    </OUse>
    <OUse Duration="480000" End="0" Id="LPre_0" Name="L" OriginDirect="Autos|Step|LPre" Quantity="1.0 ea" Start="-480000" Type="Pre">
    <OQP Key="Fahrbereit" Overridden="true" Quantity="2 min" />
    <OSP Key="From" Overridden="true" String="BS" />
    <OSP Key="I2" String="0" />
    <OSP Key="PLACE" String="1" />
    <OSP Key="StepIndex" String="0" />
    <OSP Key="To" Overridden="true" String="BS" />
    <OQP Key="Vorbereitung" Overridden="true" Quantity="6 min" />
    <Resource Id="vs_RABe525_13" />
    </OUse>
    <OUse Duration="600000" End="3120000" Id="LPost_0" Name="L" OriginDirect="Autos|Step|LPost" Quantity="1.0 ea" Start="2520000" Type="Post">
    <OQP Key="Abstellzeit" Overridden="true" Quantity="4 min" />
    <OSP Key="From" Overridden="true" String="OL" />
    <OSP Key="I2" String="0" />
    <OQP Key="Nachbereitung" Overridden="true" Quantity="6 min" />
    <OSP Key="PLACE" String="1" />
    <OSP Key="StepIndex" String="0" />
    <OSP Key="To" Overridden="true" String="OL" />
    <Resource Id="vs_RABe525_13" />
    </OUse>
    <OUse Duration="2520000" End="2520000" Id="FStep_0" Name="F" OriginDirect="Autos|Step|FStep" Quantity="1.0 ea" Start="0" Type="Step">
    <OSP Key="I2" String="0" />
    <OSP Key="PLACE" String="1" />
    <OQP Key="Wait" Overridden="true" Quantity="0.0 s" />
    <Resource Id="ps_P112" />
    </OUse>
    <OUse Duration="480000" End="0" Id="FPre_0" Name="F" OriginDirect="Autos|Step|FPre" Quantity="1.0 ea" Start="-480000" Type="Pre">
    <OQP Key="Fahrbereit" Overridden="true" Quantity="2 min" />
    <OSP Key="From" Overridden="true" String="BS" />
    <OSP Key="I2" String="0" />
    <OSP Key="PLACE" String="1" />
    <OSP Key="StepIndex" String="0" />
    <OQP Key="Taxi" Overridden="true" Quantity="0 s" />
    <OSP Key="To" Overridden="true" String="BS" />
    <OQP Key="Vorbereitung" O verridden="true" Quantity="6 min" />
    <OQP Key="Wegzeit" Overridden="true" Quantity="0 s" />
    <Resource Id="ps_P112" />
    </OUse>
    <OUse Duration="600000" End="3120000" Id="FPost_0" Name="F" OriginDirect="Autos|Step|FPost" Quantity="1.0 ea" Start="2520000" Type="Post">
    <OQP Key="Abstellzeit" Overridden="true" Quantity="4 min" />
    <OSP Key="From" Overridden="true" String="OL" />
    <OSP Key="I2" String="0" />
    <OQP Key="Nachbereitung" Overridden="true" Quantity="6 min" />
    <OSP Key="PLACE" String="1" />
    <OSP Key="StepIndex" String="0" />
    <OQP Key="Taxi" Overridden="true" Quantity="0 s" />
    <OSP Key="To" Overridden="true" String="OL" />
    <OQP Key="Wegzeit" Overridden="true" Quantity="0 s" />
    <Resource Id="ps_P112" />
    </OUse>
    </OPE>
    </OP>
    </Agent>
    We try to select:
    SELECT UNID, extractValue(value(OUSE_XMLSTRING), '/OUse/Resource/@Id') OUSE_RESOURCE,
    extract(XMLSTRING, '/Agent/OP/OSP[@Key = "TrafficDay"]/@String') TT_DAY,
    extract(XMLSTRING, '/Agent/OP/@Start') OP_START,
    extract(XMLSTRING, '/Agent/OP/@End') OP_END,
    extract(XMLSTRING, '/Agent/OP/OSP[@Key = "ADM_ID"]/@String') ADM_ID,
    extractValue(value(OUSE_XMLSTRING), '/OUse/@Start') OUSE_START,
    extractValue(value(OUSE_XMLSTRING), '/OUse/@End') OUSE_END
    FROM tk.plan_2, table(XMLSequence(extract(XMLSTRING, '//Agent/OP//OPE//OUse'))) OUSE_XMLSTRING
    where extractValue(value(OUSE_XMLSTRING), '/OUse/Resource/@Id') = 'vs_RABe525_13';
    with this explain plan:
    PLAN_TABLE_OUTPUT
    Plan hash value: 3476314316
    | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
    | 0 | SELECT STATEMENT | | 101 | 22018 | 31 (0)| 00:00:01 |
    | 1 | NESTED LOOPS | | 101 | 22018 | 31 (0)| 00:00:01 |
    | 2 | TABLE ACCESS FULL | PLAN_2 | 2 | 432 | 2 (0)| 00:00:01 |
    |* 3 | COLLECTION ITERATOR PICKLER FETCH| XMLSEQUENCEFROMXMLTYPE | | | | |
    Predicate Information (identified by operation id):
    3 - filter(EXTRACTVALUE(VALUE(KOKBF$),'/OUse/Resource/@Id')='vs_RABe525_13')
    We want to select on the 'ID', which occurs more than once in the xmlstring and the table gonna be big, so we think we need some kind of index on the ID-Identifier. What will be the best way to do this?

    Which version of Oracle (4 digits)?
    If 10.2 or greater, look into using XMLTable and that is the replacement for the table(XMLSequence(extract()) approach. Also, avoid the use of // unless you really need it. I doubt it will make a difference in your situation but just a good performance approach in general.
    We want to select on the 'ID', which occurs more than once in the xmlstringI assume you are going to want the count(...) > 1 from the XML to tell you which you are selecting?
    I also have questions about what that XMLType is being stored as but that depends upon what your version is regarding what storage options you have.
    Edited by: A_Non on Jun 7, 2010 10:55 AM
    Forgot to add, look in the FAQ (under your sign-in name on the upper right) for how to use the tag to better format your posts.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Is this query on XMLTYPE the most performant ?

    Hello,
    We are in 11gR2
    and we built a process for loading XML files that I think are very complex (I hope so)
    We about about 600 similar XML files to load every night.
    The XML file is saved under a XMLTYPE table and we attached a XSD Schema on it.
    One of the queries we built for selecting XMLTYPE data uses several outer joins on the XML. And I think I should find a way for increasing performance on the query
    Here is the details (sometimes huge in volume) :
    1) The query I would like to improve :
    Depending on data in the XML file, the SELECT duration can go from 3 minutes to more than 4 hours !
      select DISTINCT UPPER(t2.ressource_code)
      , CASE WHEN ( t5.isWorkDay = 'false' AND t5.day IS NOT NULL
                    AND ( to_date( replace(t5.day, 'T', ' '), 'YYYY-MM-DD HH24:MI:SS')
                          BETWEEN to_date( replace(t4.taux_start_date, 'T', ' '), 'YYYY-MM-DD HH24:MI:SS')
                              AND to_date( replace(t4.taux_end_date, 'T', ' '), 'YYYY-MM-DD HH24:MI:SS'))
             THEN to_date( replace(t5.day, 'T', ' '), 'YYYY-MM-DD HH24:MI:SS')
             ELSE to_date( replace(t4.taux_start_date, 'T', ' '), 'YYYY-MM-DD HH24:MI:SS') END day_start
      , CASE WHEN ( t5.isWorkDay = 'false' AND t5.day IS NOT NULL
                    AND ( to_date( replace(t5.day, 'T', ' '), 'YYYY-MM-DD HH24:MI:SS')
                          BETWEEN to_date( replace(t4.taux_start_date, 'T', ' '), 'YYYY-MM-DD HH24:MI:SS')
                              AND to_date( replace(t4.taux_end_date, 'T', ' '), 'YYYY-MM-DD HH24:MI:SS'))
             THEN to_date( replace(t5.day, 'T', ' '), 'YYYY-MM-DD HH24:MI:SS')+1
             ELSE to_date( replace(t4.taux_end_date, 'T', ' '), 'YYYY-MM-DD HH24:MI:SS') END day_finish
      , DECODE( t5.isWorkDay, NULL, CASE WHEN (to_number( t4.rate)>0) THEN 'true' ELSE 'false' END, t5.isWorkDay)  isWorkDay
      , DECODE( t5.isWorkDay, NULL, TO_CHAR( to_date( replace(t4.taux_start_date, 'T', ' '), 'YYYY-MM-DD HH24:MI:SS'), 'HH24:MI:SS'), t6.shift_start) shift_start
      , DECODE( t5.isWorkDay, NULL, TO_CHAR( to_date( replace(t4.taux_end_date, 'T', ' '), 'YYYY-MM-DD HH24:MI:SS'), 'HH24:MI:SS'), t6.shift_finish) shift_finish
      , DECODE( UPPER(t5.dayOfWeek), 'MON', 'LUNDI', 'TUE', 'MARDI', 'WED', 'MERCREDI', 'THU', 'JEUDI', 'FRI', 'VENDREDI', 'SAT', 'SAMEDI', 'SUN', 'DIMANCHE', NULL, NULL) dayOfWeek
      , SYSDATE
      , t1.tache_uid, t1.tache_code, t1.tache_desc
      , t3.curve_name
      , to_number( t4.rate) activity
      FROM WORKBENCH_PROJECT_TABLE t
      , xmltable( xmlNamespaces( default 'http://www.oracle.com/xsd/projet.xsd')
      , '/WORKBENCH_PROJECT/Projects/Project/Tasks/Task' passing OBJECT_VALUE
      columns tache_UID          varchar2(70) path '@UID'
      , tache_code         varchar2(150) path '@taskID'
      , tache_desc         varchar2(150) path '@name'
      , activites_xml      xmltype      path 'Assignments'
      ) t1
      , xmltable( xmlNamespaces( default 'http://www.oracle.com/xsd/projet.xsd')
      , '/Assignments/*' passing t1.activites_xml
      columns ressource_code     varchar2(50) path '@resourceID'
      , curves_xml         xmltype      path 'Curve'
      ) t2
      , xmltable( xmlNamespaces( default 'http://www.oracle.com/xsd/projet.xsd')
      , '/Curve' passing t2.curves_xml
      columns curve_name         varchar2(50) path '@name'
      , segments_xml       xmltype      path 'Segments'
      ) t3
      , xmltable( xmlNamespaces( default 'http://www.oracle.com/xsd/projet.xsd')
      , '/Segments/*' passing t3.segments_xml
        columns rate               varchar2(50) path '@rate'
      , taux_start_date         varchar2(20) path '@start'
      , taux_end_date           varchar2(20) path '@finish'
      , calendar_days_xml       xmltype      path 'Calendar/Days'
      ) t4
      , xmltable( xmlNamespaces( default 'http://www.oracle.com/xsd/projet.xsd')
      , '/Days/*' passing t4.calendar_days_xml
        columns dayOfWeek       varchar2(50) path '@dayOfWeek'
      , isWorkDay               varchar2(20) path '@isWorkDay'
      , DAY                     varchar2(20) path '@start'
      , shift_xml               xmltype      path 'Shifts'
      ) (+) t5
      , xmltable( xmlNamespaces( default 'http://www.oracle.com/xsd/projet.xsd')
      , 'Shifts/Shift'        passing t5.shift_xml
         columns shift_start  varchar2(20) path '@start'
               , shift_finish varchar2(20) path '@finish'
      ) (+) t6; Here is the XSD schema :
    <?xml version="1.0" encoding="UTF-8"?>
    <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
             xmlns:xdb="http://xmlns.oracle.com/xdb"
             xmlns="http://www.oracle.com/xsd/projet.xsd"
             targetNamespace="http://www.oracle.com/xsd/projet.xsd"
             elementFormDefault="unqualified"
             xdb:storeVarrayAsTable="true">
      <xsd:element name="WORKBENCH_PROJECT" xdb:defaultTable="WORKBENCH_PROJECT_TABLE">
        <xsd:complexType xdb:maintainDOM="false">
          <xsd:sequence>
            <xsd:element ref="BaseCalendars"/>
            <xsd:element ref="PoolResources"/>
            <xsd:element ref="Projects"/>
          </xsd:sequence>
        </xsd:complexType>
      </xsd:element>
      <xsd:element name="BaseCalendars" xdb:defaultTable="">
        <xsd:complexType xdb:maintainDOM="false">
          <xsd:sequence>
            <xsd:element ref="Calendar" maxOccurs="unbounded"/>
          </xsd:sequence>
        </xsd:complexType>
      </xsd:element>
      <xsd:element name="PoolResources" xdb:defaultTable="">
        <xsd:complexType xdb:maintainDOM="false">
          <xsd:sequence>
            <xsd:element ref="PoolResource" maxOccurs="unbounded"/>
          </xsd:sequence>
        </xsd:complexType>
      </xsd:element>
      <xsd:element name="PoolResource" xdb:defaultTable="">
        <xsd:complexType xdb:maintainDOM="false">
          <xsd:sequence>
            <xsd:element ref="Calendar"/>
            <xsd:element ref="Curve"/>
            <xsd:element ref="Notes" minOccurs="0"/>
          </xsd:sequence>
          <xsd:attribute name="category" type="xsd:string"/>
          <xsd:attribute name="emailAddress" type="xsd:string"/>
          <xsd:attribute name="employmentType" type="xsd:integer"/>
          <xsd:attribute name="description" type="xsd:string"/>
          <xsd:attribute name="firstName" type="xsd:string"/>
          <xsd:attribute name="fullName" type="xsd:string"/>
          <xsd:attribute name="hireDate" type="xsd:NMTOKEN"/>
          <xsd:attribute name="inputTypeCode" type="xsd:integer"/>
          <xsd:attribute name="isActive" type="xsd:boolean"/>
          <xsd:attribute name="isExternal" type="xsd:boolean"/>
          <xsd:attribute name="isRole" type="xsd:boolean"/>
          <xsd:attribute name="lastName" type="xsd:string"/>
          <xsd:attribute name="managerUserName" type="xsd:string"/>
          <xsd:attribute name="modBy" type="xsd:string"/>
          <xsd:attribute name="openForTimeEntry" type="xsd:boolean"/>
          <xsd:attribute name="resourceId" type="xsd:string"/>
          <xsd:attribute name="resourceType" type="xsd:integer"/>
          <xsd:attribute name="roleID" type="xsd:string"/>
          <xsd:attribute name="terminationDate" type="xsd:NMTOKEN"/>
          <xsd:attribute name="trackMode" type="xsd:integer"/>
          <xsd:attribute name="userFlag1" type="xsd:boolean"/>
          <xsd:attribute name="userFlag2" type="xsd:boolean"/>
          <xsd:attribute name="userNumber1" type="xsd:decimal"/>
          <xsd:attribute name="userNumber2" type="xsd:decimal"/>
          <xsd:attribute name="userText1" type="xsd:string"/>
          <xsd:attribute name="userText2" type="xsd:string"/>
          <xsd:attribute name="userText3" type="xsd:string"/>
          <xsd:attribute name="userText4" type="xsd:string"/>
          <xsd:attribute name="userText5" type="xsd:string"/>
          <xsd:attribute name="userText6" type="xsd:string"/>
          <xsd:attribute name="userText7" type="xsd:string"/>
          <xsd:attribute name="userText8" type="xsd:string"/>
        </xsd:complexType>
      </xsd:element>
      <xsd:element name="Projects" xdb:defaultTable="">
        <xsd:complexType xdb:maintainDOM="false">
          <xsd:sequence>
            <xsd:element ref="Project" maxOccurs="unbounded"/>
          </xsd:sequence>
        </xsd:complexType>
      </xsd:element>
      <xsd:element name="Project" xdb:defaultTable="">
        <xsd:complexType xdb:maintainDOM="false">
          <xsd:sequence>
            <xsd:element ref="Baselines" minOccurs="0"/>
            <xsd:element ref="Notes" minOccurs="0"/>
            <xsd:element ref="Resources" minOccurs="0"/>
            <xsd:element ref="Tasks" minOccurs="0"/>
            <xsd:element ref="BaselineDetails" minOccurs="0"/>
            <xsd:element ref="Dependencies" minOccurs="0"/>
          </xsd:sequence>
          <xsd:attribute name="UID"/>
          <xsd:attribute name="active" type="xsd:boolean"/>
          <xsd:attribute name="asOf" type="xsd:NMTOKEN"/>
          <xsd:attribute name="approved" type="xsd:boolean"/>
          <xsd:attribute name="baseFinish" type="xsd:NMTOKEN"/>
          <xsd:attribute name="baseStart" type="xsd:NMTOKEN"/>
          <xsd:attribute name="baseTime" type="xsd:NMTOKEN"/>
          <xsd:attribute name="budget" type="xsd:double"/>
          <xsd:attribute name="closed" type="xsd:boolean"/>
          <xsd:attribute name="cpmType" type="xsd:integer"/>
          <xsd:attribute name="department" type="xsd:string"/>
          <xsd:attribute name="description" type="xsd:string"/>
          <xsd:attribute name="finish" type="xsd:NMTOKEN"/>
          <xsd:attribute name="finishImposed" type="xsd:boolean"/>
          <xsd:attribute name="format" type="xsd:integer"/>
          <xsd:attribute name="lastUpdatedBy" type="xsd:string"/>
          <xsd:attribute name="lastUpdatedDate" type="xsd:NMTOKEN"/>
          <xsd:attribute name="name" type="xsd:string"/>
          <xsd:attribute name="openForTimeEntry" type="xsd:boolean"/>
          <xsd:attribute name="priority" type="xsd:integer"/>
          <xsd:attribute name="projectType" type="xsd:integer"/>
          <xsd:attribute name="program" type="xsd:boolean"/>
          <xsd:attribute name="projectID" type="xsd:string"/>
          <xsd:attribute name="start" type="xsd:NMTOKEN"/>
          <xsd:attribute name="startImposed" type="xsd:boolean"/>
          <xsd:attribute name="status" type="xsd:integer"/>
          <xsd:attribute name="trackMode" type="xsd:integer"/>
          <xsd:attribute name="userText1" type="xsd:string"/>
          <xsd:attribute name="userText2" type="xsd:string"/>
          <xsd:attribute name="userText3" type="xsd:string"/>
          <xsd:attribute name="userText4" type="xsd:string"/>
          <xsd:attribute name="userText5" type="xsd:string"/>
          <xsd:attribute name="userText6" type="xsd:string"/>
          <xsd:attribute name="userText7" type="xsd:string"/>
          <xsd:attribute name="userText8" type="xsd:string"/>
        </xsd:complexType>
      </xsd:element>
      <xsd:element name="Baselines" xdb:defaultTable="">
        <xsd:complexType xdb:maintainDOM="false">
          <xsd:sequence>
            <xsd:element ref="Baseline" maxOccurs="unbounded"/>
          </xsd:sequence>
        </xsd:complexType>
      </xsd:element>
      <xsd:element name="Baseline" xdb:defaultTable="">
        <xsd:complexType xdb:maintainDOM="false">
          <xsd:attribute name="code" type="xsd:string"/>
          <xsd:attribute name="current" type="xsd:boolean"/>
          <xsd:attribute name="description"/>
          <xsd:attribute name="name" type="xsd:string"/>
        </xsd:complexType>
      </xsd:element>
      <xsd:element name="Resources" xdb:defaultTable="">
        <xsd:complexType xdb:maintainDOM="false">
          <xsd:sequence>
            <xsd:element ref="Resource" maxOccurs="unbounded"/>
          </xsd:sequence>
        </xsd:complexType>
      </xsd:element>
      <xsd:element name="Resource" xdb:defaultTable="">
        <xsd:complexType xdb:maintainDOM="false">
          <xsd:sequence>
            <xsd:element ref="Curve" minOccurs="0" maxOccurs="unbounded"/>
            <xsd:element ref="BaselineDetails" minOccurs="0" maxOccurs="unbounded"/>
          </xsd:sequence>
          <xsd:attribute name="availFrom" type="xsd:NMTOKEN"/>
          <xsd:attribute name="availTo" type="xsd:NMTOKEN"/>
          <xsd:attribute name="bookingStatus" type="xsd:integer"/>
          <xsd:attribute name="lastUpdatedBy" type="xsd:string"/>
          <xsd:attribute name="lastUpdatedDate" type="xsd:NMTOKEN"/>
          <xsd:attribute name="openForTimeEntry" type="xsd:boolean"/>
          <xsd:attribute name="requestStatus" type="xsd:integer"/>
          <xsd:attribute name="resourceID" type="xsd:string"/>
          <xsd:attribute name="roleID" type="xsd:string"/>
        </xsd:complexType>
      </xsd:element>
      <xsd:element name="Tasks" xdb:defaultTable="">
        <xsd:complexType xdb:maintainDOM="false">
          <xsd:sequence>
            <xsd:element ref="Task" maxOccurs="unbounded"/>
          </xsd:sequence>
        </xsd:complexType>
      </xsd:element>
      <xsd:element name="Task" xdb:defaultTable="">
        <xsd:complexType xdb:maintainDOM="false">
          <xsd:sequence>
            <xsd:element ref="Assignments" minOccurs="0"/>
            <xsd:element ref="BaselineDetails" minOccurs="0"/>
            <xsd:element ref="Constraints" minOccurs="0"/>
            <xsd:element ref="Notes" minOccurs="0"/>
          </xsd:sequence>
          <xsd:attribute name="UID"/>
          <xsd:attribute name="taskID" type="xsd:string"/>
          <xsd:attribute name="baseFinish" type="xsd:NMTOKEN"/>
          <xsd:attribute name="baseStart" type="xsd:NMTOKEN"/>
          <xsd:attribute name="baseTime" type="xsd:NMTOKEN"/>
          <xsd:attribute name="baselineDuration" type="xsd:decimal"/>
          <xsd:attribute name="category" type="xsd:string"/>
          <xsd:attribute name="critical" type="xsd:boolean"/>
          <xsd:attribute name="earlyFinish" type="xsd:NMTOKEN"/>
          <xsd:attribute name="earlyStart" type="xsd:NMTOKEN"/>
          <xsd:attribute name="finish" type="xsd:NMTOKEN"/>
          <xsd:attribute name="fixed" type="xsd:boolean"/>
          <xsd:attribute name="guidelines" type="xsd:string"/>
          <xsd:attribute name="key" type="xsd:boolean"/>
          <xsd:attribute name="lastUpdatedBy" type="xsd:string"/>
          <xsd:attribute name="lastUpdatedDate" type="xsd:NMTOKEN"/>
          <xsd:attribute name="lateFinish" type="xsd:NMTOKEN"/>
          <xsd:attribute name="lateStart" type="xsd:NMTOKEN"/>
          <xsd:attribute name="locked" type="xsd:boolean"/>
          <xsd:attribute name="methodID" type="xsd:string"/>
          <xsd:attribute name="milestone" type="xsd:boolean"/>
          <xsd:attribute name="name" type="xsd:string"/>
          <xsd:attribute name="outlineLevel" type="xsd:integer"/>
          <xsd:attribute name="percComp" type="xsd:decimal"/>
          <xsd:attribute name="priority" type="xsd:string"/>
          <xsd:attribute name="proxy" type="xsd:boolean"/>
          <xsd:attribute name="shortName" type="xsd:string"/>
          <xsd:attribute name="start" type="xsd:NMTOKEN"/>
          <xsd:attribute name="status" type="xsd:integer"/>
          <xsd:attribute name="summary" type="xsd:boolean"/>
          <xsd:attribute name="totalSlack" type="xsd:double"/>
          <xsd:attribute name="unplanned" type="xsd:boolean"/>
          <xsd:attribute name="userText1" type="xsd:string"/>
          <xsd:attribute name="userText2" type="xsd:string"/>
          <xsd:attribute name="userText3" type="xsd:string"/>
          <xsd:attribute name="userText4" type="xsd:string"/>
          <xsd:attribute name="userText5" type="xsd:string"/>
          <xsd:attribute name="userText6" type="xsd:string"/>
          <xsd:attribute name="userText7" type="xsd:string"/>
          <xsd:attribute name="userText8" type="xsd:string"/>
        </xsd:complexType>
      </xsd:element>
      <xsd:element name="Assignments" xdb:defaultTable="">
        <xsd:complexType xdb:maintainDOM="false">
          <xsd:sequence>
            <xsd:element ref="Assignment" maxOccurs="unbounded"/>
          </xsd:sequence>
        </xsd:complexType>
      </xsd:element>
      <xsd:element name="Assignment" xdb:defaultTable="">
        <xsd:complexType xdb:maintainDOM="false">
          <xsd:sequence>
            <xsd:element ref="Curve" minOccurs="0" maxOccurs="unbounded"/>
            <xsd:element ref="BaselineDetails" minOccurs="0"/>
          </xsd:sequence>
          <xsd:attribute name="actualThrough" type="xsd:NMTOKEN"/>
          <xsd:attribute name="actualWork" type="xsd:double"/>
          <xsd:attribute name="baselineWork" type="xsd:double"/>
          <xsd:attribute name="estMax" type="xsd:double"/>
          <xsd:attribute name="estPattern" type="xsd:integer"/>
          <xsd:attribute name="finish" type="xsd:NMTOKEN"/>
          <xsd:attribute name="lastUpdatedBy" type="xsd:string"/>
          <xsd:attribute name="lastUpdatedDate" type="xsd:NMTOKEN"/>
          <xsd:attribute name="pendActSum" type="xsd:double"/>
          <xsd:attribute name="pendEstSum" type="xsd:double"/>
          <xsd:attribute name="remainingWork" type="xsd:double"/>
          <xsd:attribute name="resourceID" type="xsd:string"/>
          <xsd:attribute name="roleID" type="xsd:string"/>
          <xsd:attribute name="start" type="xsd:NMTOKEN"/>
          <xsd:attribute name="status" type="xsd:integer"/>
          <xsd:attribute name="unplanned" type="xsd:boolean"/>
        </xsd:complexType>
      </xsd:element>
      <xsd:element name="Constraints" xdb:defaultTable="">
        <xsd:complexType xdb:maintainDOM="false">
          <xsd:sequence>
            <xsd:element ref="Constraint" maxOccurs="unbounded"/>
          </xsd:sequence>
        </xsd:complexType>
      </xsd:element>
      <xsd:element name="Constraint" xdb:defaultTable="">
        <xsd:complexType xdb:maintainDOM="false">
          <xsd:attribute name="lastUpdatedBy" type="xsd:string"/>
          <xsd:attribute name="lastUpdatedDate" type="xsd:NMTOKEN"/>
          <xsd:attribute name="time" type="xsd:NMTOKEN"/>
          <xsd:attribute name="type" type="xsd:integer"/>
        </xsd:complexType>
      </xsd:element>
      <xsd:element name="Notes" xdb:defaultTable="">
        <xsd:complexType xdb:maintainDOM="false">
          <xsd:sequence>
            <xsd:element ref="Note" maxOccurs="unbounded"/>
          </xsd:sequence>
        </xsd:complexType>
      </xsd:element>
      <xsd:element name="Note" xdb:defaultTable="">
        <xsd:complexType xdb:maintainDOM="false">
          <xsd:attribute name="category" type="xsd:string"/>
          <xsd:attribute name="content" type="xsd:string"/>
          <xsd:attribute name="createdBy" type="xsd:string"/>
          <xsd:attribute name="createdDate" type="xsd:NMTOKEN"/>
          <xsd:attribute name="lastUpdatedBy" type="xsd:string"/>
          <xsd:attribute name="lastUpdatedDate" type="xsd:NMTOKEN"/>
        </xsd:complexType>
      </xsd:element>
      <xsd:element name="Dependencies" xdb:defaultTable="">
        <xsd:complexType xdb:maintainDOM="false">
          <xsd:sequence>
            <xsd:element ref="Dependency" maxOccurs="unbounded"/>
          </xsd:sequence>
        </xsd:complexType>
      </xsd:element>
      <xsd:element name="Dependency" xdb:defaultTable="">
        <xsd:complexType xdb:maintainDOM="false">
          <xsd:attribute name="lag" type="xsd:decimal"/>
          <xsd:attribute name="lagType" type="xsd:integer"/>
          <xsd:attribute name="lastUpdatedBy" type="xsd:string"/>
          <xsd:attribute name="lastUpdatedDate" type="xsd:NMTOKEN"/>
          <xsd:attribute name="predecessorID" type="xsd:string"/>
          <xsd:attribute name="predecessorUID"/>
          <xsd:attribute name="startFinishType" type="xsd:integer"/>
          <xsd:attribute name="successorID" type="xsd:string"/>
          <xsd:attribute name="successorUID"/>
        </xsd:complexType>
      </xsd:element>
      <xsd:element name="Calendar" xdb:defaultTable="">
        <xsd:complexType xdb:maintainDOM="false">
          <xsd:sequence>
            <xsd:element ref="Days" minOccurs="0"/>
          </xsd:sequence>
          <xsd:attribute name="baseCalendar"/>
          <xsd:attribute name="lastUpdatedBy" type="xsd:string"/>
          <xsd:attribute name="lastUpdatedDate" type="xsd:NMTOKEN"/>
          <xsd:attribute name="name"/>
        </xsd:complexType>
      </xsd:element>
      <xsd:element name="Days" xdb:defaultTable="">
        <xsd:complexType xdb:maintainDOM="false">
          <xsd:sequence>
            <xsd:element ref="Day" minOccurs="0" maxOccurs="unbounded"/>
          </xsd:sequence>
        </xsd:complexType>
      </xsd:element>
      <xsd:element name="Day" xdb:defaultTable="">
        <xsd:complexType xdb:maintainDOM="false">
          <xsd:sequence>
            <xsd:element ref="Shifts" minOccurs="0"/>
          </xsd:sequence>
          <xsd:attribute name="dayOfWeek" type="xsd:string"/>
          <xsd:attribute name="finish" type="xsd:NMTOKEN"/>
          <xsd:attribute name="isWorkDay" type="xsd:boolean"/>
          <xsd:attribute name="start" type="xsd:NMTOKEN"/>
        </xsd:complexType>
      </xsd:element>
      <xsd:element name="Shifts" xdb:defaultTable="">
        <xsd:complexType xdb:maintainDOM="false">
          <xsd:sequence>
            <xsd:element ref="Shift" maxOccurs="unbounded"/>
          </xsd:sequence>
        </xsd:complexType>
      </xsd:element>
      <xsd:element name="Shift" xdb:defaultTable="">
        <xsd:complexType xdb:maintainDOM="false">
          <xsd:attribute name="finish" type="xsd:NMTOKEN"/>
          <xsd:attribute name="start" type="xsd:NMTOKEN"/>
        </xsd:complexType>
      </xsd:element>
      <xsd:element name="Curve" xdb:defaultTable="">
        <xsd:complexType xdb:maintainDOM="false">
          <xsd:sequence>
            <xsd:element ref="Segments" minOccurs="0"/>
          </xsd:sequence>
          <xsd:attribute name="default" type="xsd:double"/>
          <xsd:attribute name="name" type="xsd:string"/>
          <xsd:attribute name="type" type="xsd:integer"/>
        </xsd:complexType>
      </xsd:element>
      <xsd:element name="Segments" xdb:defaultTable="">
        <xsd:complexType xdb:maintainDOM="false">
          <xsd:sequence>
            <xsd:element ref="Segment" maxOccurs="unbounded"/>
          </xsd:sequence>
        </xsd:complexType>
      </xsd:element>
      <xsd:element name="Segment" xdb:defaultTable="">
        <xsd:complexType xdb:maintainDOM="false">
          <xsd:sequence>
            <xsd:element ref="Calendar" minOccurs="0"/>
          </xsd:sequence>
          <xsd:attribute name="finish" type="xsd:NMTOKEN"/>
          <xsd:attribute name="rate" type="xsd:double"/>
          <xsd:attribute name="start" type="xsd:NMTOKEN"/>
        </xsd:complexType>
      </xsd:element>
      <xsd:element name="BaselineDetails" xdb:defaultTable="">
        <xsd:complexType xdb:maintainDOM="false">
          <xsd:sequence>
            <xsd:element ref="BaselineDetail" maxOccurs="unbounded"/>
          </xsd:sequence>
        </xsd:complexType>
      </xsd:element>
      <xsd:element name="BaselineDetail" xdb:defaultTable="">
        <xsd:complexType xdb:maintainDOM="false">
          <xsd:sequence>
            <xsd:element ref="Curve" minOccurs="0" maxOccurs="unbounded"/>
          </xsd:sequence>
          <xsd:attribute name="baselineCode" type="xsd:string"/>
          <xsd:attribute name="costSum" type="xsd:double"/>
          <xsd:attribute name="duration" type="xsd:double"/>
          <xsd:attribute name="finish" type="xsd:NMTOKEN"/>
          <xsd:attribute name="start" type="xsd:NMTOKEN"/>
          <xsd:attribute name="usageSum" type="xsd:double"/>
        </xsd:complexType>
      </xsd:element>
    </xsd:schema>3) and one of the smallest XML ... (I can send you a bigger one, where you could notice the query duration )
        "Your message exceeds the maximum length of 30000 characters."I can email you an XML file, I failed to upload the smallest XML file !!!!
    Well, I hope that's clear enough ad that you could provide me help and advices
    Thanks a lot in advance,
    Olivier

    connect / as sysdba
    set define on
    set timing on
    -- Define variables for USERNAME, TABLESPACES and XMLDIR that represents the base directory where a 'xsd' directory
    -- exists that contains the called XML schema used in this script to be registered that creates the XMLTYPE OR table
    def USERNAME = cap
    def PASSWORD = &USERNAME
    -- def XMLDIR = 'C:\Temp'
    def USER_TABSPACE = USERS
    def TEMP_TABSPACE = TEMP
    -- End declaritive section
    drop user &USERNAME cascade
    grant create any directory, drop any directory, connect, resource, create synonym, alter session, create view to &USERNAME identified by &PASSWORD
    alter user &USERNAME default tablespace &USER_TABSPACE temporary tablespace &TEMP_TABSPACE
    connect &USERNAME/&PASSWORD
    -- create or replace directory XMLDIR as '&XMLDIR/xsd'
    select * from v$version
    DECLARE
      V_XMLSCHEMA CLOB := '<?xml version="1.0" encoding="UTF-8"?>
    <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
             xmlns:xdb="http://xmlns.oracle.com/xdb"
             xmlns="http://www.oracle.com/xsd/projet.xsd"
             targetNamespace="http://www.oracle.com/xsd/projet.xsd"
             elementFormDefault="unqualified"
             xdb:storeVarrayAsTable="true">
      <xsd:element name="WORKBENCH_PROJECT" xdb:defaultTable="WORKBENCH_PROJECT_TABLE">
        <xsd:complexType xdb:maintainDOM="false">
          <xsd:sequence>
            <xsd:element ref="BaseCalendars"/>
            <xsd:element ref="PoolResources"/>
            <xsd:element ref="Projects"/>
          </xsd:sequence>
        </xsd:complexType>
      </xsd:element>
      <xsd:element name="BaseCalendars" xdb:defaultTable="">
        <xsd:complexType xdb:maintainDOM="false">
          <xsd:sequence>
            <xsd:element ref="Calendar" maxOccurs="unbounded"/>
          </xsd:sequence>
        </xsd:complexType>
      </xsd:element>
      <xsd:element name="PoolResources" xdb:defaultTable="">
        <xsd:complexType xdb:maintainDOM="false">
          <xsd:sequence>
            <xsd:element ref="PoolResource" maxOccurs="unbounded"/>
          </xsd:sequence>
        </xsd:complexType>
      </xsd:element>
      <xsd:element name="PoolResource" xdb:defaultTable="">
        <xsd:complexType xdb:maintainDOM="false">
          <xsd:sequence>
            <xsd:element ref="Calendar"/>
            <xsd:element ref="Curve"/>
            <xsd:element ref="Notes" minOccurs="0"/>
          </xsd:sequence>
          <xsd:attribute name="category" type="xsd:string"/>
          <xsd:attribute name="emailAddress" type="xsd:string"/>
          <xsd:attribute name="employmentType" type="xsd:integer"/>
          <xsd:attribute name="description" type="xsd:string"/>
          <xsd:attribute name="firstName" type="xsd:string"/>
          <xsd:attribute name="fullName" type="xsd:string"/>
          <xsd:attribute name="hireDate" type="xsd:NMTOKEN"/>
          <xsd:attribute name="inputTypeCode" type="xsd:integer"/>
          <xsd:attribute name="isActive" type="xsd:boolean"/>
          <xsd:attribute name="isExternal" type="xsd:boolean"/>
          <xsd:attribute name="isRole" type="xsd:boolean"/>
          <xsd:attribute name="lastName" type="xsd:string"/>
          <xsd:attribute name="managerUserName" type="xsd:string"/>
          <xsd:attribute name="modBy" type="xsd:string"/>
          <xsd:attribute name="openForTimeEntry" type="xsd:boolean"/>
          <xsd:attribute name="resourceId" type="xsd:string"/>
          <xsd:attribute name="resourceType" type="xsd:integer"/>
          <xsd:attribute name="roleID" type="xsd:string"/>
          <xsd:attribute name="terminationDate" type="xsd:NMTOKEN"/>
          <xsd:attribute name="trackMode" type="xsd:integer"/>
          <xsd:attribute name="userFlag1" type="xsd:boolean"/>
          <xsd:attribute name="userFlag2" type="xsd:boolean"/>
          <xsd:attribute name="userNumber1" type="xsd:decimal"/>
          <xsd:attribute name="userNumber2" type="xsd:decimal"/>
          <xsd:attribute name="userText1" type="xsd:string"/>
          <xsd:attribute name="userText2" type="xsd:string"/>
          <xsd:attribute name="userText3" type="xsd:string"/>
          <xsd:attribute name="userText4" type="xsd:string"/>
          <xsd:attribute name="userText5" type="xsd:string"/>
          <xsd:attribute name="userText6" type="xsd:string"/>
          <xsd:attribute name="userText7" type="xsd:string"/>
          <xsd:attribute name="userText8" type="xsd:string"/>
        </xsd:complexType>
      </xsd:element>
      <xsd:element name="Projects" xdb:defaultTable="">
        <xsd:complexType xdb:maintainDOM="false">
          <xsd:sequence>
            <xsd:element ref="Project" maxOccurs="unbounded"/>
          </xsd:sequence>
        </xsd:complexType>
      </xsd:element>
      <xsd:element name="Project" xdb:defaultTable="">
        <xsd:complexType xdb:maintainDOM="false">
          <xsd:sequence>
            <xsd:element ref="Baselines" minOccurs="0"/>
            <xsd:element ref="Notes" minOccurs="0"/>
            <xsd:element ref="Resources" minOccurs="0"/>
            <xsd:element ref="Tasks" minOccurs="0"/>
            <xsd:element ref="BaselineDetails" minOccurs="0"/>
            <xsd:element ref="Dependencies" minOccurs="0"/>
          </xsd:sequence>
          <xsd:attribute name="UID"/>
          <xsd:attribute name="active" type="xsd:boolean"/>
          <xsd:attribute name="asOf" type="xsd:NMTOKEN"/>
          <xsd:attribute name="approved" type="xsd:boolean"/>
          <xsd:attribute name="baseFinish" type="xsd:NMTOKEN"/>
          <xsd:attribute name="baseStart" type="xsd:NMTOKEN"/>
          <xsd:attribute name="baseTime" type="xsd:NMTOKEN"/>
          <xsd:attribute name="budget" type="xsd:double"/>
          <xsd:attribute name="closed" type="xsd:boolean"/>
          <xsd:attribute name="cpmType" type="xsd:integer"/>
          <xsd:attribute name="department" type="xsd:string"/>
          <xsd:attribute name="description" type="xsd:string"/>
          <xsd:attribute name="finish" type="xsd:NMTOKEN"/>
          <xsd:attribute name="finishImposed" type="xsd:boolean"/>
          <xsd:attribute name="format" type="xsd:integer"/>
          <xsd:attribute name="lastUpdatedBy" type="xsd:string"/>
          <xsd:attribute name="lastUpdatedDate" type="xsd:NMTOKEN"/>
          <xsd:attribute name="name" type="xsd:string"/>
          <xsd:attribute name="openForTimeEntry" type="xsd:boolean"/>
          <xsd:attribute name="priority" type="xsd:integer"/>
          <xsd:attribute name="projectType" type="xsd:integer"/>
          <xsd:attribute name="program" type="xsd:boolean"/>
          <xsd:attribute name="projectID" type="xsd:string"/>
          <xsd:attribute name="start" type="xsd:NMTOKEN"/>
          <xsd:attribute name="startImposed" type="xsd:boolean"/>
          <xsd:attribute name="status" type="xsd:integer"/>
          <xsd:attribute name="trackMode" type="xsd:integer"/>
          <xsd:attribute name="userText1" type="xsd:string"/>
          <xsd:attribute name="userText2" type="xsd:string"/>
          <xsd:attribute name="userText3" type="xsd:string"/>
          <xsd:attribute name="userText4" type="xsd:string"/>
          <xsd:attribute name="userText5" type="xsd:string"/>
          <xsd:attribute name="userText6" type="xsd:string"/>
          <xsd:attribute name="userText7" type="xsd:string"/>
          <xsd:attribute name="userText8" type="xsd:string"/>
        </xsd:complexType>
      </xsd:element>
      <xsd:element name="Baselines" xdb:defaultTable="">
        <xsd:complexType xdb:maintainDOM="false">
          <xsd:sequence>
            <xsd:element ref="Baseline" maxOccurs="unbounded"/>
          </xsd:sequence>
        </xsd:complexType>
      </xsd:element>
      <xsd:element name="Baseline" xdb:defaultTable="">
        <xsd:complexType xdb:maintainDOM="false">
          <xsd:attribute name="code" type="xsd:string"/>
          <xsd:attribute name="current" type="xsd:boolean"/>
          <xsd:attribute name="description"/>
          <xsd:attribute name="name" type="xsd:string"/>
        </xsd:complexType>
      </xsd:element>
      <xsd:element name="Resources" xdb:defaultTable="">
        <xsd:complexType xdb:maintainDOM="false">
          <xsd:sequence>
            <xsd:element ref="Resource" maxOccurs="unbounded"/>
          </xsd:sequence>
        </xsd:complexType>
      </xsd:element>
      <xsd:element name="Resource" xdb:defaultTable="">
        <xsd:complexType xdb:maintainDOM="false">
          <xsd:sequence>
            <xsd:element ref="Curve" minOccurs="0" maxOccurs="unbounded"/>
            <xsd:element ref="BaselineDetails" minOccurs="0" maxOccurs="unbounded"/>
          </xsd:sequence>
          <xsd:attribute name="availFrom" type="xsd:NMTOKEN"/>
          <xsd:attribute name="availTo" type="xsd:NMTOKEN"/>
          <xsd:attribute name="bookingStatus" type="xsd:integer"/>
          <xsd:attribute name="lastUpdatedBy" type="xsd:string"/>
          <xsd:attribute name="lastUpdatedDate" type="xsd:NMTOKEN"/>
          <xsd:attribute name="openForTimeEntry" type="xsd:boolean"/>
          <xsd:attribute name="requestStatus" type="xsd:integer"/>
          <xsd:attribute name="resourceID" type="xsd:string"/>
          <xsd:attribute name="roleID" type="xsd:string"/>
        </xsd:complexType>
      </xsd:element>
      <xsd:element name="Tasks" xdb:defaultTable="">
        <xsd:complexType xdb:maintainDOM="false">
          <xsd:sequence>
            <xsd:element ref="Task" maxOccurs="unbounded"/>
          </xsd:sequence>
        </xsd:complexType>
      </xsd:element>
      <xsd:element name="Task" xdb:defaultTable="">
        <xsd:complexType xdb:maintainDOM="false">
          <xsd:sequence>
            <xsd:element ref="Assignments" minOccurs="0"/>
            <xsd:element ref="BaselineDetails" minOccurs="0"/>
            <xsd:element ref="Constraints" minOccurs="0"/>
            <xsd:element ref="Notes" minOccurs="0"/>
          </xsd:sequence>
          <xsd:attribute name="UID"/>
          <xsd:attribute name="taskID" type="xsd:string"/>
          <xsd:attribute name="baseFinish" type="xsd:NMTOKEN"/>
          <xsd:attribute name="baseStart" type="xsd:NMTOKEN"/>
          <xsd:attribute name="baseTime" type="xsd:NMTOKEN"/>
          <xsd:attribute name="baselineDuration" type="xsd:decimal"/>
          <xsd:attribute name="category" type="xsd:string"/>
          <xsd:attribute name="critical" type="xsd:boolean"/>
          <xsd:attribute name="earlyFinish" type="xsd:NMTOKEN"/>
          <xsd:attribute name="earlyStart" type="xsd:NMTOKEN"/>
          <xsd:attribute name="finish" type="xsd:NMTOKEN"/>
          <xsd:attribute name="fixed" type="xsd:boolean"/>
          <xsd:attribute name="guidelines" type="xsd:string"/>
          <xsd:attribute name="key" type="xsd:boolean"/>
          <xsd:attribute name="lastUpdatedBy" type="xsd:string"/>
          <xsd:attribute name="lastUpdatedDate" type="xsd:NMTOKEN"/>
          <xsd:attribute name="lateFinish" type="xsd:NMTOKEN"/>
          <xsd:attribute name="lateStart" type="xsd:NMTOKEN"/>
          <xsd:attribute name="locked" type="xsd:boolean"/>
          <xsd:attribute name="methodID" type="xsd:string"/>
          <xsd:attribute name="milestone" type="xsd:boolean"/>
          <xsd:attribute name="name" type="xsd:string"/>
          <xsd:attribute name="outlineLevel" type="xsd:integer"/>
          <xsd:attribute name="percComp" type="xsd:decimal"/>
          <xsd:attribute name="priority" type="xsd:string"/>
          <xsd:attribute name="proxy" type="xsd:boolean"/>
          <xsd:attribute name="shortName" type="xsd:string"/>
          <xsd:attribute name="start" type="xsd:NMTOKEN"/>
          <xsd:attribute name="status" type="xsd:integer"/>
          <xsd:attribute name="summary" type="xsd:boolean"/>
          <xsd:attribute name="totalSlack" type="xsd:double"/>
          <xsd:attribute name="unplanned" type="xsd:boolean"/>
          <xsd:attribute name="userText1" type="xsd:string"/>
          <xsd:attribute name="userText2" type="xsd:string"/>
          <xsd:attribute name="userText3" type="xsd:string"/>
          <xsd:attribute name="userText4" type="xsd:string"/>
          <xsd:attribute name="userText5" type="xsd:string"/>
          <xsd:attribute name="userText6" type="xsd:string"/>
          <xsd:attribute name="userText7" type="xsd:string"/>
          <xsd:attribute name="userText8" type="xsd:string"/>
        </xsd:complexType>
      </xsd:element>
      <xsd:element name="Assignments" xdb:defaultTable="">
        <xsd:complexType xdb:maintainDOM="false">
          <xsd:sequence>
            <xsd:element ref="Assignment" maxOccurs="unbounded"/>
          </xsd:sequence>
        </xsd:complexType>
      </xsd:element>
      <xsd:element name="Assignment" xdb:defaultTable="">
        <xsd:complexType xdb:maintainDOM="false">
          <xsd:sequence>
            <xsd:element ref="Curve" minOccurs="0" maxOccurs="unbounded"/>
            <xsd:element ref="BaselineDetails" minOccurs="0"/>
          </xsd:sequence>
          <xsd:attribute name="actualThrough" type="xsd:NMTOKEN"/>
          <xsd:attribute name="actualWork" type="xsd:double"/>
          <xsd:attribute name="baselineWork" type="xsd:double"/>
          <xsd:attribute name="estMax" type="xsd:double"/>
          <xsd:attribute name="estPattern" type="xsd:integer"/>
          <xsd:attribute name="finish" type="xsd:NMTOKEN"/>
          <xsd:attribute name="lastUpdatedBy" type="xsd:string"/>
          <xsd:attribute name="lastUpdatedDate" type="xsd:NMTOKEN"/>
          <xsd:attribute name="pendActSum" type="xsd:double"/>
          <xsd:attribute name="pendEstSum" type="xsd:double"/>
          <xsd:attribute name="remainingWork" type="xsd:double"/>
          <xsd:attribute name="resourceID" type="xsd:string"/>
          <xsd:attribute name="roleID" type="xsd:string"/>
          <xsd:attribute name="start" type="xsd:NMTOKEN"/>
          <xsd:attribute name="status" type="xsd:integer"/>
          <xsd:attribute name="unplanned" type="xsd:boolean"/>
        </xsd:complexType>
      </xsd:element>
      <xsd:element name="Constraints" xdb:defaultTable="">
        <xsd:complexType xdb:maintainDOM="false">
          <xsd:sequence>
            <xsd:element ref="Constraint" maxOccurs="unbounded"/>
          </xsd:sequence>
        </xsd:complexType>
      </xsd:element>
      <xsd:element name="Constraint" xdb:defaultTable="">
        <xsd:complexType xdb:maintainDOM="false">
          <xsd:attribute name="lastUpdatedBy" type="xsd:string"/>
          <xsd:attribute name="lastUpdatedDate" type="xsd:NMTOKEN"/>
          <xsd:attribute name="time" type="xsd:NMTOKEN"/>
          <xsd:attribute name="type" type="xsd:integer"/>
        </xsd:complexType>
      </xsd:element>
      <xsd:element name="Notes" xdb:defaultTable="">
        <xsd:complexType xdb:maintainDOM="false">
          <xsd:sequence>
            <xsd:element ref="Note" maxOccurs="unbounded"/>
          </xsd:sequence>
        </xsd:complexType>
      </xsd:element>
      <xsd:element name="Note" xdb:defaultTable="">
        <xsd:complexType xdb:maintainDOM="false">
          <xsd:attribute name="category" type="xsd:string"/>
          <xsd:attribute name="content" type="xsd:string"/>
          <xsd:attribute name="createdBy" type="xsd:string"/>
          <xsd:attribute name="createdDate" type="xsd:NMTOKEN"/>
          <xsd:attribute name="lastUpdatedBy" type="xsd:string"/>
          <xsd:attribute name="lastUpdatedDate" type="xsd:NMTOKEN"/>
        </xsd:complexType>
      </xsd:element>
      <xsd:element name="Dependencies" xdb:defaultTable="">
        <xsd:complexType xdb:maintainDOM="false">
          <xsd:sequence>
            <xsd:element ref="Dependency" maxOccurs="unbounded"/>
          </xsd:sequence>
        </xsd:complexType>
      </xsd:element>
      <xsd:element name="Dependency" xdb:defaultTable="">
        <xsd:complexType xdb:maintainDOM="false">
          <xsd:attribute name="lag" type="xsd:decimal"/>
          <xsd:attribute name="lagType" type="xsd:integer"/>
          <xsd:attribute name="lastUpdatedBy" type="xsd:string"/>
          <xsd:attribute name="lastUpdatedDate" type="xsd:NMTOKEN"/>
          <xsd:attribute name="predecessorID" type="xsd:string"/>
          <xsd:attribute name="predecessorUID"/>
          <xsd:attribute name="startFinishType" type="xsd:integer"/>
          <xsd:attribute name="successorID" type="xsd:string"/>
          <xsd:attribute name="successorUID"/>
        </xsd:complexType>
      </xsd:element>
      <xsd:element name="Calendar" xdb:defaultTable="">
        <xsd:complexType xdb:maintainDOM="false">
          <xsd:sequence>
            <xsd:element ref="Days" minOccurs="0"/>
          </xsd:sequence>
          <xsd:attribute name="baseCalendar"/>
          <xsd:attribute name="lastUpdatedBy" type="xsd:string"/>
          <xsd:attribute name="lastUpdatedDate" type="xsd:NMTOKEN"/>
          <xsd:attribute name="name"/>
        </xsd:complexType>
      </xsd:element>
      <xsd:element name="Days" xdb:defaultTable="">
        <xsd:complexType xdb:maintainDOM="false">
          <xsd:sequence>
            <xsd:element ref="Day" minOccurs="0" maxOccurs="unbounded"/>
          </xsd:sequence>
        </xsd:complexType>
      </xsd:element>
      <xsd:element name="Day" xdb:defaultTable="">
        <xsd:complexType xdb:maintainDOM="false">
          <xsd:sequence>
            <xsd:element ref="Shifts" minOccurs="0"/>
          </xsd:sequence>
          <xsd:attribute name="dayOfWeek" type="xsd:string"/>
          <xsd:attribute name="finish" type="xsd:NMTOKEN"/>
          <xsd:attribute name="isWorkDay" type="xsd:boolean"/>
          <xsd:attribute name="start" type="xsd:NMTOKEN"/>
        </xsd:complexType>
      </xsd:element>
      <xsd:element name="Shifts" xdb:defaultTable="">
        <xsd:complexType xdb:maintainDOM="false">
          <xsd:sequence>
            <xsd:element ref="Shift" maxOccurs="unbounded"/>
          </xsd:sequence>
        </xsd:complexType>
      </xsd:element>
      <xsd:element name="Shift" xdb:defaultTable="">
        <xsd:complexType xdb:maintainDOM="false">
          <xsd:attribute name="finish" type="xsd:NMTOKEN"/>
          <xsd:attribute name="start" type="xsd:NMTOKEN"/>
        </xsd:complexType>
      </xsd:element>
      <xsd:element name="Curve" xdb:defaultTable="">
        <xsd:complexType xdb:maintainDOM="false">
          <xsd:sequence>
            <xsd:element ref="Segments" minOccurs="0"/>
          </xsd:sequence>
          <xsd:attribute name="default" type="xsd:double"/>
          <xsd:attribute name="name" type="xsd:string"/>
          <xsd:attribute name="type" type="xsd:integer"/>
        </xsd:complexType>
      </xsd:element>
      <xsd:element name="Segments" xdb:defaultTable="">
        <xsd:complexType xdb:maintainDOM="false">
          <xsd:sequence>
            <xsd:element ref="Segment" maxOccurs="unbounded"/>
          </xsd:sequence>
        </xsd:complexType>
      </xsd:element>
      <xsd:element name="Segment" xdb:defaultTable="">
        <xsd:complexType xdb:maintainDOM="false">
          <xsd:sequence>
            <xsd:element ref="Calendar" minOccurs="0"/>
          </xsd:sequence>
          <xsd:attribute name="finish" type="xsd:NMTOKEN"/>
          <xsd:attribute name="rate" type="xsd:double"/>
          <xsd:attribute name="start" type="xsd:NMTOKEN"/>
        </xsd:complexType>
      </xsd:element>
      <xsd:element name="BaselineDetails" xdb:defaultTable="">
        <xsd:complexType xdb:maintainDOM="false">
          <xsd:sequence>
            <xsd:element ref="BaselineDetail" maxOccurs="unbounded"/>
          </xsd:sequence>
        </xsd:complexType>
      </xsd:element>
      <xsd:element name="BaselineDetail" xdb:defaultTable="">
        <xsd:complexType xdb:maintainDOM="false">
          <xsd:sequence>
            <xsd:element ref="Curve" minOccurs="0" maxOccurs="unbounded"/>
          </xsd:sequence>
          <xsd:attribute name="baselineCode" type="xsd:string"/>
          <xsd:attribute name="costSum" type="xsd:double"/>
          <xsd:attribute name="duration" type="xsd:double"/>
          <xsd:attribute name="finish" type="xsd:NMTOKEN"/>
          <xsd:attribute name="start" type="xsd:NMTOKEN"/>
          <xsd:attribute name="usageSum" type="xsd:double"/>
        </xsd:complexType>
      </xsd:element>
    </xsd:schema>' ;
    BEGIN
      dbms_xmlschema.registerSchema
        schemaurl       => 'http://www.oracle.com/xsd/projet.xsd',
        schemadoc       => V_XMLSCHEMA,
        local           => TRUE,
        genTypes        => TRUE,
        genBean         => FALSE,
        genTables       => TRUE,
        enablehierarchy => DBMS_XMLSCHEMA.ENABLE_HIERARCHY_NONE,
        owner           => user
    END;
    /

Maybe you are looking for

  • IMovie events and original video folder

    Hi everyone, I have some questions regarding the iMovie events folder: - I bought a new 2TB drive for my video editing, I imported around 300GB of footage and brought into a new iMovie project. When I check the hard drive I see that I have an iMove E

  • Unicode datatypes v.s. unicode databases

    We have a legacy system that is implemented in Powerbuilder and C++. We are pretty sure about which columns we need to convert to support Unicode. Besides, some of our clients have cooperate standard (AMERICAN_AMERICA.WE8MSWIN1252) for the NLS_LANG o

  • Jagged edges on Illustrator-exported eps

    I am creating a logo in Illustrator Illustrator CS5, but I'm having problems exporting the Illustrator file as an eps. The logo has both gradients, transparent objects and curves, and the eps seems to have problems outputting this. Rounded elements s

  • Black Macbook Cracking!!

    The end of my black macbook (about 1.5 yrs old) is cracking and pieces have fallen off already. Its the end right above my IR and indicator light. Its the top piece or the hand rest I guess thats chipping off at the edge. Whats up with that??

  • Getting the Flex Builder Plugin for Eclipse

    I may be a dope, but I can't tell you how long it took me to find the download for the Flex Builder plugin for an existing install of Eclipse. If you're looking for the plugin, go to the last line of the FlexBuilder standalone download page--and then