multidim indexing operations
-
Upload
manishbhardwaj8131 -
Category
Documents
-
view
225 -
download
0
Transcript of multidim indexing operations
-
7/27/2019 multidim indexing operations
1/26
Jaruloj Chongstitvatana 2006
K-D-B Tree
1
K-D-B TreeMultidimensional Index
-
7/27/2019 multidim indexing operations
2/26
Jaruloj Chongstitvatana 2006 K-D-B Tree 2
CharacteristicsMulti-way branch
Height-balanced tree
Repeatedly divide area of the domaininto disjoint sub-area
A node in a tree corresponds to a (set
of consecutive) disk page(s)
-
7/27/2019 multidim indexing operations
3/26
Jaruloj Chongstitvatana 2006 K-D-B Tree 3
Example of Data RecordsTable (stdntID, courseID, grade, year, smstr)
Table (accID, branchID, saving, name, addr)
Table (custID, age, gender, occupation,
salary, children, promotion, since)
-
7/27/2019 multidim indexing operations
4/26
Jaruloj Chongstitvatana 2006 K-D-B Tree 4
Nodes = PagesRegion pages
Contain a set of
Internal nodesPoint pages
Contain a set of Leaf nodes
-
7/27/2019 multidim indexing operations
5/26
Jaruloj Chongstitvatana 2006 K-D-B Tree 5
Region PagesXmax XminYmaxYmin
PAGE
Xmax XminYmaxYmin
PAGERegionThe branching factor is determined by thepage size and the size of each entry.
-
7/27/2019 multidim indexing operations
6/26
Jaruloj Chongstitvatana 2006 K-D-B Tree 6
Point PagesX Y
DATA RECORD
X Y
DATA RECORD
X Y
DATA RECORD
POINTThe branching factor of a point page isusually larger than that of a region page.
-
7/27/2019 multidim indexing operations
7/26
Jaruloj Chongstitvatana 2006 K-D-B Tree 7
Example
Point page Point pagePoint pagePoint page
-
7/27/2019 multidim indexing operations
8/26
Jaruloj Chongstitvatana 2006 K-D-B Tree 8
Search
Point page Point pagePoint pagePoint page
Pointquery
-
7/27/2019 multidim indexing operations
9/26
Jaruloj Chongstitvatana 2006 K-D-B Tree 9
Insert
Insert a point here
and the point pageoverflows.
-
7/27/2019 multidim indexing operations
10/26
Jaruloj Chongstitvatana 2006 K-D-B Tree 10
Split Split a region rwith page idp alongxiIfris on the right/page ofxi then put in the
right/left page.
Otherwise;For each childrenpcofp , splitpcalongxi
Split ralongxi into rleftand rright.
Create 2 new pages with page idpleftandpright.Move children ofp in the left region intopleftandchildren in the right region intopright.
Return and .
-
7/27/2019 multidim indexing operations
11/26
Jaruloj Chongstitvatana 2006 K-D-B Tree 11
Split: ExampleThe page overflows, and is splitted.
This region is splitted.
This region is also splitted.
-
7/27/2019 multidim indexing operations
12/26
Jaruloj Chongstitvatana 2006 K-D-B Tree 12
Split: ExampleThe region page is splitted.
The point page is also splitted.
Create a new region page.Children pages are transferred.
-
7/27/2019 multidim indexing operations
13/26
Jaruloj Chongstitvatana 2006 K-D-B Tree 13
How to find split axis Cyclic: x -> y -> x -> y ->
Priority: x -> x -> y -> x -> x -> y ->
Possible one
-
7/27/2019 multidim indexing operations
14/26
Jaruloj Chongstitvatana 2006 K-D-B Tree 14
Insert Insert a record with point a and location lin a
tree with root r
Ifris NIL, then create a point pagep and insert therecord with inp and returnp.
Otherwise;
Search fora in the tree with root runtil a pointpage, sayp, is reached.
Insert the record in the point pagep.
-
7/27/2019 multidim indexing operations
15/26
Jaruloj Chongstitvatana 2006 K-D-B Tree 15
Insert (contd) Insert a record with point a and location lin a
tree with root r
If the point pagep is overflowed, then find anappropriate axis to splitp intopleftandpright.
Ifp is not the root, then change top and pleft, and
insertpright into the parent ofp.Ifp is the root, then create a new root node withtwo children ofpleftandpright.
-
7/27/2019 multidim indexing operations
16/26
Jaruloj Chongstitvatana 2006 K-D-B Tree 16
Insert: Example
Insert here and splitpoint page if overflows.Divide region.
Search for the given point
until the point page is found.
-
7/27/2019 multidim indexing operations
17/26
Jaruloj Chongstitvatana 2006 K-D-B Tree 17
Insert: ExampleParent page overflows,then split the page.
This region is splitted.
-
7/27/2019 multidim indexing operations
18/26
Jaruloj Chongstitvatana 2006 K-D-B Tree 18
Insert: ExampleThe point page is splitted.
The region page is splitted.
-
7/27/2019 multidim indexing operations
19/26
Jaruloj Chongstitvatana 2006 K-D-B Tree 19
Insert: ExampleInsert the new region page in its parent.
The root node is overflowed, and then splitted.
-
7/27/2019 multidim indexing operations
20/26
Jaruloj Chongstitvatana 2006 K-D-B Tree 20
Insert: ExampleCreate the new root node
-
7/27/2019 multidim indexing operations
21/26
Jaruloj Chongstitvatana 2006 K-D-B Tree 21
Delete Simple, if storage utilization is ignored.
Otherwise, an underfull page should be
merged with another page.
When 2 pages are merged, the region of
the new page must be a valid region.
A number of regions are joinable if theirunion is also a region.
-
7/27/2019 multidim indexing operations
22/26
Jaruloj Chongstitvatana 2006 K-D-B Tree 22
Joinable Regions
-
7/27/2019 multidim indexing operations
23/26
Jaruloj Chongstitvatana 2006 K-D-B Tree 23
Unjoinable Regions
-
7/27/2019 multidim indexing operations
24/26
Jaruloj Chongstitvatana 2006 K-D-B Tree 24
Delete (contd) If a pagep is underfull, merge sibling
pages ofp whose regions are joinable.
If the newly-created page is overflowed,
then split the page.
-
7/27/2019 multidim indexing operations
25/26
Jaruloj Chongstitvatana 2006 K-D-B Tree 25
Further Discussion
-
7/27/2019 multidim indexing operations
26/26
Jaruloj Chongstitvatana 2006 K-D-B Tree 26
Splitting CriteriaAxis
Cyclic
Priority
Shape ?
ValueArea
Number of data points
Ratio ?
Random ?
Combine the two decisions ?