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.
Marco Gralike
Management Consultant 
• Ordina, The Netherlands 
• Oracle 20+ years experience 
• Oracle ACE Director (www.xmldb.nl)
What do we use in the 
database…
VARCHAR NVARCHAR NUMBER INTEGER FLOAT DECIMAL CHAR VARCHAR2 
NVARCHAR2 NCHAR VARYING VARCHAR DATE REAL DOUBLE PRECISION 
U...
Datatype moto: 
If incorrect datatype you will have a decrease in performance or 
you get the incorrect results ( if you ...
*) The In-Memory Maria Option
What can we do in XMLType 
land… (fast recap / intro)
Unstructured 
XMLIndex 
Structured 
XMLIndex 
Structured 
XMLIndex 
XML Text Index 
paragraph 
book 
title author author 
...
Unstructured 
XMLIndex 
f (x) 
Path Table
Structured 
XMLIndex 
f (x) 
Content 
Tables
CREATE INDEX LINEITEMS_XI 
ON PURCHASEORDER_T_BIN (XML_COLUMN) 
INDEXTYPE IS "XDB"."XMLINDEX" 
PARAMETERS (' GROUP LINEITE...
Unstructured 
XMLIndex 
Structured 
XMLIndex 
Structured 
XMLIndex 
XML Text Index 
paragraph 
book 
title author author 
...
Parallelization 
XMLType  12.1
Setup
10.000 
45263
In Memory / XML Storage Tests 
 CLOB – Securefile 
 XMLType – Securefile Binary XML 
 XMLType – Securefile Binary XML (...
SQL> alter table PURCHASEORDER_T 
inmemory memcompress for query priority critical; 
SQL> alter table LINEITEMS_T 
inmemor...
In Memory / XML Index Tests 
 Securefile Binary XML - In Memory Structured Index 
 Securefile Binary XML (XSD) – In Memo...
In Memory / XML Query’s 
“Arbitrary queries” 
 Query 1 - Touching PurchaseOrder and LineItems 
 Query 2 - Touching Purch...
Findings & Graphics…
SQL> SELECT * 
FROM XMLTABLE 
('for $i in fn:collection("oradb:/IM/PURCHASEORDER_T”) 
/PurchaseOrder[ CostCenter = $CC 
an...
COLUMN_VALUE 
------------------------------------------------------- 
<Reference>DLORENTZ-20120411133920295PDT</Reference...
varray, nested table (default)
out of line
*) Unoptimized XML construct 
detected 
(enable XMLOptimizationCheck for 
more information)
*) Collection Iterator Pickler Fetch 
XMLSEQUENCEFROMXMLTYPE 
XQSEQUENCEFROMXMLTYPE
*) Tracing ORA-19022 
SET XMLOptimizationCheck ON 
Event = “19027 trace name context forever, level 0x2000” 
Event = “1005...
SQL> SELECT t1.Country 
, t2.Part 
, min(t2.Quantity) as quantity 
, count(*) as occurrence 
FROM PURCHASEORDER_T_X pt 
, ...
COUNTRY PART QUANTITY OCCURRENCE 
--------------- ------------ -------- ---------- 
United Kingdom 56775022792 1 11 
Unite...
SQL> SELECT lines.lineitem, 
lines.description, 
lines.partid, 
lines.unitprice, 
lines.quantity 
FROM purchaseorder_t pt,...
LINEITEM DESCRIPTION PARTID UNITPRICE QTY 
-------- ------------------------------------------ ----------- --------- --- 
...
SQL> SELECT lines.lineitem, 
lines.description, 
lines.partid, 
lines.unitprice, 
lines.quantity 
FROM purchaseorder_t pt,...
Recap…
• In-Memory Column Store can achieve extra performance 
• In-Memory Column Store can be applied selectively (column) 
• Op...
UKOUG Tech14 - Using Database In-Memory Column Store with Complex Datatypes
UKOUG Tech14 - Using Database In-Memory Column Store with Complex Datatypes
UKOUG Tech14 - Using Database In-Memory Column Store with Complex Datatypes
UKOUG Tech14 - Using Database In-Memory Column Store with Complex Datatypes
UKOUG Tech14 - Using Database In-Memory Column Store with Complex Datatypes
UKOUG Tech14 - Using Database In-Memory Column Store with Complex Datatypes
UKOUG Tech14 - Using Database In-Memory Column Store with Complex Datatypes
UKOUG Tech14 - Using Database In-Memory Column Store with Complex Datatypes
UKOUG Tech14 - Using Database In-Memory Column Store with Complex Datatypes
UKOUG Tech14 - Using Database In-Memory Column Store with Complex Datatypes
UKOUG Tech14 - Using Database In-Memory Column Store with Complex Datatypes
UKOUG Tech14 - Using Database In-Memory Column Store with Complex Datatypes
UKOUG Tech14 - Using Database In-Memory Column Store with Complex Datatypes
UKOUG Tech14 - Using Database In-Memory Column Store with Complex Datatypes
UKOUG Tech14 - Using Database In-Memory Column Store with Complex Datatypes
UKOUG Tech14 - Using Database In-Memory Column Store with Complex Datatypes
UKOUG Tech14 - Using Database In-Memory Column Store with Complex Datatypes
UKOUG Tech14 - Using Database In-Memory Column Store with Complex Datatypes
UKOUG Tech14 - Using Database In-Memory Column Store with Complex Datatypes
UKOUG Tech14 - Using Database In-Memory Column Store with Complex Datatypes
UKOUG Tech14 - Using Database In-Memory Column Store with Complex Datatypes
UKOUG Tech14 - Using Database In-Memory Column Store with Complex Datatypes
UKOUG Tech14 - Using Database In-Memory Column Store with Complex Datatypes
UKOUG Tech14 - Using Database In-Memory Column Store with Complex Datatypes
UKOUG Tech14 - Using Database In-Memory Column Store with Complex Datatypes
UKOUG Tech14 - Using Database In-Memory Column Store with Complex Datatypes
Upcoming SlideShare
Loading in …5
×

UKOUG Tech14 - Using Database In-Memory Column Store with Complex Datatypes

976 views

Published on

Presentation used during the UKOUG Tech14 conference in Liverpool (UK) discussing possibilities of the use of the 12.1.0.2 In-Memory Column Store option with XMLType data type storage options common to the Oracle 12.1 database

Published in: Technology
  • Be the first to comment

  • Be the first to like this

UKOUG Tech14 - Using Database In-Memory Column Store with Complex Datatypes

  1. 1. Marco Gralike
  2. 2. Management Consultant • Ordina, The Netherlands • Oracle 20+ years experience • Oracle ACE Director (www.xmldb.nl)
  3. 3. What do we use in the database…
  4. 4. 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...
  5. 5. Datatype moto: If incorrect datatype you will have a decrease in performance or you get the incorrect results ( if you are lucky 8))...
  6. 6. *) The In-Memory Maria Option
  7. 7. What can we do in XMLType land… (fast recap / intro)
  8. 8. Unstructured XMLIndex Structured XMLIndex Structured XMLIndex XML Text Index paragraph book title author author whitepaper title author id content bookstore chapter content
  9. 9. Unstructured XMLIndex f (x) Path Table
  10. 10. Structured XMLIndex f (x) Content Tables
  11. 11. 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'' ');
  12. 12. Unstructured XMLIndex Structured XMLIndex Structured XMLIndex XML Text Index paragraph book title author author whitepaper title author id content bookstore chapter content
  13. 13. Parallelization XMLType  12.1
  14. 14. Setup
  15. 15. 10.000 45263
  16. 16. In Memory / XML Storage Tests  CLOB – Securefile  XMLType – Securefile Binary XML  XMLType – Securefile Binary XML (XSD)  XMLType – Object Relational (XSD – Default)  XMLType – Object Relational (XSD – Out of line XML)
  17. 17. SQL> alter table PURCHASEORDER_T inmemory memcompress for query priority critical; SQL> alter table LINEITEMS_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;
  18. 18. In Memory / XML Index Tests  Securefile Binary XML - In Memory Structured Index  Securefile Binary XML (XSD) – In Memory Structured Index  Object Relational (XSD – Default)  Object Relational (XSD – Out of line XML)
  19. 19. 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 attributes only
  20. 20. Findings & Graphics…
  21. 21. 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" );
  22. 22. 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> ... ...
  23. 23. varray, nested table (default)
  24. 24. out of line
  25. 25. *) Unoptimized XML construct detected (enable XMLOptimizationCheck for more information)
  26. 26. *) Collection Iterator Pickler Fetch XMLSEQUENCEFROMXMLTYPE XQSEQUENCEFROMXMLTYPE
  27. 27. *) Tracing ORA-19022 SET XMLOptimizationCheck ON Event = “19027 trace name context forever, level 0x2000” Event = “10053 trace name context forever, level 1”
  28. 28. 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;
  29. 29. 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.
  30. 30. 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;
  31. 31. LINEITEM DESCRIPTION PARTID UNITPRICE QTY -------- ------------------------------------------ ----------- --------- --- 2 The Longest Yard 97360870848 27,95 5 1 Babe / Babe- Pig In the City 25192141621 19,95 4 3 Down to You 71795100742 19,95 3 2 I Spy: Tag, You're It 14381983920 19,95 4 4 Dragon Fist 43396071711 19,95 3 1 Multiplicity 43396824492 19,95 9 4 Things You Can Tell Just By Looking At Her 27616859198 19,95 3 ... ... 45263 rows selected
  32. 32. 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 LINES_RNO FOR ORDINALITY, lineitem PATH '@ItemNumber', description PATH 'Part/@Description', partid PATH 'Part', unitprice PATH 'Part/@UnitPrice', quantity PATH 'Quantity’ ) lines;
  33. 33. Recap…
  34. 34. • In-Memory Column Store can achieve extra performance • In-Memory Column Store can be applied selectively (column) • Optimization possible – “RID” (for ordinality) • Optimizer XML Costs not yet on par (costs <> timings) • “Old rules-of-thumb” for XMLType still apply

×