CSE 599c Hot Topics in Data Management Systems

Lecture 19: Structured and

Semi-Structured Data

Magdalena Balazinska

Winter 2006

Today's Paper

M. Nicola and B. Linden. Native XML Support in DB2 Universal Database. VLDB 2005.

Content of today's lecture also from

K. Beyer et al. System RX: One Part Relational, One Part XML. SIGMOD 2005.

S. Pal et. al. XQuery Implementation in a Relational Database System. VLDB 2005.

S. Pal et. al. Indexing XML Data Stored in a Relational Database. VLDB 2004.

Outline

Motivation

Why do we care about XML?

Why integrate relational data and XML data?

Why provide native XML support?

Integration Details

Storage

Indexing

Queries and updates

Why XML?

Current standard for exchanging data

Self-describing (app and vendor independance)

XML arguments must often persist (ex: auditing)

Appropriate for different types of data

Structured, semi-structured, & unstructured data

Hence useful for document management

Useful when structure of data is highly variable

Why Not Only XML?

Why need both relational data and XML?

A lot of data is in fact structured

Relational model enables high performance

Other benefits of integration

XML repository requires a lot of same infrastructure as a relational DBMS (ex: ACID)

Queries over both types of data simultaneously

Mapping XML to Relational Tables

XML documents often map to large nb tables

Data from many sources means many schemas

Ex: 1,500 eforms into 30,000 tables [beyer05]

Decomposition logic is complex

Re-assembly cost is high

Queries are complex

Expensive maintenance when schemas change

Storing XML Docs as LOBs

Works well for storing/retrieving full docs

But bad performance if

Need to apply predicates on XML documents

Would like to select only some elements

Need to parse XML during query execution

Providing Native XML Support

Storage

Indexing

Querying

XML Schemas

API

XML Storage in DB2

Figure 2 from

[nicola2005]

XML Storage in DB2

A single doc

3K to few GB

Docs stored in

binary format

Need efficient

Navigation

Inserts

Figure 5 from

[nicola2005]

XML Structural Index

Map node identifiers to node instances

For partitioning XML documents across pages

Map path expression to node instances

Example query: find books with author names

Not very frequently type of query

XML Value Index (DB2)

Index over values of elements and attributes

Use xmlpattern (XPath) to define index

Index on employee names

Index on employee id attributes

Index on all text nodes and all attributes

Typically index atomic nodes (leaves)

XML Value Index Implementation

Implemented with two B+ Trees

Tree 1: Path index

Each distinct reverse path to a PathID

Example of reverse path: id/employee/dept

Enables queries such as: //id (all id elements)

Tree 2: Value index

Data Entry: PathID, value, RowID, NodeID

Good for queries: /book/author/name

But not for queries: //name=”Maggie”

XML Indexing in SQL Server

Figures 1 and 2 from [pal2004]

ORDPATH node labels encode

parent/child

relative position

XML Indexing in SQL Server

Figures 3

from [pal2004]

XML Full Text Index
(DB2 and SQL Server)

Need to support full text search

Requires scoring and ranking features

Expensive, so maintained asynchronously

More about text search on Thursday

Querying XML data with XQuery

Figures 6 from [nicola2005]

Querying XML Data with SQL

Other Features

Schemas

Need flexibility

Same column but possibly different schemas

API

Add an XML object

Conclusion

Relational model is not enough

Efficient support for different types of data is a hard problem

Example XML

Could map onto relational tables

But need native support for performance

Requires significant changes and extensions

Makes engine more complex

2006-01-01T23:16:26