SlideShare uma empresa Scribd logo
1 de 50
XML Indexing Strategies
Choosing the Right Index for the
           Right Job


 Marco Gralike
Richard Foote (Mr. Index)
• OakTable Member
• ACE Director
• Oracle Certified
  Professional
• 22+ years DBA, etc.




richardfoote.wordpress.com
Refinement
Structured or Semi-Structured or…

         Structured




                  Semi
               Structured
Unstructured Content
Document Driven / Data Driven
XML Container
         (in memory or via storage)



  In Memory                    CLOB
  (document)                (document)

Object Relational           Binary XML
     (data)                    (data)
Design: Width and Height and …

                                       3
                                       1
                                                         4



                                   2                           5



     X

                                           Y

                                                                   6
                               Z


Content Height         : minOccurs="0" maxOccurs=“unbounded”
Content Width          : type="xs:string“, restriction…?
Content Distribution   : histogram, statistics, skew, cardinality ?
XMLIndex Use Cases




   Binary XML          Binary XML        Mixed
(Schema based)   (Schema less, Schema
                         based)
   XMLIndex        XMLIndex Structured   w/ Text
  Structured          Component           index
  Component
Storage Models (xmltype)
• CLOB
  – Default until 11.2.0.2.0 (deprecated in 12.1)
  – Non-Schema Based
• Binary XML
  – Oracle 11 and Onwards
  – Schema and Non-Schema Based
• Object Relational (+Hybrid)
  – Nested Tables, Types, Varray’s
  – Schema Based
Querying XML Content in XML DB
                                   SQL/XML                     XQuery

                                            XMLType Abstraction
                                DB XQuery                                                 Procedural XQuery

                      XQuery Rewrite                         Pushdown                XVM
                                                                            (use “no query rewrite”)

                                   Relational        Streaming XPath                             DOM Tree
                                                        Evaluation                                Model
                                    Access
        SQL Execution              Methods                                  XMLIndex




             Object-Relational                                             Binary XML

            Relational Storage                                            Secure Files


Source: S317428: Building Really Scalable XML Applications with Oracle XML DB and Oracle Text
Index Methods (xmltype)
Storage Index Defaults (xmltype)
• Binary XML / CLOB
  – LOB Index
• Object Relational
  – DBMS_XMLSCHEMA  “OPTIONS”
  – Oracle 10g: Index Organized Tables
  – Oracle 11g: B-Tree Indexes
  – xdb:annotations
     • Storage type  xdb:SQLType
     • Storage Type  xdb:ColumnProps / xdb:TableProps
Index Methods (10.x)
                                                   BTre
                                                    BTre
                                                     BT
                                                     e
                                                    eI
                                                   Index
                        bookstore
                                                                    Function
                                                                   based Index
                                                                     (XPath)
        book                                     whitepaper

title   author   author chapter          title     author     id   paragraph


                        content                                    content


                     Oracle Text Index
Function-Based Index
• Deprecated in 11.2
• Object Relational XMLType Storage
  (can, but shouldn’t, on CLOB when hybrid)
• Performance wise the lesser option…

SQL> CREATE INDEX function_based_index
     ON xml_data_table
     (extractValue(OBJECT_VALUE, '/Root/TextID'));
BTree / Bitmap Index
• Structured XML Data
  – Ordered Collection Tables (OCT)
  – ComplexTypes…
  – “dot” notation using the “xmldata” pseudocolumn


SQL> CREATE INDEX dot_notation_index
     ON xml_data_table
     ("XMLDATA". "TEXTID");
