You are on page 1of 15

Creating a B+ Tree

_________________________________

CNGAHEKQMFWLTZDPRXYS

A C G N

B+ Trees 1
CNGAHEKQMFWLTZDPRXYS

A C G H N

B+ Trees 2
CNGAHEKQMFWLTZDPRXYS

A C E G H K N

B+ Trees 3
CNGAHEKQMFWLTZDPRXYS

G K

A C E G H K N Q

B+ Trees 4
CNGAHEKQMFWLTZDPRXYS

G K

A C E F G H K M N Q

B+ Trees 5
CNGAHEKQMFWLTZDPRXYS

G K N

A C E F G H K M N Q W

B+ Trees 6
CNGAHEKQMFWLTZDPRXYS

G K N

A C E F G H K L M N Q T W

B+ Trees 7
CNGAHEKQMFWLTZDPRXYS

G K N T

A C E F GH K L M N Q T W Z

B+ Trees 8
CNGAHEKQMFWLTZDPRXYS

G K N T

A C E F GH K L M N Q T W Z

D (Split node)
B+ Trees 9
CNGAHEKQMFWLTZDPRXYS
(Split node)

D G K N T

A C E F GH K L M N Q T W Z

B+ Trees 10
CNGAHEKQMFWLTZDPRXYS

D G N T

A C D E F GH K L M N Q T W Z

B+ Trees 11
CNGAHEKQMFWLTZDPRXYS

D G N T

A C DE F G H K L M N P QR T WX Z

B+ Trees 12
CNGAHEKQMFWLTZDPRXYS

Right Sub-Tree

N T X

K L M N P Q R T W X Y Z

B+ Trees 13
CNGAHEKQMFWLTZDPRXYS

Right Sub-Tree

N Q T X

K L M N P Q R S T W X Y Z

B+ Trees 14
Speed in B+ Tree Index
• In processing a query, we traverse a path from the root to
a leaf node. If there are K search key values in the file,
this path is no longer than log(n/2) K , where n is number of
links possible in any given node.
• This means that the path is not long, even in large files.
For a 4k byte disk block with a search-key size of 12
bytes and a disk pointer of 8 bytes, n is around 200. If n
=100, a look-up of 1 million search-key values may take
log50(1,000,000) = 4 nodes to be accessed. Since root is
in usually in the buffer, so typically it takes only 3 or fewer
disk reads.

B+ Trees 15

You might also like