Title: Holistic Twig Joins on Indexed XML Documents 6
1Holistic Twig Joins on Indexed XML Documents 6
- by Haifeng Jiang, Wei Wang, Hongjun Lu, and
Jeffrey Xu Yu - Presented by Teddy Yap, Jr.
- CS267, April 14, 2004
2Outline of Presentation
- Looking Back
- Introduction and Motivation
- Background and Related Work
- The Generic Twig Join Algorithm
- The TSGeneric Algorithm
- A Performance Study
- Conclusions
3Outline of Presentation
- Looking Back
- Introduction and Motivation
- Background and Related Work
- The Generic Twig Join Algorithm
- The TSGeneric Algorithm
- A Performance Study
- Conclusions
4Looking Back
- 1 S. Al-Khalifa, H. V. Jagadish, N. Koudas, J.
M. Patel, D. Srivastava, and Y. Wu, Structural
Joins A Primitive for Efficient XML Query
Pattern Matching. Proc. ICDE Conf. 2002.
XML query pattern
Results
XML Database
5Looking Back (2)
6Looking Back (3)
7Looking Back (4)
8Looking Back (5)
9Looking Back (6)
10Looking Back (7)
11Looking Back (8)
- 3 S.-Y. Chien, Z. Vagena, D. Zhang, V. J.
Tsotras, and C. Zaniolo, Efficient Structural
Joins on Indexed XML Documents. Proc. of VLDB
Conf., 2002.
12Looking Back (9)
13Looking Back (10)
14Looking Back (11)
- 5 Haifeng Jiang, Hongjun Lu, Wei Wang, and Beng
Chin Ooi, XR-Tree Indexing XML Data for
Efficient Structural Joins. Proc. of ICDE
Conf., 2003.
15Looking Back (12)
16Looking Back (13)
- 2 Nicolas Bruno, Nick Koudas, and Divesh
Srivastava, Holistic Twig Joins Optimal XML
Pattern Matching. Proc. of ACM SIGMOD Conf.
2002.
17Looking Back (14)
18Outline of Presentation
- Looking Back
- Introduction and Motivation
- Background and Related Work
- The Generic Twig Join Algorithm
- The TSGeneric Algorithm
- A Performance Study
- Conclusions
19Introduction and Motivation
- XML emerging as a de facto standard for
information exchange over the Internet - XML documents modeled as ordered trees
- XML queries specify patterns of selection
predicates on multiple elements having some
structural relationships (parent-child,
ancestor-descendant)
20Introduction and Motivation (2)
- Sample XML query
- //section//paragraphfigure AND table
21Introduction and Motivation (3)
- Locating all occurrences of a twig pattern is a
core operation in XML query processing.
Decomposition Approach
section
section
paragraph
paragraph
paragraph
paragraph
figure
table
figure
table
22Introduction and Motivation (4)
- Disadvantage of the decomposition approach
Intermediate result sizes can get very large,
even when the input and the final result sizes
are much more manageable. - Solution Holistic twig join approach for
matching XML query twig patterns 2
23Introduction and Motivation (5)
- Motivation Although the proposed holistic twig
join algorithm 2 has been proven to be I/O and
CPU optimal in terms of input and output sizes
for twigs with only ancestor-descendant edges,
the potential benefit of skipping elements that
do not participate in the final twig match by
using available indices (e.g. B-trees, XR-trees)
is not fully explored.
24Introduction and Motivation (6)
- In a nutshell
- A generic algorithm TSGeneric which can utilize
available indices (e.g. XR-trees 5) on element
sets to quickly locate the first match for a sub
twig pattern thus skipping those edges that do
not comply with the desired structural
relationship (e.g. ancestor-descendant
relationship) with a structural join like
algorithm.
25Introduction and Motivation (7)
- Main issue
- Which edge to choose first so that more elements
without matches can be skipped? - Three edge-picking heuristics
- Top-down
- bottom-up
- Statistics-based
26Outline of Presentation
- Looking Back
- Introduction and Motivation
- Background and Related Work
- The Generic Twig Join Algorithm
- The TSGeneric Algorithm
- A Performance Study
- Conclusions
27Background and Related Work
- Data model and numbering scheme
28Background and Related Work (2)
- Corollary 1
- Given two elements ei and ej, if ei.start lt
ej.start and ei is not an ancestor of ej, then ei
will not be an ancestor of any element ex with
ex.start gt ej.start.
ei
ej
29Background and Related Work (3)
- Structural Joins
- A structural join is to find all occurrences of a
given structural relationship between two sets of
elements. - Algorithms
- MPMGJN 8
- ? ?/ ?A-Join 7
- Stack-Tree-Desc/Anc 1
- Index-based approaches 3, 4, 5
30Background and Related Work (4)
- Twig Pattern Matching
- Given a query twig pattern Q and an XML database
D, a match of Q in D is identified by a mapping
from nodes in Q to nodes in D, s.t. - query node predicates are satisfied by the
corresponding database nodes - the structural relationships between query nodes
are satisfied by the corresponding database nodes.
Answer (d1, d2, , dn)
31Background and Related Work (5)
- Related Work
- 2 Nicolas Bruno, Nick Koudas, and Divesh
Srivastava, Holistic Twig Joins Optimal XML
Pattern Matching. Proc. of ACM SIGMOD Conf.
2002.
32Outline of Presentation
- Looking Back
- Introduction and Motivation
- Background and Related Work
- The Generic Twig Join Algorithm
- The TSGeneric Algorithm
- A Performance Study
- Conclusions
33The Generic Twig Join Algorithm
- Preliminaries
- isRoot(q)
- isLeaf(q)
- children(q)
- parent(q)
- subtreeNodes(q)
34The Generic Twig Join Algorithm (2)
- Assumptions
- Each node in the query tree has an associated
data stream. - Every element in the data stream is already
encoded in the following region format (start,
end, level) and sorted on the start attribute. - 2 types of data structures for every node q ? T
cursor (Cq) and stack (Sq).
35The Generic Twig Join Algorithm (3)
36The Generic Twig Join Algorithm (4)
37The Generic Twig Join Algorithm (5)
Ca
a
a1, a2, a3, a4, a5, a6, a7
Cb
Sa
b1, b2, b3, b4, b5
b
Sc
Sb
Cc
c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12
c
38The Generic Twig Join Algorithm (6)
- Notation
- The cursor Cq is simply a pointer to some element
in the data stream for node q. - Methods and Attributes
- Cq -gt advance( ) move to next element
- Cq -gt start
- Cq -gt end
- Cq -gt level
39The Generic Twig Join Algorithm (7)
- Initial Configuration
- All stacks are empty.
- All cursors point to the first element of the
corresponding data stream.
40The Generic Twig Join Algorithm (8)
- Stack Sq
- Used to cache some elements before the cursor Cq
- Elements are strictly nested from bottom to top.
- Each element e in Sq has a pointer to the lowest
ancestor in Sparent(q). - Cached elements represent partial results than
can be extended further.
41The Generic Twig Join Algorithm (9)
42The Generic Twig Join Algorithm (10)
- Definition (Solution Extension)
- We say that a node q has a solution extension if
there is a solution for the sub query rooted at q
composed entirely of the cursor elements of the
query nodes in the sub query.
43The Generic Twig Join Algorithm (11)
- Implication
- If node q has a solution extension, since Cq is
the ancestor of all cursor elements in the sub
query tree nodes, Cq -gt start is smaller than all
cursor start values of query nodes in the subtree
q.
44The Generic Twig Join Algorithm (12)
45The Generic Twig Join Algorithm (13)
- getNext(q)
- Returns a query node qx in the subtree q
satisfying all the following - qx has a solution extension.
- if qx has siblings, Cqx -gt start lt Cqs -gt start
for all sibling qs of qx. - If qx ? q, Cparent(qx) -gt start gt Cqx -gt start.
46The Generic Twig Join Algorithm (14)
If q is a leaf, return q.
If q is not a leaf, determine if the children of
q has solution extension rooted at them,
else return descendant of q with
solution extension.
Determine descendant of q with minimum and
maximum start attribute. Advance cursor of q so
so that Cq -gt end gt Cnmax -gt start. If Cq -gt
start lt Cnmin -gt start return node q, else return
descendant nmin of q with minimum start attribute.
Corollary 1
47The Generic Twig Join Algorithm (15)
48The Generic Twig Join Algorithm (16)
getNext(root) ?
a
a1
a5
a7
a2
a4
a6
a3
b1
b2
b4
b5
b
b3
c1
c2
c4
c8
c11
c
c3
c5
c6
c7
c9
c10
c12
Data Streams and Cursors
Ca
Cb
Cc
a1, a2, a3, a4, a5, a6, a7
b1, b2, b3, b4, b5
c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12
49The Generic Twig Join Algorithm (16)
getNext(root) c
a
a1
a5
a7
a2
a4
a6
a3
b1
b2
b4
b5
b
b3
c1
c2
c4
c8
c11
c
c3
c5
c6
c7
c9
c10
c12
Data Streams and Cursors
Ca
Cb
Cc
a1, a2, a3, a4, a5, a6, a7
b1, b2, b3, b4, b5
c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12
50The Generic Twig Join Algorithm (17)
getNext(root) ?
a
a1
a5
a7
a2
a4
a6
a3
b1
b2
b4
b5
b
b3
c1
c2
c4
c8
c11
c
c3
c5
c6
c7
c9
c10
c12
Data Streams and Cursors
Ca
Cb
Cc
a1, a2, a3, a4, a5, a6, a7
b1, b2, b3, b4, b5
c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12
51The Generic Twig Join Algorithm (17)
getNext(root) c
a
a1
a5
a7
a2
a4
a6
a3
b1
b2
b4
b5
b
b3
c1
c2
c4
c8
c11
c
c3
c5
c6
c7
c9
c10
c12
Data Streams and Cursors
Ca
Cb
Cc
a1, a2, a3, a4, a5, a6, a7
b1, b2, b3, b4, b5
c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12
52The Generic Twig Join Algorithm (18)
getNext(root) ?
a
a1
a5
a7
a2
a4
a6
a3
b1
b2
b4
b5
b
b3
c1
c2
c4
c8
c11
c
c3
c5
c6
c7
c9
c10
c12
Data Streams and Cursors
Ca
Cb
Cc
a1, a2, a3, a4, a5, a6, a7
b1, b2, b3, b4, b5
c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12
53The Generic Twig Join Algorithm (18)
getNext(root) c
a
a1
a5
a7
a2
a4
a6
a3
b1
b2
b4
b5
b
b3
c1
c2
c4
c8
c11
c
c3
c5
c6
c7
c9
c10
c12
Data Streams and Cursors
Ca
Cb
Cc
a1, a2, a3, a4, a5, a6, a7
b1, b2, b3, b4, b5
c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12
54The Generic Twig Join Algorithm (19)
getNext(root) ?
a
a1
a5
a7
a2
a4
a6
a3
b1
b2
b4
b5
b
b3
c1
c2
c4
c8
c11
c
c3
c5
c6
c7
c9
c10
c12
Data Streams and Cursors
Ca
Cb
Cc
a1, a2, a3, a4, a5, a6, a7
b1, b2, b3, b4, b5
c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12
55The Generic Twig Join Algorithm (19)
getNext(root) c
a
a1
a5
a7
a2
a4
a6
a3
b1
b2
b4
b5
b
b3
c1
c2
c4
c8
c11
c
c3
c5
c6
c7
c9
c10
c12
Data Streams and Cursors
Ca
Cb
Cc
a1, a2, a3, a4, a5, a6, a7
b1, b2, b3, b4, b5
c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12
56The Generic Twig Join Algorithm (20)
getNext(root) ?
a
a1
a5
a7
a2
a4
a6
a3
b1
b2
b4
b5
b
b3
c1
c2
c4
c8
c11
c
c3
c5
c6
c7
c9
c10
c12
Data Streams and Cursors
Cb
Cc
a1, a2, a3, a4, a5, a6, a7
b1, b2, b3, b4, b5
c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12
57The Generic Twig Join Algorithm (20)
getNext(root) ?
a
a1
a5
a7
a2
a4
a6
a3
b1
b2
b4
b5
b
b3
c1
c2
c4
c8
c11
c
c3
c5
c6
c7
c9
c10
c12
Data Streams and Cursors
Ca
Cb
Cc
a1, a2, a3, a4, a5, a6, a7
b1, b2, b3, b4, b5
c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12
58The Generic Twig Join Algorithm (20)
getNext(root) ?
a
a1
a5
a7
a2
a4
a6
a3
b1
b2
b4
b5
b
b3
c1
c2
c4
c8
c11
c
c3
c5
c6
c7
c9
c10
c12
Data Streams and Cursors
Ca
Cb
Cc
a1, a2, a3, a4, a5, a6, a7
b1, b2, b3, b4, b5
c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12
59The Generic Twig Join Algorithm (20)
getNext(root) ?
a
a1
a5
a7
a2
a4
a6
a3
b1
b2
b4
b5
b
b3
c1
c2
c4
c8
c11
c
c3
c5
c6
c7
c9
c10
c12
Data Streams and Cursors
Ca
Cb
Cc
a1, a2, a3, a4, a5, a6, a7
b1, b2, b3, b4, b5
c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12
60The Generic Twig Join Algorithm (20)
getNext(root) b
a
a1
a5
a7
a2
a4
a6
a3
b1
b2
b4
b5
b
b3
c1
c2
c4
c8
c11
c
c3
c5
c6
c7
c9
c10
c12
Data Streams and Cursors
Ca
Cb
Cc
a1, a2, a3, a4, a5, a6, a7
b1, b2, b3, b4, b5
c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12
61The Generic Twig Join Algorithm (21)
62The Generic Twig Join Algorithm (22)
Get node q with solution extension.
63The Generic Twig Join Algorithm (22)
If node q is not a root node, pop all
elements that are not ancestor of Cq from its
parents stack.
64The Generic Twig Join Algorithm (22)
If node q is a root node or its parent stack is
not empty, pop all elements from Sq that are not
ancestors of Cq. If node q is not a leaf, push
the pair (Cq, top(Sparent(q))) onto stack Sq
where top(Sparent(q)) returns a pointer to the
top element in Sparent(q). Otherwise, output
path solutions.
65The Generic Twig Join Algorithm (22)
Advance cursor Cq so it points to the
next element in the data stream for node q.
66The Generic Twig Join Algorithm (22)
Merge all path solutions.
67The Generic Twig Join Algorithm (23)
getNext(root) ?
a1
a5
a7
a2
a4
a6
a3
b1
b2
b4
b5
b3
c1
c2
c4
c8
c11
c3
c5
c6
c7
c9
c10
c12
Ca
a1, a2, a3, a4, a5, a6, a7
Cb
Cc
b1, b2, b3, b4, b5
c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12
Sc
Sb
Sa
68The Generic Twig Join Algorithm (23)
getNext(root) b
a1
a5
a7
a2
a4
a6
a3
b1
b2
b4
b5
b3
c1
c2
c4
c8
c11
c3
c5
c6
c7
c9
c10
c12
Ca
a1, a2, a3, a4, a5, a6, a7
Cb
Cc
b1, b2, b3, b4, b5
c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12
Sc
Sb
Sa
69The Generic Twig Join Algorithm (24)
getNext(root) ?
a1
a5
a7
a2
a4
a6
a3
b1
b2
b4
b5
b3
c1
c2
c4
c8
c11
c3
c5
c6
c7
c9
c10
c12
Ca
a1, a2, a3, a4, a5, a6, a7
Cb
Cc
b1, b2, b3, b4, b5
c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12
Sc
Sb
Sa
70The Generic Twig Join Algorithm (24)
getNext(root) c
a1
a5
a7
a2
a4
a6
a3
b1
b2
b4
b5
b3
c1
c2
c4
c8
c11
c3
c5
c6
c7
c9
c10
c12
Ca
a1, a2, a3, a4, a5, a6, a7
Cb
Cc
b1, b2, b3, b4, b5
c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12
Sc
Sb
Sa
71The Generic Twig Join Algorithm (25)
getNext(root) ?
a1
a5
a7
a2
a4
a6
a3
b1
b2
b4
b5
b3
c1
c2
c4
c8
c11
c3
c5
c6
c7
c9
c10
c12
Ca
a1, a2, a3, a4, a5, a6, a7
Cb
Cc
b1, b2, b3, b4, b5
c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12
Sc
Sb
Sa
72The Generic Twig Join Algorithm (25)
getNext(root) b
a1
a5
a7
a2
a4
a6
a3
b1
b2
b4
b5
b3
c1
c2
c4
c8
c11
c3
c5
c6
c7
c9
c10
c12
Ca
a1, a2, a3, a4, a5, a6, a7
Cb
Cc
b1, b2, b3, b4, b5
c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12
Sc
Sb
Sa
73The Generic Twig Join Algorithm (26)
getNext(root) ?
a1
a5
a7
a2
a4
a6
a3
b1
b2
b4
b5
b3
c1
c2
c4
c8
c11
c3
c5
c6
c7
c9
c10
c12
Ca
a1, a2, a3, a4, a5, a6, a7
Cb
Cc
b1, b2, b3, b4, b5
c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12
Sc
Sb
Sa
74The Generic Twig Join Algorithm (26)
getNext(root) b
a1
a5
a7
a2
a4
a6
a3
b1
b2
b4
b5
b3
c1
c2
c4
c8
c11
c3
c5
c6
c7
c9
c10
c12
Ca
a1, a2, a3, a4, a5, a6, a7
Cb
Cc
b1, b2, b3, b4, b5
c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12
Sc
Sb
Sa
75The Generic Twig Join Algorithm (27)
getNext(root) ?
a1
a5
a7
a2
a4
a6
a3
b1
b2
b4
b5
b3
c1
c2
c4
c8
c11
c3
c5
c6
c7
c9
c10
c12
Ca
a1, a2, a3, a4, a5, a6, a7
Cb
Cc
b1, b2, b3, b4, b5
c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12
Sc
Sb
Sa
76The Generic Twig Join Algorithm (27)
getNext(root) c
a1
a5
a7
a2
a4
a6
a3
b1
b2
b4
b5
b3
c1
c2
c4
c8
c11
c3
c5
c6
c7
c9
c10
c12
Ca
a1, a2, a3, a4, a5, a6, a7
Cb
Cc
b1, b2, b3, b4, b5
c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12
Sc
Sb
Sa
77The Generic Twig Join Algorithm (28)
getNext(root) ?
a1
a5
a7
a2
a4
a6
a3
b1
b2
b4
b5
b3
c1
c2
c4
c8
c11
c3
c5
c6
c7
c9
c10
c12
Ca
a1, a2, a3, a4, a5, a6, a7
Cb
Cc
b1, b2, b3, b4, b5
c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12
Sc
Sb
Sa
78The Generic Twig Join Algorithm (28)
getNext(root) c
a1
a5
a7
a2
a4
a6
a3
b1
b2
b4
b5
b3
c1
c2
c4
c8
c11
c3
c5
c6
c7
c9
c10
c12
Ca
a1, a2, a3, a4, a5, a6, a7
Cb
Cc
b1, b2, b3, b4, b5
c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12
Sc
Sb
Sa
79The Generic Twig Join Algorithm (29)
getNext(root) ?
a1
a5
a7
a2
a4
a6
a3
b1
b2
b4
b5
b3
c1
c2
c4
c8
c11
c3
c5
c6
c7
c9
c10
c12
Ca
a1, a2, a3, a4, a5, a6, a7
Cb
Cc
b1, b2, b3, b4, b5
c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12
Sc
Sb
Sa
80The Generic Twig Join Algorithm (29)
getNext(root) c
a1
a5
a7
a2
a4
a6
a3
b1
b2
b4
b5
b3
c1
c2
c4
c8
c11
c3
c5
c6
c7
c9
c10
c12
Ca
a1, a2, a3, a4, a5, a6, a7
Cb
Cc
b1, b2, b3, b4, b5
c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12
Sc
Sb
Sa
81The Generic Twig Join Algorithm (30)
getNext(root) ?
a1
a5
a7
a2
a4
a6
a3
b1
b2
b4
b5
b3
c1
c2
c4
c8
c11
c3
c5
c6
c7
c9
c10
c12
Ca
a1, a2, a3, a4, a5, a6, a7
Cb
Cc
b1, b2, b3, b4, b5
c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12
Sc
Sb
Sa
82The Generic Twig Join Algorithm (30)
getNext(root) ?
a1
a5
a7
a2
a4
a6
a3
b1
b2
b4
b5
b3
c1
c2
c4
c8
c11
c3
c5
c6
c7
c9
c10
c12
Ca
a1, a2, a3, a4, a5, a6, a7
Cb
Cc
b1, b2, b3, b4, b5
c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12
Sc
Sb
Sa
83The Generic Twig Join Algorithm (30)
getNext(root) a
a1
a5
a7
a2
a4
a6
a3
b1
b2
b4
b5
b3
c1
c2
c4
c8
c11
c3
c5
c6
c7
c9
c10
c12
Ca
a1, a2, a3, a4, a5, a6, a7
Cb
Cc
b1, b2, b3, b4, b5
c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12
Sc
Sb
Sa
84The Generic Twig Join Algorithm (31)
getNext(root) ?
a1
a5
a7
a2
a4
a6
a3
b1
b2
b4
b5
b3
c1
c2
c4
c8
c11
c3
c5
c6
c7
c9
c10
c12
Ca
a1, a2, a3, a4, a5, a6, a7
Cb
Cc
a7
b1, b2, b3, b4, b5
c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12
Sc
Sb
Sa
85The Generic Twig Join Algorithm (31)
getNext(root) b
a1
a5
a7
a2
a4
a6
a3
b1
b2
b4
b5
b3
c1
c2
c4
c8
c11
c3
c5
c6
c7
c9
c10
c12
Ca
a1, a2, a3, a4, a5, a6, a7
Cb
Cc
a7
b1, b2, b3, b4, b5
c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12
Sc
Sb
Sa
86The Generic Twig Join Algorithm (32)
getNext(root) ?
a1
a5
a7
a2
a4
a6
a3
b1
b2
b4
b5
b3
c1
c2
c4
c8
c11
c3
c5
c6
c7
c9
c10
c12
Ca
a1, a2, a3, a4, a5, a6, a7
Cb
Cc
a7
b4
b1, b2, b3, b4, b5
c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12
Sc
Sb
Sa
87The Generic Twig Join Algorithm (32)
Output (a7, b4, c9)
getNext(root) c
a1
a5
a7
a2
a4
a6
a3
b1
b2
b4
b5
b3
c1
c2
c4
c8
c11
c3
c5
c6
c7
c9
c10
c12
Ca
a1, a2, a3, a4, a5, a6, a7
Cb
Cc
a7
b4
b1, b2, b3, b4, b5
c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12
Sc
Sb
Sa
88The Generic Twig Join Algorithm (33)
getNext(root) ?
a1
a5
a7
a2
a4
a6
a3
b1
b2
b4
b5
b3
c1
c2
c4
c8
c11
c3
c5
c6
c7
c9
c10
c12
Ca
a1, a2, a3, a4, a5, a6, a7
Cb
Cc
a7
b4
b1, b2, b3, b4, b5
c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12
Sc
Sb
Sa
89The Generic Twig Join Algorithm (33)
Output (a7, b4, c10)
getNext(root) c
a1
a5
a7
a2
a4
a6
a3
b1
b2
b4
b5
b3
c1
c2
c4
c8
c11
c3
c5
c6
c7
c9
c10
c12
Ca
a1, a2, a3, a4, a5, a6, a7
Cb
Cc
a7
b4
b1, b2, b3, b4, b5
c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12
Sc
Sb
Sa
90The Generic Twig Join Algorithm (34)
getNext(root) ?
a1
a5
a7
a2
a4
a6
a3
b1
b2
b4
b5
b3
c1
c2
c4
c8
c11
c3
c5
c6
c7
c9
c10
c12
Ca
a1, a2, a3, a4, a5, a6, a7
Cb
Cc
a7
b4
b1, b2, b3, b4, b5
c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12
Sc
Sb
Sa
91The Generic Twig Join Algorithm (34)
getNext(root) c
a1
a5
a7
a2
a4
a6
a3
b1
b2
b4
b5
b3
c1
c2
c4
c8
c11
c3
c5
c6
c7
c9
c10
c12
Ca
a1, a2, a3, a4, a5, a6, a7
Cb
Cc
a7
b1, b2, b3, b4, b5
c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12
Sc
Sb
Sa
92The Generic Twig Join Algorithm (35)
getNext(root) ?
a1
a5
a7
a2
a4
a6
a3
b1
b2
b4
b5
b3
c1
c2
c4
c8
c11
c3
c5
c6
c7
c9
c10
c12
Ca
a1, a2, a3, a4, a5, a6, a7
Cb
Cc
a7
b1, b2, b3, b4, b5
c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12
Sc
Sb
Sa
93The Generic Twig Join Algorithm (35)
getNext(root) b
a1
a5
a7
a2
a4
a6
a3
b1
b2
b4
b5
b3
c1
c2
c4
c8
c11
c3
c5
c6
c7
c9
c10
c12
Ca
a1, a2, a3, a4, a5, a6, a7
Cb
Cc
a7
b1, b2, b3, b4, b5
c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12
Sc
Sb
Sa
94The Generic Twig Join Algorithm (36)
getNext(root) ?
a1
a5
a7
a2
a4
a6
a3
b1
b2
b4
b5
b3
c1
c2
c4
c8
c11
c3
c5
c6
c7
c9
c10
c12
Ca
a1, a2, a3, a4, a5, a6, a7
Cb
Cc
a7
b5
b1, b2, b3, b4, b5
c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12
Sc
Sb
Sa
95The Generic Twig Join Algorithm (36)
Output (a7, b5, c12)
getNext(root) c
a1
a5
a7
a2
a4
a6
a3
b1
b2
b4
b5
b3
c1
c2
c4
c8
c11
c3
c5
c6
c7
c9
c10
c12
Ca
a1, a2, a3, a4, a5, a6, a7
Cb
Cc
a7
b5
b1, b2, b3, b4, b5
c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12
Sc
Sb
Sa
96The Generic Twig Join Algorithm (37)
a1
a5
a7
a2
a4
a6
a3
b1
b2
b4
b5
b3
c1
c2
c4
c8
c11
c3
c5
c6
c7
c9
c10
c12
Ca
a1, a2, a3, a4, a5, a6, a7
Cb
Cc
a7
b5
b1, b2, b3, b4, b5
c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12
Sc
Sb
Sa
97The Generic Twig Join Algorithm (38)
- TSGeneric
- Can we accelerate twig join processing in
TSGeneric by taking advantage of available
indices? - Answer Sure.
98The Generic Twig Join Algorithm (39)
- Two New Methods
- Cq -gt fwdBeyond(Cp) forwards Cq to the first
element e, such that e.start gt Cp -gt start. - Cq -gt fwdToAncestorOf(Cp) forwards the cursor to
the first ancestor of Cp and returns TRUE. If no
such ancestor exists, it stops at the first
element e, such that e.start gt Cp -gt start, and
returns FALSE.
99The Generic Twig Join Algorithm (40)
100The Generic Twig Join Algorithm (41)
If we find a common ancestor for all
child cursors, we return q otherwise, we
return the child node with minimum start value.
101The Generic Twig Join Algorithm (42)
getNextCursor(root) ?
a
a1
a5
a7
a2
a4
a6
a3
b1
b2
b4
b5
b
b3
c1
c2
c4
c8
c11
c
c3
c5
c6
c7
c9
c10
c12
Data Streams and Cursors
Ca
Cb
Cc
a1, a2, a3, a4, a5, a6, a7
b1, b2, b3, b4, b5
c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12
102The Generic Twig Join Algorithm (42)
getNextCursor(root) c
a
a1
a5
a7
a2
a4
a6
a3
b1
b2
b4
b5
b
b3
c1
c2
c4
c8
c11
c
c3
c5
c6
c7
c9
c10
c12
Data Streams and Cursors
Ca
Cb
Cc
a1, a2, a3, a4, a5, a6, a7
b1, b2, b3, b4, b5
c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12
103The Generic Twig Join Algorithm (43)
getNextCursor(root) ?
a
a1
a5
a7
a2
a4
a6
a3
b1
b2
b4
b5
b
b3
c1
c2
c4
c8
c11
c
c3
c5
c6
c7
c9
c10
c12
Data Streams and Cursors
Ca
Cb
Cc
a1, a2, a3, a4, a5, a6, a7
b1, b2, b3, b4, b5
c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12
104The Generic Twig Join Algorithm (43)
getNextCursor(root) c
a
a1
a5
a7
a2
a4
a6
a3
b1
b2
b4
b5
b
b3
c1
c2
c4
c8
c11
c
c3
c5
c6
c7
c9
c10
c12
Data Streams and Cursors
Ca
Cb
Cc
a1, a2, a3, a4, a5, a6, a7
b1, b2, b3, b4, b5
c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12
105The Generic Twig Join Algorithm (44)
getNextCursor(root) ?
a
a1
a5
a7
a2
a4
a6
a3
b1
b2
b4
b5
b
b3
c1
c2
c4
c8
c11
c
c3
c5
c6
c7
c9
c10
c12
Data Streams and Cursors
Ca
Cb
Cc
a1, a2, a3, a4, a5, a6, a7
b1, b2, b3, b4, b5
c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12
106The Generic Twig Join Algorithm (44)
getNextCursor(root) c
a
a1
a5
a7
a2
a4
a6
a3
b1
b2
b4
b5
b
b3
c1
c2
c4
c8
c11
c
c3
c5
c6
c7
c9
c10
c12
Data Streams and Cursors
Ca
Cb
Cc
a1, a2, a3, a4, a5, a6, a7
b1, b2, b3, b4, b5
c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12
107The Generic Twig Join Algorithm (45)
getNextCursor(root) ?
a
a1
a5
a7
a2
a4
a6
a3
b1
b2
b4
b5
b
b3
c1
c2
c4
c8
c11
c
c3
c5
c6
c7
c9
c10
c12
Data Streams and Cursors
Ca
Cb
Cc
a1, a2, a3, a4, a5, a6, a7
b1, b2, b3, b4, b5
c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12
108The Generic Twig Join Algorithm (45)
getNextCursor(root) c
a
a1
a5
a7
a2
a4
a6
a3
b1
b2
b4
b5
b
b3
c1
c2
c4
c8
c11
c
c3
c5
c6
c7
c9
c10
c12
Data Streams and Cursors
Ca
Cb
Cc
a1, a2, a3, a4, a5, a6, a7
b1, b2, b3, b4, b5
c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12
109The Generic Twig Join Algorithm (46)
getNextCursor(root) ?
a
a1
a5
a7
a2
a4
a6
a3
b1
b2
b4
b5
b
b3
c1
c2
c4
c8
c11
c
c3
c5
c6
c7
c9
c10
c12
Data Streams and Cursors
Cb
Cc
a1, a2, a3, a4, a5, a6, a7
b1, b2, b3, b4, b5
c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12
110The Generic Twig Join Algorithm (46)
getNextCursor(root) b
a
a1
a5
a7
a2
a4
a6
a3
b1
b2
b4
b5
b
b3
c1
c2
c4
c8
c11
c
c3
c5
c6
c7
c9
c10
c12
Data Streams and Cursors
Cb
Cc
a1, a2, a3, a4, a5, a6, a7
b1, b2, b3, b4, b5
c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12
111The Generic Twig Join Algorithm (47)
getNextCursor(root) ?
a
a1
a5
a7
a2
a4
a6
a3
b1
b2
b4
b5
b
b3
c1
c2
c4
c8
c11
c
c3
c5
c6
c7
c9
c10
c12
Data Streams and Cursors
Cb
Cc
a1, a2, a3, a4, a5, a6, a7
b1, b2, b3, b4, b5
c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12
112The Generic Twig Join Algorithm (47)
getNextCursor(root) c
a
a1
a5
a7
a2
a4
a6
a3
b1
b2
b4
b5
b
b3
c1
c2
c4
c8
c11
c
c3
c5
c6
c7
c9
c10
c12
Data Streams and Cursors
Cb
Cc
a1, a2, a3, a4, a5, a6, a7
b1, b2, b3, b4, b5
c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12
113The Generic Twig Join Algorithm (48)
getNextCursor(root) ?
a1
a5
a7
a2
a4
a6
a3
b1
b2
b4
b5
b3
c1
c2
c4
c8
c11
c3
c5
c6
c7
c9
c10
c12
Ca
a1, a2, a3, a4, a5, a6, a7
Cb
Cc
b1, b2, b3, b4, b5
c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12
Sc
Sb
Sa
114The Generic Twig Join Algorithm (48)
getNextCursor(root) b
a1
a5
a7
a2
a4
a6
a3
b1
b2
b4
b5
b3
c1
c2
c4
c8
c11
c3
c5
c6
c7
c9
c10
c12
Ca
a1, a2, a3, a4, a5, a6, a7
Cb
Cc
b1, b2, b3, b4, b5
c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12
Sc
Sb
Sa
115The Generic Twig Join Algorithm (49)
getNextCursor(root) ?
a1
a5
a7
a2
a4
a6
a3
b1
b2
b4
b5
b3
c1
c2
c4
c8
c11
c3
c5
c6
c7
c9
c10
c12
Ca
a1, a2, a3, a4, a5, a6, a7
Cb
Cc
b1, b2, b3, b4, b5
c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12
Sc
Sb
Sa
116The Generic Twig Join Algorithm (49)
getNextCursor(root) b
a1
a5
a7
a2
a4
a6
a3
b1
b2
b4
b5
b3
c1
c2
c4
c8
c11
c3
c5
c6
c7
c9
c10
c12
Ca
a1, a2, a3, a4, a5, a6, a7
Cb
Cc
b1, b2, b3, b4, b5
c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12
Sc
Sb
Sa
117The Generic Twig Join Algorithm (50)
getNextCursor(root) ?
a1
a5
a7
a2
a4
a6
a3
b1
b2
b4
b5
b3
c1
c2
c4
c8
c11
c3
c5
c6
c7
c9
c10
c12
Ca
a1, a2, a3, a4, a5, a6, a7
Cb
Cc
b1, b2, b3, b4, b5
c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12
Sc
Sb
Sa
118The Generic Twig Join Algorithm (50)
getNextCursor(root) c
a1
a5
a7
a2
a4
a6
a3
b1
b2
b4
b5
b3
c1
c2
c4
c8
c11
c3
c5
c6
c7
c9
c10
c12
Ca
a1, a2, a3, a4, a5, a6, a7
Cb
Cc
b1, b2, b3, b4, b5
c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12
Sc
Sb
Sa
119The Generic Twig Join Algorithm (51)
getNextCursor(root) ?
a1
a5
a7
a2
a4
a6
a3
b1
b2
b4
b5
b3
c1
c2
c4
c8
c11
c3
c5
c6
c7
c9
c10
c12
Ca
a1, a2, a3, a4, a5, a6, a7
Cb
Cc
b1, b2, b3, b4, b5
c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12
Sc
Sb
Sa
120The Generic Twig Join Algorithm (51)
getNextCursor(root) c
a1
a5
a7
a2
a4
a6
a3
b1
b2
b4
b5
b3
c1
c2
c4
c8
c11
c3
c5
c6
c7
c9
c10
c12
Ca
a1, a2, a3, a4, a5, a6, a7
Cb
Cc
b1, b2, b3, b4, b5
c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12
Sc
Sb
Sa
121The Generic Twig Join Algorithm (52)
getNextCursor(root) ?
a1
a5
a7
a2
a4
a6
a3
b1
b2
b4
b5
b3
c1
c2
c4
c8
c11
c3
c5
c6
c7
c9
c10
c12
Ca
a1, a2, a3, a4, a5, a6, a7
Cb
Cc
b1, b2, b3, b4, b5
c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12
Sc
Sb
Sa
122The Generic Twig Join Algorithm (52)
getNextCursor(root) c
a1
a5
a7
a2
a4
a6
a3
b1
b2
b4
b5
b3
c1
c2
c4
c8
c11
c3
c5
c6
c7
c9
c10
c12
Ca
a1, a2, a3, a4, a5, a6, a7
Cb
Cc
b1, b2, b3, b4, b5
c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12
Sc
Sb
Sa
123The Generic Twig Join Algorithm (53)
getNextCursor(root) ?
a1
a5
a7
a2
a4
a6
a3
b1
b2
b4
b5
b3
c1
c2
c4
c8
c11
c3
c5
c6
c7
c9
c10
c12
Ca
a1, a2, a3, a4, a5, a6, a7
Cb
Cc
b1, b2, b3, b4, b5
c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12
Sc
Sb
Sa
124The Generic Twig Join Algorithm (53)
getNextCursor(root) b
a1
a5
a7
a2
a4
a6
a3
b1
b2
b4
b5
b3
c1
c2