Index Alternatives
SQL> CREATE INDEX function_based_again_idx
     ON xml_data_table
     (CAST("XMLDATA". "TEXTID“ as VARCHAR2(10)));



SQL> CREATE INDEX oracle_11_applicable_only_index
     ON xml_data_table xdt
     (XMLCast(XMLQuery
         ('$i/Root/TextID'
         PASSING xdt.OBJECT_VALUE as "i"
         RETURNING content)
      as VARCHAR2(10)));
Oracle Text Index
• Unstructured Data in XML
   – CLOB storage XML part in Object Relational XML
   – Secondary index on XMLIndex
• Can only index XML data TEXT nodes (<12.1!)
• Result Set Interface (new in 11.2.0.2)
   – Specify Query request and hit list requirements in
     XML
SQL> CREATE INDEX oracle_text_index
     ON xml_data_table
        (OBJECT_VALUE) INDEXTYPE IS CTXSYS.CONTEXT;
Index Methods (11.1)
                                                 BTre
                                                  BTre
                                                   BT
                                                   e
                                                  eI
                                                 Index
                         bookstore
                                                                  Function
                                                                 based Index
                                                                   (XPath)
        book                                   whitepaper

title   author   author chapter        title     author     id   paragraph
          Unstructured
           XMLIndex
                         content                                 content


                    Secondary Oracle
                       Text Index
Usage: Unstructured XMLIndex
• XML Document contains:
  – Semi Structured Data and Structured Data
  – Supports searching and fragment extraction
  – When XPath queried is not known beforehand
• XMLType CLOB or Binary XML content
• If you use an XMLIndex and/or combine it
  with Structured XMLIndex(es)
Simple: Unstructured XMLIndex
SQL> CREATE INDEX xmlindex_idx
     ON “XMLTYPE_COLUMN"(xdata)
     INDEXTYPE IS XDB.XMLINDEX;

Index created.


SQL> CREATE INDEX xmlindex_idx
     ON “XMLTYPE_TABLE"(object_value)
     INDEXTYPE IS XDB.XMLINDEX;

Index created.
Creating Unstructured XMLIndex
CREATE INDEX XMLIDX
ON             XMLBINARY_TAB (object_value)
INDEXTYPE IS XDB.XMLIndex
PARAMETERS
  ('PATHS (INCLUDE (/ROOT/ID /ROOT/INFO/INFO_ID )
NAMESPACE MAPPING
  (xmlns="http://localhost/xmlschema_bin.xsd") )
PATH TABLE           path_table    (TABLESPACE XML_DATA)
PATH ID INDEX        pathid_idx   (TABLESPACE XML_INDX)
ORDER KEY INDEX orderkey_idx (TABLESPACE XML_INDX)
VALUE INDEX          value_idx    (TABLESPACE XML_INDX)
ASYNC (SYNC ALWAYS) STALE (FALSE) ')
PARALLEL LOGGING;
Path Table

Unstructured
 XMLIndex
    f (x)




  Path Table
Unstructured XMLIndex (UXI)
 One Path Table
 Use Path Subsetting
    Full Blown XMLIndex can be BIG
                                      Unstructured
 Token Tables (XDB.X$......)          XMLIndex
                                          f (x)
    Query re-write on Tokens
    Fuzzy Searches, //
    Optimizer Statistics
 Can be maintained Manually
    Recorded in Pending Table          Path Table
 Secondairy indexes possible
Index Methods (11.2)
                                                 BTre
                                                  BTre
                                                   BT
                                                   e
                                                  eI
                                                 Index
                         bookstore
                                                                       Function
                                                                      based Index
                                                                        (XPath)
        book                                   whitepaper        Structured
                                                                 XMLIndex

title   author   author chapter        title     author     id       paragraph
          Unstructured
           XMLIndex
                         content                                     content

                                                 Highly Structured
                    Secondary Oracle             Islands of Data
                       Text Index
Usage: Structured XMLIndex
• With highly Structured Data
• Likely candidates: ComplexTypes
• Structured Islands of Data
  – Can be nested, but officially only one level
  – XMLTABLE “virtual” nested column hint
• Will create (multiple) “Content Tables”
  – Multiple XPath defined same columns with
    different purpose

They deliver relational performance…!
Simple: Structured XMLIndex
• “XMLTABLE” Driven Syntax
SQL> CREATE INDEX xmlindex_sxi
     on xmldata_table (doc)
     indextype is xdb.xmlindex
     parameters
       ('GROUP elementinfo_group                  Be aware
         XMLTABLE xml_cnt_tab_elementinfo            ''
         ' '/root/element' '
         COLUMNS
         infocol VARCHAR2(4000) PATH ' 'info' '
       ');
Content Table(s)
                           CONTENT TABLE(s)
KEY INDEX
                           Key      RID      YOUR
 (KEY)                     Key
                             Key     RID
                                      RID     YOUR
                                               YOUR
                                            column
                                             column
                                              column
                                                 ss
 Unique BTREE Index       RAW rowid
                            RAW rowid
                             RAW rowid
                                                X
                                               X
 Primary Key              Not
                            Not
                             Not
                                                X
                           null
                            null
                             null
RID INDEX
 (RID)
 NON Unique BTREE Index
Your Columns
Structured XMLIndex (SXI)
• Content Table(s)
• Based on XMLTABLE syntax
• XMLTable construct can be nested but:
  “Only ONE XMLType column allowed”
                                          Structured

   VIRTUAL column                        XMLIndex
                                             f (x)


• Can be maintained Manually
• Secondairy indexes possible
• LOCAL parameter (partitioning)
                                          Content
                                          Tables
Adding Structured Indexes
SQL> ALTER INDEX xmlindex_sxi
      parameters
      ('ADD_GROUP
      GROUP my_new_group
      XMLTABLE xml_content_tab_new
       ' '/root/extra' '
         COLUMNS
         extracol VARCHAR2(35) PATH ' 'new_element' ' ');
Mixed XMLIndex Options

   Unstructured            bookstore
   XMLIndex


           book                            whitepaper

title   author    author     chapter    title   author     id      paragraph
                                                    Structured
           Structured
                                                    XMLIndex
           XMLIndex
                              content
                                                                    content
                                                    Secondary
                                                    (text) Index
Mixed XMLIndex structures
CREATE INDEX xmlindex on TEST_RANGE_XML (doc)
    indextype is xdb.xmlindex
    PARAMETERS
(' PATH TABLE path_table PATHS (EXCLUDE(/root/ElementInfo)) ');

BEGIN
  DBMS_XMLINDEX.registerParameter
  ('StructuredXML',
   'ADD_GROUP GROUP ElementInfo
  XMLTABLE xml_cnttable_valueinfo ' '/root/ElementInfo' '
  COLUMNS ValueInfo VARCHAR2(100) PATH ' 'ValueInfo' ');
END; /

ALTER INDEX xmlindex PARAMETERS('PARAM StructuredXML');
XMLIndex Maintenance
• ALTER INDEX
• XMLIndex Parameter Changes
  – DBMS_XMLINDEX.DROPPARAMETER
  – DBMS_XMLINDEX.MODIFYPARAMETER
  – DBMS_XMLINDEX.REGISTERPARAMETER
• Manual Synchronizing an XMLIndex
  – DBMS_XMLINDEX.SYNCINDEX
  – Pending Tables
“There Can Be Only One…”
Syntax Awareness
• SYNC=ALWAYS
  – Mandatory when Combined XMLIndex
• SYNC=MANUAL
  – Locking
• STALE=FALSE | TRUE
  – Hmmm…
• Empty XMLIndex tables
  – OOPS  I got my “XMLTABLE” Syntax etc. “wrong”
Notes on XMLIndex (1)
• Only ONE XMLIndex is allowed per column of
  XMLType table
  – Add extra XMLIndex structures (structured or
    unstructured)
    via ADD_GROUP syntax
  – Only SYNC=ALWAYS is allowed while using mixed
    XML Index structures or add more than one (11g)
Notes on XMLIndex (2)
• You need the LOCAL parameter to create local
  partitioned XML Indexes
• An XMLIndex on a HASH partitioned XMLType
  column or XMLType table, is not allowed (11g)
  – But you can create an Oracle Text Index on such
    structures
Recap
• True understanding of Storage
  and Index options will provide:
  – Optimal performance
  – Out perform XML (Java based)
• A lot of choice:
  – Problems are Complex
  – Also provides Solutions
• Good design beforehand is the path to success
References (1)
Oracle Whitepapers
  – Oracle XML DB : Choosing the Best XMLType
    Storage Option for Your Use Case (PDF)
  – Oracle XML DB : Best Practices to Get Optimal
    Performance out of XML Queries (PDF)
Blog
  – www.xmldb.nl
       • (Dedicated XMLDB blog)
       • Semi-Structured XMLIndex section
       • Structured XMLIndex section
References (2)
• Oracle Open World Presentation on XML DB
  – S317428: Building Really Scalable XML
    Applications with Oracle XML DB and Oracle Text
• XML DB OTN / FAQ Thread
  – http://forums.oracle.com/forums/forum.jspa?foru
    mID=34
  – http://forums.oracle.com/forums/thread.jspa?thr
    eadID=410714

Mais conteúdo relacionado

Mais procurados

Miracle Open World 2011 - XML Index Strategies
Miracle Open World 2011  -  XML Index StrategiesMiracle Open World 2011  -  XML Index Strategies
Miracle Open World 2011 - XML Index StrategiesMarco Gralike
 
Oracle Developer Day, 20 October 2009, Oracle De Meern, Holland: Oracle Datab...
Oracle Developer Day, 20 October 2009, Oracle De Meern, Holland: Oracle Datab...Oracle Developer Day, 20 October 2009, Oracle De Meern, Holland: Oracle Datab...
Oracle Developer Day, 20 October 2009, Oracle De Meern, Holland: Oracle Datab...Marco Gralike
 
UKOUG 2010 (Birmingham) - XML Indexing strategies - Choosing the Right Index ...
UKOUG 2010 (Birmingham) - XML Indexing strategies - Choosing the Right Index ...UKOUG 2010 (Birmingham) - XML Indexing strategies - Choosing the Right Index ...
UKOUG 2010 (Birmingham) - XML Indexing strategies - Choosing the Right Index ...Marco Gralike
 
Design Concepts For Xml Applications That Will Perform
Design Concepts For Xml Applications That Will PerformDesign Concepts For Xml Applications That Will Perform
Design Concepts For Xml Applications That Will PerformMarco Gralike
 
Oracle Database 11g Release 2 - XMLDB New Features
Oracle Database 11g Release 2 - XMLDB New FeaturesOracle Database 11g Release 2 - XMLDB New Features
Oracle Database 11g Release 2 - XMLDB New FeaturesMarco Gralike
 
OakTable World 2015 - Using XMLType content with the Oracle In-Memory Column...
OakTable World 2015  - Using XMLType content with the Oracle In-Memory Column...OakTable World 2015  - Using XMLType content with the Oracle In-Memory Column...
OakTable World 2015 - Using XMLType content with the Oracle In-Memory Column...Marco Gralike
 
XML In The Real World - Use Cases For Oracle XMLDB
XML In The Real World - Use Cases For Oracle XMLDBXML In The Real World - Use Cases For Oracle XMLDB
XML In The Real World - Use Cases For Oracle XMLDBMarco Gralike
 
Real World Experience With Oracle Xml Database 11g An Oracle Ace’s Perspectiv...
Real World Experience With Oracle Xml Database 11g An Oracle Ace’s Perspectiv...Real World Experience With Oracle Xml Database 11g An Oracle Ace’s Perspectiv...
Real World Experience With Oracle Xml Database 11g An Oracle Ace’s Perspectiv...Marco Gralike
 
UKOUG Tech14 - Using Database In-Memory Column Store with Complex Datatypes
UKOUG Tech14 - Using Database In-Memory Column Store with Complex DatatypesUKOUG Tech14 - Using Database In-Memory Column Store with Complex Datatypes
UKOUG Tech14 - Using Database In-Memory Column Store with Complex DatatypesMarco Gralike
 
XMLDB Building Blocks And Best Practices - Oracle Open World 2008 - Marco Gra...
XMLDB Building Blocks And Best Practices - Oracle Open World 2008 - Marco Gra...XMLDB Building Blocks And Best Practices - Oracle Open World 2008 - Marco Gra...
XMLDB Building Blocks And Best Practices - Oracle Open World 2008 - Marco Gra...Marco Gralike
 
Ordina Oracle Open World
Ordina Oracle Open WorldOrdina Oracle Open World
Ordina Oracle Open WorldMarco Gralike
 
Starting with JSON Path Expressions in Oracle 12.1.0.2
Starting with JSON Path Expressions in Oracle 12.1.0.2Starting with JSON Path Expressions in Oracle 12.1.0.2
Starting with JSON Path Expressions in Oracle 12.1.0.2Marco Gralike
 
UKOUG Tech14 - Getting Started With JSON in the Database
UKOUG Tech14 - Getting Started With JSON in the DatabaseUKOUG Tech14 - Getting Started With JSON in the Database
UKOUG Tech14 - Getting Started With JSON in the DatabaseMarco Gralike
 
Jdbc 4.0 New Features And Enhancements
Jdbc 4.0 New Features And EnhancementsJdbc 4.0 New Features And Enhancements
Jdbc 4.0 New Features And Enhancementsscacharya
 
Advanced SQL - Database Access from Programming Languages
Advanced SQL - Database Access  from Programming LanguagesAdvanced SQL - Database Access  from Programming Languages
Advanced SQL - Database Access from Programming LanguagesS.Shayan Daneshvar
 
JSON in der Oracle Datenbank
JSON in der Oracle DatenbankJSON in der Oracle Datenbank
JSON in der Oracle DatenbankUlrike Schwinn
 

Mais procurados (20)

Miracle Open World 2011 - XML Index Strategies
Miracle Open World 2011  -  XML Index StrategiesMiracle Open World 2011  -  XML Index Strategies
Miracle Open World 2011 - XML Index Strategies
 
Oracle Developer Day, 20 October 2009, Oracle De Meern, Holland: Oracle Datab...
Oracle Developer Day, 20 October 2009, Oracle De Meern, Holland: Oracle Datab...Oracle Developer Day, 20 October 2009, Oracle De Meern, Holland: Oracle Datab...
Oracle Developer Day, 20 October 2009, Oracle De Meern, Holland: Oracle Datab...
 
UKOUG 2010 (Birmingham) - XML Indexing strategies - Choosing the Right Index ...
UKOUG 2010 (Birmingham) - XML Indexing strategies - Choosing the Right Index ...UKOUG 2010 (Birmingham) - XML Indexing strategies - Choosing the Right Index ...
UKOUG 2010 (Birmingham) - XML Indexing strategies - Choosing the Right Index ...
 
Design Concepts For Xml Applications That Will Perform
Design Concepts For Xml Applications That Will PerformDesign Concepts For Xml Applications That Will Perform
Design Concepts For Xml Applications That Will Perform
 
Oracle Database 11g Release 2 - XMLDB New Features
Oracle Database 11g Release 2 - XMLDB New FeaturesOracle Database 11g Release 2 - XMLDB New Features
Oracle Database 11g Release 2 - XMLDB New Features
 
OakTable World 2015 - Using XMLType content with the Oracle In-Memory Column...
OakTable World 2015  - Using XMLType content with the Oracle In-Memory Column...OakTable World 2015  - Using XMLType content with the Oracle In-Memory Column...
OakTable World 2015 - Using XMLType content with the Oracle In-Memory Column...
 
XML In The Real World - Use Cases For Oracle XMLDB
XML In The Real World - Use Cases For Oracle XMLDBXML In The Real World - Use Cases For Oracle XMLDB
XML In The Real World - Use Cases For Oracle XMLDB
 
Real World Experience With Oracle Xml Database 11g An Oracle Ace’s Perspectiv...
Real World Experience With Oracle Xml Database 11g An Oracle Ace’s Perspectiv...Real World Experience With Oracle Xml Database 11g An Oracle Ace’s Perspectiv...
Real World Experience With Oracle Xml Database 11g An Oracle Ace’s Perspectiv...
 
UKOUG Tech14 - Using Database In-Memory Column Store with Complex Datatypes
UKOUG Tech14 - Using Database In-Memory Column Store with Complex DatatypesUKOUG Tech14 - Using Database In-Memory Column Store with Complex Datatypes
UKOUG Tech14 - Using Database In-Memory Column Store with Complex Datatypes
 
XMLDB Building Blocks And Best Practices - Oracle Open World 2008 - Marco Gra...
XMLDB Building Blocks And Best Practices - Oracle Open World 2008 - Marco Gra...XMLDB Building Blocks And Best Practices - Oracle Open World 2008 - Marco Gra...
XMLDB Building Blocks And Best Practices - Oracle Open World 2008 - Marco Gra...
 
Ordina Oracle Open World
Ordina Oracle Open WorldOrdina Oracle Open World
Ordina Oracle Open World
 
Starting with JSON Path Expressions in Oracle 12.1.0.2
Starting with JSON Path Expressions in Oracle 12.1.0.2Starting with JSON Path Expressions in Oracle 12.1.0.2
Starting with JSON Path Expressions in Oracle 12.1.0.2
 
UKOUG Tech14 - Getting Started With JSON in the Database
UKOUG Tech14 - Getting Started With JSON in the DatabaseUKOUG Tech14 - Getting Started With JSON in the Database
UKOUG Tech14 - Getting Started With JSON in the Database
 
Jdbc 4.0 New Features And Enhancements
Jdbc 4.0 New Features And EnhancementsJdbc 4.0 New Features And Enhancements
Jdbc 4.0 New Features And Enhancements
 
Xml parsers
Xml parsersXml parsers
Xml parsers
 
Introduction to MongoDB
Introduction to MongoDBIntroduction to MongoDB
Introduction to MongoDB
 
Advanced SQL - Database Access from Programming Languages
Advanced SQL - Database Access  from Programming LanguagesAdvanced SQL - Database Access  from Programming Languages
Advanced SQL - Database Access from Programming Languages
 
Xml processors
Xml processorsXml processors
Xml processors
 
JSON in der Oracle Datenbank
JSON in der Oracle DatenbankJSON in der Oracle Datenbank
JSON in der Oracle Datenbank
 
Java full stack1
Java full stack1Java full stack1
Java full stack1
 

Semelhante a BGOUG 2012 - XML Index Strategies

SQLPASS AD501-M XQuery MRys
SQLPASS AD501-M XQuery MRysSQLPASS AD501-M XQuery MRys
SQLPASS AD501-M XQuery MRysMichael Rys
 
Expertezed 2012 Webcast - XML DB Use Cases
Expertezed 2012 Webcast - XML DB Use CasesExpertezed 2012 Webcast - XML DB Use Cases
Expertezed 2012 Webcast - XML DB Use CasesMarco Gralike
 
Making your data work harder than you do
Making your data work harder than you doMaking your data work harder than you do
Making your data work harder than you doSusan Jane Williams
 
OCAS @ ISWC 2011 - Generic Multilevel Approach Designing Domain Ontologies Ba...
OCAS @ ISWC 2011 - Generic Multilevel Approach Designing Domain Ontologies Ba...OCAS @ ISWC 2011 - Generic Multilevel Approach Designing Domain Ontologies Ba...
OCAS @ ISWC 2011 - Generic Multilevel Approach Designing Domain Ontologies Ba...Dr.-Ing. Thomas Hartmann
 
Workshop on Semantic Statistics - Generic Multilevel Approach Designing Domai...
Workshop on Semantic Statistics - Generic Multilevel Approach Designing Domai...Workshop on Semantic Statistics - Generic Multilevel Approach Designing Domai...
Workshop on Semantic Statistics - Generic Multilevel Approach Designing Domai...Dr.-Ing. Thomas Hartmann
 
Easy Data Object Relational Mapping Tool
Easy Data Object Relational Mapping ToolEasy Data Object Relational Mapping Tool
Easy Data Object Relational Mapping ToolHasitha Guruge
 
advDBMS_XML.pptx
advDBMS_XML.pptxadvDBMS_XML.pptx
advDBMS_XML.pptxIreneGetzi
 
Linq to xml
Linq to xmlLinq to xml
Linq to xmlMickey
 
DATA INTEGRATION (Gaining Access to Diverse Data).ppt
DATA INTEGRATION (Gaining Access to Diverse Data).pptDATA INTEGRATION (Gaining Access to Diverse Data).ppt
DATA INTEGRATION (Gaining Access to Diverse Data).pptcareerPointBasti
 
Developer & Fusion Middleware 1 | Mark Drake | An introduction to Oracle XML ...
Developer & Fusion Middleware 1 | Mark Drake | An introduction to Oracle XML ...Developer & Fusion Middleware 1 | Mark Drake | An introduction to Oracle XML ...
Developer & Fusion Middleware 1 | Mark Drake | An introduction to Oracle XML ...InSync2011
 
Enterprise Java Web Application Frameworks Sample Stack Implementation
Enterprise Java Web Application Frameworks   Sample Stack ImplementationEnterprise Java Web Application Frameworks   Sample Stack Implementation
Enterprise Java Web Application Frameworks Sample Stack ImplementationMert Çalışkan
 
unit_5_XML data integration database management
unit_5_XML data integration database managementunit_5_XML data integration database management
unit_5_XML data integration database managementsathiyabcsbs
 
Asp.Net 3.5 Part 2
Asp.Net 3.5 Part 2Asp.Net 3.5 Part 2
Asp.Net 3.5 Part 2asim78
 
Hibernate ppt
Hibernate pptHibernate ppt
Hibernate pptAneega
 
Mongophilly indexing-2011-04-26
Mongophilly indexing-2011-04-26Mongophilly indexing-2011-04-26
Mongophilly indexing-2011-04-26kreuter
 

Semelhante a BGOUG 2012 - XML Index Strategies (20)

SQLPASS AD501-M XQuery MRys
SQLPASS AD501-M XQuery MRysSQLPASS AD501-M XQuery MRys
SQLPASS AD501-M XQuery MRys
 
Expertezed 2012 Webcast - XML DB Use Cases
Expertezed 2012 Webcast - XML DB Use CasesExpertezed 2012 Webcast - XML DB Use Cases
Expertezed 2012 Webcast - XML DB Use Cases
 
Making your data work harder than you do
Making your data work harder than you doMaking your data work harder than you do
Making your data work harder than you do
 
Xml databases
Xml databasesXml databases
Xml databases
 
OCAS @ ISWC 2011 - Generic Multilevel Approach Designing Domain Ontologies Ba...
OCAS @ ISWC 2011 - Generic Multilevel Approach Designing Domain Ontologies Ba...OCAS @ ISWC 2011 - Generic Multilevel Approach Designing Domain Ontologies Ba...
OCAS @ ISWC 2011 - Generic Multilevel Approach Designing Domain Ontologies Ba...
 
Workshop on Semantic Statistics - Generic Multilevel Approach Designing Domai...
Workshop on Semantic Statistics - Generic Multilevel Approach Designing Domai...Workshop on Semantic Statistics - Generic Multilevel Approach Designing Domai...
Workshop on Semantic Statistics - Generic Multilevel Approach Designing Domai...
 
Easy Data Object Relational Mapping Tool
Easy Data Object Relational Mapping ToolEasy Data Object Relational Mapping Tool
Easy Data Object Relational Mapping Tool
 
advDBMS_XML.pptx
advDBMS_XML.pptxadvDBMS_XML.pptx
advDBMS_XML.pptx
 
Linq to xml
Linq to xmlLinq to xml
Linq to xml
 
Hibernate tutorial
Hibernate tutorialHibernate tutorial
Hibernate tutorial
 
DATA INTEGRATION (Gaining Access to Diverse Data).ppt
DATA INTEGRATION (Gaining Access to Diverse Data).pptDATA INTEGRATION (Gaining Access to Diverse Data).ppt
DATA INTEGRATION (Gaining Access to Diverse Data).ppt
 
The CoFX Data Model
The CoFX Data ModelThe CoFX Data Model
The CoFX Data Model
 
Developer & Fusion Middleware 1 | Mark Drake | An introduction to Oracle XML ...
Developer & Fusion Middleware 1 | Mark Drake | An introduction to Oracle XML ...Developer & Fusion Middleware 1 | Mark Drake | An introduction to Oracle XML ...
Developer & Fusion Middleware 1 | Mark Drake | An introduction to Oracle XML ...
 
Enterprise Java Web Application Frameworks Sample Stack Implementation
Enterprise Java Web Application Frameworks   Sample Stack ImplementationEnterprise Java Web Application Frameworks   Sample Stack Implementation
Enterprise Java Web Application Frameworks Sample Stack Implementation
 
Catmandu / LibreCat Project
Catmandu / LibreCat ProjectCatmandu / LibreCat Project
Catmandu / LibreCat Project
 
unit_5_XML data integration database management
unit_5_XML data integration database managementunit_5_XML data integration database management
unit_5_XML data integration database management
 
Asp.Net 3.5 Part 2
Asp.Net 3.5 Part 2Asp.Net 3.5 Part 2
Asp.Net 3.5 Part 2
 
Hibernate ppt
Hibernate pptHibernate ppt
Hibernate ppt
 
Mongophilly indexing-2011-04-26
Mongophilly indexing-2011-04-26Mongophilly indexing-2011-04-26
Mongophilly indexing-2011-04-26
 
Solr -
Solr - Solr -
Solr -
 

Mais de Marco Gralike

UKOUG2018 - I Know what you did Last Summer [in my Database].pptx
UKOUG2018 - I Know what you did Last Summer [in my Database].pptxUKOUG2018 - I Know what you did Last Summer [in my Database].pptx
UKOUG2018 - I Know what you did Last Summer [in my Database].pptxMarco Gralike
 
eProseed Oracle Open World 2016 debrief - Oracle Management Cloud
eProseed Oracle Open World 2016 debrief - Oracle Management CloudeProseed Oracle Open World 2016 debrief - Oracle Management Cloud
eProseed Oracle Open World 2016 debrief - Oracle Management CloudMarco Gralike
 
eProseed Oracle Open World 2016 debrief - Oracle 12.2.0.1 Database
eProseed Oracle Open World 2016 debrief - Oracle 12.2.0.1 DatabaseeProseed Oracle Open World 2016 debrief - Oracle 12.2.0.1 Database
eProseed Oracle Open World 2016 debrief - Oracle 12.2.0.1 DatabaseMarco Gralike
 
Oracle Database - JSON and the In-Memory Database
Oracle Database - JSON and the In-Memory DatabaseOracle Database - JSON and the In-Memory Database
Oracle Database - JSON and the In-Memory DatabaseMarco Gralike
 
UKOUG Tech15 - Going Full Circle - Building a native JSON Database API
UKOUG Tech15 - Going Full Circle - Building a native JSON Database APIUKOUG Tech15 - Going Full Circle - Building a native JSON Database API
UKOUG Tech15 - Going Full Circle - Building a native JSON Database APIMarco Gralike
 
An introduction into Oracle VM V3.x
An introduction into Oracle VM V3.xAn introduction into Oracle VM V3.x
An introduction into Oracle VM V3.xMarco Gralike
 
An introduction into Oracle Enterprise Manager Cloud Control 12c Release 3
An introduction into Oracle Enterprise Manager Cloud Control 12c Release 3An introduction into Oracle Enterprise Manager Cloud Control 12c Release 3
An introduction into Oracle Enterprise Manager Cloud Control 12c Release 3Marco Gralike
 
An AMIS Overview of Oracle database 12c (12.1)
An AMIS Overview of Oracle database 12c (12.1)An AMIS Overview of Oracle database 12c (12.1)
An AMIS Overview of Oracle database 12c (12.1)Marco Gralike
 
Flexibiliteit & Snel Schakelen
Flexibiliteit & Snel SchakelenFlexibiliteit & Snel Schakelen
Flexibiliteit & Snel SchakelenMarco Gralike
 
BGOUG 2012 - Drag & drop and other stuff - Using your database as a file server
BGOUG 2012 - Drag & drop and other stuff - Using your database as a file serverBGOUG 2012 - Drag & drop and other stuff - Using your database as a file server
BGOUG 2012 - Drag & drop and other stuff - Using your database as a file serverMarco Gralike
 

Mais de Marco Gralike (11)

UKOUG2018 - I Know what you did Last Summer [in my Database].pptx
UKOUG2018 - I Know what you did Last Summer [in my Database].pptxUKOUG2018 - I Know what you did Last Summer [in my Database].pptx
UKOUG2018 - I Know what you did Last Summer [in my Database].pptx
 
eProseed Oracle Open World 2016 debrief - Oracle Management Cloud
eProseed Oracle Open World 2016 debrief - Oracle Management CloudeProseed Oracle Open World 2016 debrief - Oracle Management Cloud
eProseed Oracle Open World 2016 debrief - Oracle Management Cloud
 
eProseed Oracle Open World 2016 debrief - Oracle 12.2.0.1 Database
eProseed Oracle Open World 2016 debrief - Oracle 12.2.0.1 DatabaseeProseed Oracle Open World 2016 debrief - Oracle 12.2.0.1 Database
eProseed Oracle Open World 2016 debrief - Oracle 12.2.0.1 Database
 
Oracle Database - JSON and the In-Memory Database
Oracle Database - JSON and the In-Memory DatabaseOracle Database - JSON and the In-Memory Database
Oracle Database - JSON and the In-Memory Database
 
UKOUG Tech15 - Going Full Circle - Building a native JSON Database API
UKOUG Tech15 - Going Full Circle - Building a native JSON Database APIUKOUG Tech15 - Going Full Circle - Building a native JSON Database API
UKOUG Tech15 - Going Full Circle - Building a native JSON Database API
 
An introduction into Oracle VM V3.x
An introduction into Oracle VM V3.xAn introduction into Oracle VM V3.x
An introduction into Oracle VM V3.x
 
An introduction into Oracle Enterprise Manager Cloud Control 12c Release 3
An introduction into Oracle Enterprise Manager Cloud Control 12c Release 3An introduction into Oracle Enterprise Manager Cloud Control 12c Release 3
An introduction into Oracle Enterprise Manager Cloud Control 12c Release 3
 
An AMIS Overview of Oracle database 12c (12.1)
An AMIS Overview of Oracle database 12c (12.1)An AMIS Overview of Oracle database 12c (12.1)
An AMIS Overview of Oracle database 12c (12.1)
 
Flexibiliteit & Snel Schakelen
Flexibiliteit & Snel SchakelenFlexibiliteit & Snel Schakelen
Flexibiliteit & Snel Schakelen
 
BGOUG 2012 - Drag & drop and other stuff - Using your database as a file server
BGOUG 2012 - Drag & drop and other stuff - Using your database as a file serverBGOUG 2012 - Drag & drop and other stuff - Using your database as a file server
BGOUG 2012 - Drag & drop and other stuff - Using your database as a file server
 
Amis ACE
Amis ACEAmis ACE
Amis ACE
 

Último

DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningLars Bell
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxLoriGlavin3
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersRaghuram Pandurangan
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
unit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxunit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxBkGupta21
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxLoriGlavin3
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 

Último (20)

DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine Tuning
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptx
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information Developers
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
unit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxunit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptx
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 

BGOUG 2012 - XML Index Strategies

  • 1. XML Indexing Strategies Choosing the Right Index for the Right Job Marco Gralike
  • 2.
  • 3.
  • 4.
  • 5. Richard Foote (Mr. Index) • OakTable Member • ACE Director • Oracle Certified Professional • 22+ years DBA, etc. richardfoote.wordpress.com
  • 7. Structured or Semi-Structured or… Structured Semi Structured
  • 9. Document Driven / Data Driven
  • 10. XML Container (in memory or via storage) In Memory CLOB (document) (document) Object Relational Binary XML (data) (data)
  • 11. Design: Width and Height and … 3 1 4 2 5 X Y 6 Z Content Height : minOccurs="0" maxOccurs=“unbounded” Content Width : type="xs:string“, restriction…? Content Distribution : histogram, statistics, skew, cardinality ?
  • 12.
  • 13.
  • 14.
  • 15.
  • 16.
  • 17.
  • 18. XMLIndex Use Cases Binary XML Binary XML Mixed (Schema based) (Schema less, Schema based) XMLIndex XMLIndex Structured w/ Text Structured Component index Component
  • 19. Storage Models (xmltype) • CLOB – Default until 11.2.0.2.0 (deprecated in 12.1) – Non-Schema Based • Binary XML – Oracle 11 and Onwards – Schema and Non-Schema Based • Object Relational (+Hybrid) – Nested Tables, Types, Varray’s – Schema Based
  • 20. Querying XML Content in XML DB SQL/XML XQuery XMLType Abstraction DB XQuery Procedural XQuery XQuery Rewrite Pushdown XVM (use “no query rewrite”) Relational Streaming XPath DOM Tree Evaluation Model Access SQL Execution Methods XMLIndex Object-Relational Binary XML Relational Storage Secure Files Source: S317428: Building Really Scalable XML Applications with Oracle XML DB and Oracle Text
  • 22. Storage Index Defaults (xmltype) • Binary XML / CLOB – LOB Index • Object Relational – DBMS_XMLSCHEMA  “OPTIONS” – Oracle 10g: Index Organized Tables – Oracle 11g: B-Tree Indexes – xdb:annotations • Storage type  xdb:SQLType • Storage Type  xdb:ColumnProps / xdb:TableProps
  • 23. Index Methods (10.x) BTre BTre BT e eI Index bookstore Function based Index (XPath) book whitepaper title author author chapter title author id paragraph content content Oracle Text Index
  • 24. Function-Based Index • Deprecated in 11.2 • Object Relational XMLType Storage (can, but shouldn’t, on CLOB when hybrid) • Performance wise the lesser option… SQL> CREATE INDEX function_based_index ON xml_data_table (extractValue(OBJECT_VALUE, '/Root/TextID'));
  • 25. BTree / Bitmap Index • Structured XML Data – Ordered Collection Tables (OCT) – ComplexTypes… – “dot” notation using the “xmldata” pseudocolumn SQL> CREATE INDEX dot_notation_index ON xml_data_table ("XMLDATA". "TEXTID");
  • 26. Index Alternatives SQL> CREATE INDEX function_based_again_idx ON xml_data_table (CAST("XMLDATA". "TEXTID“ as VARCHAR2(10))); SQL> CREATE INDEX oracle_11_applicable_only_index ON xml_data_table xdt (XMLCast(XMLQuery ('$i/Root/TextID' PASSING xdt.OBJECT_VALUE as "i" RETURNING content) as VARCHAR2(10)));
  • 27. Oracle Text Index • Unstructured Data in XML – CLOB storage XML part in Object Relational XML – Secondary index on XMLIndex • Can only index XML data TEXT nodes (<12.1!) • Result Set Interface (new in 11.2.0.2) – Specify Query request and hit list requirements in XML SQL> CREATE INDEX oracle_text_index ON xml_data_table (OBJECT_VALUE) INDEXTYPE IS CTXSYS.CONTEXT;
  • 28. Index Methods (11.1) BTre BTre BT e eI Index bookstore Function based Index (XPath) book whitepaper title author author chapter title author id paragraph Unstructured XMLIndex content content Secondary Oracle Text Index
  • 29. Usage: Unstructured XMLIndex • XML Document contains: – Semi Structured Data and Structured Data – Supports searching and fragment extraction – When XPath queried is not known beforehand • XMLType CLOB or Binary XML content • If you use an XMLIndex and/or combine it with Structured XMLIndex(es)
  • 30. Simple: Unstructured XMLIndex SQL> CREATE INDEX xmlindex_idx ON “XMLTYPE_COLUMN"(xdata) INDEXTYPE IS XDB.XMLINDEX; Index created. SQL> CREATE INDEX xmlindex_idx ON “XMLTYPE_TABLE"(object_value) INDEXTYPE IS XDB.XMLINDEX; Index created.
  • 31. Creating Unstructured XMLIndex CREATE INDEX XMLIDX ON XMLBINARY_TAB (object_value) INDEXTYPE IS XDB.XMLIndex PARAMETERS ('PATHS (INCLUDE (/ROOT/ID /ROOT/INFO/INFO_ID ) NAMESPACE MAPPING (xmlns="http://localhost/xmlschema_bin.xsd") ) PATH TABLE path_table (TABLESPACE XML_DATA) PATH ID INDEX pathid_idx (TABLESPACE XML_INDX) ORDER KEY INDEX orderkey_idx (TABLESPACE XML_INDX) VALUE INDEX value_idx (TABLESPACE XML_INDX) ASYNC (SYNC ALWAYS) STALE (FALSE) ') PARALLEL LOGGING;
  • 33. Unstructured XMLIndex (UXI)  One Path Table  Use Path Subsetting  Full Blown XMLIndex can be BIG Unstructured  Token Tables (XDB.X$......) XMLIndex f (x)  Query re-write on Tokens  Fuzzy Searches, //  Optimizer Statistics  Can be maintained Manually  Recorded in Pending Table Path Table  Secondairy indexes possible
  • 34. Index Methods (11.2) BTre BTre BT e eI Index bookstore Function based Index (XPath) book whitepaper Structured XMLIndex title author author chapter title author id paragraph Unstructured XMLIndex content content Highly Structured Secondary Oracle Islands of Data Text Index
  • 35. Usage: Structured XMLIndex • With highly Structured Data • Likely candidates: ComplexTypes • Structured Islands of Data – Can be nested, but officially only one level – XMLTABLE “virtual” nested column hint • Will create (multiple) “Content Tables” – Multiple XPath defined same columns with different purpose They deliver relational performance…!
  • 36. Simple: Structured XMLIndex • “XMLTABLE” Driven Syntax SQL> CREATE INDEX xmlindex_sxi on xmldata_table (doc) indextype is xdb.xmlindex parameters ('GROUP elementinfo_group Be aware XMLTABLE xml_cnt_tab_elementinfo '' ' '/root/element' ' COLUMNS infocol VARCHAR2(4000) PATH ' 'info' ' ');
  • 37. Content Table(s) CONTENT TABLE(s) KEY INDEX Key RID YOUR  (KEY) Key Key RID RID YOUR YOUR column column column ss  Unique BTREE Index RAW rowid RAW rowid RAW rowid X X  Primary Key Not Not Not X null null null RID INDEX  (RID)  NON Unique BTREE Index Your Columns
  • 38. Structured XMLIndex (SXI) • Content Table(s) • Based on XMLTABLE syntax • XMLTable construct can be nested but: “Only ONE XMLType column allowed” Structured  VIRTUAL column XMLIndex f (x) • Can be maintained Manually • Secondairy indexes possible • LOCAL parameter (partitioning) Content Tables
  • 39. Adding Structured Indexes SQL> ALTER INDEX xmlindex_sxi parameters ('ADD_GROUP GROUP my_new_group XMLTABLE xml_content_tab_new ' '/root/extra' ' COLUMNS extracol VARCHAR2(35) PATH ' 'new_element' ' ');
  • 40. Mixed XMLIndex Options Unstructured bookstore XMLIndex book whitepaper title author author chapter title author id paragraph Structured Structured XMLIndex XMLIndex content content Secondary (text) Index
  • 41. Mixed XMLIndex structures CREATE INDEX xmlindex on TEST_RANGE_XML (doc) indextype is xdb.xmlindex PARAMETERS (' PATH TABLE path_table PATHS (EXCLUDE(/root/ElementInfo)) '); BEGIN DBMS_XMLINDEX.registerParameter ('StructuredXML', 'ADD_GROUP GROUP ElementInfo XMLTABLE xml_cnttable_valueinfo ' '/root/ElementInfo' ' COLUMNS ValueInfo VARCHAR2(100) PATH ' 'ValueInfo' '); END; / ALTER INDEX xmlindex PARAMETERS('PARAM StructuredXML');
  • 42. XMLIndex Maintenance • ALTER INDEX • XMLIndex Parameter Changes – DBMS_XMLINDEX.DROPPARAMETER – DBMS_XMLINDEX.MODIFYPARAMETER – DBMS_XMLINDEX.REGISTERPARAMETER • Manual Synchronizing an XMLIndex – DBMS_XMLINDEX.SYNCINDEX – Pending Tables
  • 43. “There Can Be Only One…”
  • 44. Syntax Awareness • SYNC=ALWAYS – Mandatory when Combined XMLIndex • SYNC=MANUAL – Locking • STALE=FALSE | TRUE – Hmmm… • Empty XMLIndex tables – OOPS  I got my “XMLTABLE” Syntax etc. “wrong”
  • 45. Notes on XMLIndex (1) • Only ONE XMLIndex is allowed per column of XMLType table – Add extra XMLIndex structures (structured or unstructured) via ADD_GROUP syntax – Only SYNC=ALWAYS is allowed while using mixed XML Index structures or add more than one (11g)
  • 46. Notes on XMLIndex (2) • You need the LOCAL parameter to create local partitioned XML Indexes • An XMLIndex on a HASH partitioned XMLType column or XMLType table, is not allowed (11g) – But you can create an Oracle Text Index on such structures
  • 47. Recap • True understanding of Storage and Index options will provide: – Optimal performance – Out perform XML (Java based) • A lot of choice: – Problems are Complex – Also provides Solutions • Good design beforehand is the path to success
  • 48.
  • 49. References (1) Oracle Whitepapers – Oracle XML DB : Choosing the Best XMLType Storage Option for Your Use Case (PDF) – Oracle XML DB : Best Practices to Get Optimal Performance out of XML Queries (PDF) Blog – www.xmldb.nl • (Dedicated XMLDB blog) • Semi-Structured XMLIndex section • Structured XMLIndex section
  • 50. References (2) • Oracle Open World Presentation on XML DB – S317428: Building Really Scalable XML Applications with Oracle XML DB and Oracle Text • XML DB OTN / FAQ Thread – http://forums.oracle.com/forums/forum.jspa?foru mID=34 – http://forums.oracle.com/forums/thread.jspa?thr eadID=410714

Notas do Editor

  1. It all comes down to packaging
  2. Definitions of Structured, Semi-Structured and Unstructured data
  3. Emp/Dept tables, Foreign/Primary Keys…Showing here ONLY 1 XML document…
  4. See also OOW 2010, S317428: Building Really Scalable XML Applications with Oracle XML DB and Oracle Text – Nipun Agarwal, Oracle