Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

OakTable World 2015 - Using XMLType content with the Oracle In-Memory Column Store

810 views

Published on

Presentation used during the OakTable World 2015 mini-conference in San Francisco (at Oracle OpenWorld 2015)

Published in: Technology
  • Be the first to comment

OakTable World 2015 - Using XMLType content with the Oracle In-Memory Column Store

  1. 1. Marco Gralike
  2. 2. Principal Consultant • eProseed, The Netherlands • Oracle 20+ years experience • Oracle ACE Director (www.xmldb.nl)
  3. 3. PERFORMANCE PERFORMANCE PERFORMANCE!
  4. 4. XML Should have been an in memory thingy,right?
  5. 5. Pre-order: F, B, A, D, C, E, G, I, H In-order: A, B, C, D, E, F, G, H, I Post-order: A, C, E, D, B, H, I, G, F Source Wikipedia
  6. 6. Level-order: F, B, G, A, D, I, C, E, H Source Wikipedia
  7. 7. *) DOM *) InfoSet Data(type) definitions
  8. 8. What do we use in the database…
  9. 9. VARCHAR NVARCHAR NUMBER INTEGER FLOAT DECIMAL CHAR VARCHAR2 NVARCHAR2 NCHAR VARYING VARCHAR DATE REAL DOUBLE PRECISION UNSIGNED BINARY INTEGER(8) UNSIGNED BINARY INTEGER(16) UNSIGNED BINARY INTEGER(32)SIGNED BINARY INTEGER(8)SIGNED BINARY INTEGER(16)SIGNED BINARY INTEGER(32)POINTER BINARY ROWID RAW CHAR BINARY_FLOAT BINARY FLOAT BINARY DOUBLE LONG RAW LONG UB2 LONG SB4 MLSLABEL XMLTYPE (TABLE or REF) BINARY_DOUBLE PL/SQL REF CURSOR UROWID KOKED1 KOTTBX KOTTB KOTMI KOTMD KOTADX KOTAD KOTTD KOKED REF CLOB BLOB BFILE TYPE (USER-DEFINED) TYPE (TABLE OF RECORD) TYPE (VARRAY) CFILE TIME TIME WITH TZ TIMESTAMP TIMESTAMP WITH TZ INTERVAL YEAR TO MONTH INTERVAL DAY TO SECOND NAMED COLLECTION NAMED OBJECT TIMESTAMP WITH LOCAL TZ OCTET SMALLINT VARYING ARRAY TABLE PL/SQL RECORD PL/SQL COLLECTION PL/SQL BOOLEAN OID CONTIGUOUS ARRAY CANONICALLOB POINTER PL/SQL POSITIVE PL/SQL POSITIVEN PL/SQL ROWID PL/SQL LONG PL/SQL LONG RAW PL/SQL BINARY INTEGER PL/SQL PLS INTEGER PL/SQL NATURAL PL/SQL NATURALN PL/SQL STRING...
  10. 10. Datatype moto If an incorrect datatype, you will have a decrease in performance or you get the incorrect results.... That is, if you are lucky... If unlucky, you will get results! :S
  11. 11. *) The In-Memory Maria Option
  12. 12. What can we do in XMLType land… (fast recap / intro)
  13. 13. Unstructured XMLIndex (11.1) Structured XMLIndex (11.2) Structured XMLIndex XML Text Index (12.1) paragraph book title author author whitepaper title author id content bookstore chapter content
  14. 14. Content Tables Structured XMLIndex (SXI)
  15. 15. CREATE INDEX LINEITEMS_XI ON PURCHASEORDER_T_BIN (XML_COLUMN) INDEXTYPE IS "XDB"."XMLINDEX" PARAMETERS (' GROUP LINEITEMS_GROUP XMLTABLE LINEITEM_SXI_T (INMEMORY MEMCOMPRESS FOR QUERY PRIORITY CRITICAL) ''/PurchaseOrder/LineItems/LineItem'' COLUMNS lineitem VARCHAR2(30) PATH ''@ItemNumber'', description VARCHAR2(100)PATH ''Part/@Description'', partid VARCHAR2(30) PATH ''Part'', unitprice VARCHAR2(30) PATH ''Part/@UnitPrice'', quantity VARCHAR2(30) PATH ''Quantity'' ');
  16. 16. XMLTABLE (SXI) +) INMEMORY MEMCOMPRESS FOR QUERY PRIORITY CRITICAL *) Results persistent in table *) Whatever I like!
  17. 17. Unstructured XMLIndex (11.1) Structured XMLIndex (11.2) IN MEMORY (Structured XMLIndex) XML Text Index (12.1) paragraph book title author author whitepaper title author id content bookstore chapter content
  18. 18. Parallelization XMLType  12.1
  19. 19. Setup
  20. 20. 10.000 45.263
  21. 21. In Memory / XML Storage Tests XMLType, CLOB – Securefile XMLType, Binary XML – Securefile Securefile Binary XML Securefile Binary XML (XSD) XMLType, Object Relational Object Relational (XSD – Default) Object Relational (XSD – Out of line XML)
  22. 22. SQL> alter table LINEITEMS_T inmemory memcompress for query priority critical; SQL> alter table PURCHASEORDER_T inmemory memcompress for query priority critical; SQL> create TABLE... inmemory memcompress for query priority critical; SQL> create INDEX ... INDEXTYPE IS "XDB"."XMLINDEX" inmemory memcompress for query priority critical;
  23. 23. In Memory / XML Index Tests Securefile Binary XML In Memory Structured Index Securefile Binary XML (XSD) In Memory Structured Index
  24. 24. In Memory / XML Statistics With Statistics Without Statistics (dynamic sample)
  25. 25. In Memory / XML Query’s “Arbitrary queries” Query 1 Touching PurchaseOrder and LineItems Query 2 Touching PurchaseOrder and LineItems & group/count Query 3 Touching LineItems elements and LineItems attributes only
  26. 26. Findings & Graphics…
  27. 27. SQL> SELECT * FROM XMLTABLE ('for $i in fn:collection("oradb:/IM/PURCHASEORDER_T”) /PurchaseOrder [ CostCenter = $CC and Requestor = $REQUESTOR and count(LineItems/LineItem) > $QUANTITY ]/Reference RETURN $i ' PASSING 'A60' as "CC" , 'Diana Lorentz' as "REQUESTOR" , 5 as "QUANTITY" );
  28. 28. COLUMN_VALUE ------------------------------------------------------- <Reference>DLORENTZ-20120411133920295PDT</Reference> <Reference>DLORENTZ-20120206180918983PST</Reference> <Reference>DLORENTZ-20121219144418724PST</Reference> <Reference>DLORENTZ-20120710194550792PDT</Reference> <Reference>DLORENTZ-20120723165626922PDT</Reference> <Reference>DLORENTZ-20120728151113368PDT</Reference> <Reference>DLORENTZ-20120602200119333PDT</Reference> <Reference>DLORENTZ-20120513165042874PDT</Reference> ... ...
  29. 29. XMLTYPE OR - Varray, Nested tables (default)
  30. 30. XMLTYPE OR - “Out of line”
  31. 31. *) Unoptimized XML construct detected Enable XMLOptimizationCheck for more information
  32. 32. *) Collection Iterator Pickler Fetch - “XML”SEQUENCEFROMXMLTYPE - “XQ”SEQUENCEFROMXMLTYPE
  33. 33. *) Tracing ORA-19022 SET XMLOptimizationCheck ON XVM Event = “19027 trace name context forever, level 0x2000” CBO Event = “10053 trace name context forever, level 1”
  34. 34. SQL> SELECT t1.Country , t2.Part , min(t2.Quantity) as quantity , count(*) as occurrence FROM PURCHASEORDER_T_X pt , XMLTABLE('/PurchaseOrder' PASSING pt.{xmltype} COLUMNS Country PATH 'ShippingInstructions/Address/country', x_lineitems XMLTYPE PATH 'LineItems/LineItem' ) t1 , XMLTABLE(’*' PASSING t1.x_lineitems COLUMNS Part PATH 'Part', Quantity PATH 'Quantity' ) t2 WHERE t1.Country is NOT NULL AND t1.Country = 'United Kingdom' HAVING count(*) >= 10 GROUP BY t1.Country, t2.Part ORDER BY t1.Country;
  35. 35. COUNTRY PART QUANTITY OCCURRENCE --------------- ------------ -------- ---------- United Kingdom 56775022792 1 11 United Kingdom 43396799493 1 10 United Kingdom 717951000866 1 10 United Kingdom 13023046696 1 11 United Kingdom 25192024825 1 10 5 rows selected.
  36. 36. SQL> SELECT lines.lineitem, lines.description, lines.partid, lines.unitprice, lines.quantity FROM purchaseorder_t pt, XMLTable ('/PurchaseOrder/LineItems/LineItem' PASSING xmltype_table_or_column COLUMNS lineitem PATH '@ItemNumber', description PATH 'Part/@Description', partid PATH 'Part', unitprice PATH 'Part/@UnitPrice', quantity PATH 'Quantity’ ) lines;
  37. 37. SQL> SELECT lines.lineitem, lines.description, lines.partid, lines.unitprice, lines.quantity FROM purchaseorder_t pt, XMLTable ('/PurchaseOrder/LineItems/LineItem' PASSING xmltype_table COLUMNS LINES_RNO FOR ORDINALITY, lineitem PATH '@ItemNumber', description PATH 'Part/@Description', partid PATH 'Part', unitprice PATH 'Part/@UnitPrice', quantity PATH 'Quantity’ ) lines;
  38. 38. Recap…
  39. 39. Recap… • In-Memory Column Store can achieve extra performance (design, design, design) • In-Memory Column Store can be applied selectively (columns!) • Some issues – Optimization possible – “RID” (for ordinality) – XML Costs table not yet on par (costs <> timings) • “Old rules-of-thumb” for XMLType still apply • DOM / XOM not “in-memory” optimized (yet?)
  40. 40. marco@gralike.com www.xmldb.nl Oracle XMLDB Forum

×