SlideShare una empresa de 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

Más contenido relacionado

La actualidad más candente

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
 

La actualidad más candente (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
 

Similar 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
 

Similar 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 -
 

Más 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
 

Más 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

Emixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentEmixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentPim van der Noll
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxLoriGlavin3
 
Scale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterScale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterMydbops
 
UiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPathCommunity
 
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
 
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotes
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotesMuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotes
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotesManik S Magar
 
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...Wes McKinney
 
Generative AI - Gitex v1Generative AI - Gitex v1.pptx
Generative AI - Gitex v1Generative AI - Gitex v1.pptxGenerative AI - Gitex v1Generative AI - Gitex v1.pptx
Generative AI - Gitex v1Generative AI - Gitex v1.pptxfnnc6jmgwh
 
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical InfrastructureVarsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructureitnewsafrica
 
Generative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfGenerative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfIngrid Airi González
 
Potential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsPotential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsRavi Sanghani
 
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
 
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...Nikki Chapple
 
Zeshan Sattar- Assessing the skill requirements and industry expectations for...
Zeshan Sattar- Assessing the skill requirements and industry expectations for...Zeshan Sattar- Assessing the skill requirements and industry expectations for...
Zeshan Sattar- Assessing the skill requirements and industry expectations for...itnewsafrica
 
A Framework for Development in the AI Age
A Framework for Development in the AI AgeA Framework for Development in the AI Age
A Framework for Development in the AI AgeCprime
 
Connecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfConnecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfNeo4j
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfLoriGlavin3
 
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better StrongerModern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better Strongerpanagenda
 

Último (20)

Emixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentEmixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
 
Scale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterScale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL Router
 
UiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to Hero
 
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
 
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotes
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotesMuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotes
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotes
 
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
 
Generative AI - Gitex v1Generative AI - Gitex v1.pptx
Generative AI - Gitex v1Generative AI - Gitex v1.pptxGenerative AI - Gitex v1Generative AI - Gitex v1.pptx
Generative AI - Gitex v1Generative AI - Gitex v1.pptx
 
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical InfrastructureVarsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
 
Generative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfGenerative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdf
 
Potential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsPotential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and Insights
 
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
 
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
 
Zeshan Sattar- Assessing the skill requirements and industry expectations for...
Zeshan Sattar- Assessing the skill requirements and industry expectations for...Zeshan Sattar- Assessing the skill requirements and industry expectations for...
Zeshan Sattar- Assessing the skill requirements and industry expectations for...
 
A Framework for Development in the AI Age
A Framework for Development in the AI AgeA Framework for Development in the AI Age
A Framework for Development in the AI Age
 
Connecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfConnecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdf
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdf
 
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better StrongerModern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
 

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 del 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