Oracle 11g Release (11.1) index The underlying data structure _oracle

Source: Internet
Author: User
Tags hash

This article content B-tree (B-tree) hashing (hash) k-d tree (k-d) dot four fork tree (Point Quadtree)

This article describes the structure of the Oracle index. Understand the data structure at the bottom of the Oracle index to better understand the performance of Oracle indexing for adding, deleting, changing, and checking.

B-Tree (B-tree)

Non-indexed structures can satisfy all requirements, but the self balanced B-tree indexing structure can better optimize the performance of retrieval on large datasets. Each B-tree node has multiple keys and pointers. The maximum number of keys in a node supported by a specific B-tree is the order of that tree. Each node has a potential order+1 pointer that points to a lower level node.

For example, as shown in Figure 1, the order=2 B-Tree has three pointers, point to: A child node that is smaller than its first key (the leftmost pointer), a child node that is larger than its first key, smaller than the second key (the middle pointer), and a child node that is larger than its second key (the rightmost pointer). Therefore, the B-tree algorithm minimizes the reading and writing required for the location record, by passing fewer nodes than the binary tree algorithm, the binary tree for each identified node, with a key and up to two child nodes (the structure of the binary tree is a key value, about two pointers, B-tree is the extension of the two fork tree). The following figure depicts the Knut transformation (Knuth Variation), whose index consists of two parts: a sequential set (Sequence set) that provides fast sequential access to data, and an index set (index set) that provides a direct access order set.

Although the B-tree nodes generally do not contain the same number of data values, and they usually contain a certain amount of unused space, the B-tree algorithm ensures that the tree remains balanced and the leaf node is at the same level.

Figure 1 B-Tree

Hash (hash)

Hashes quickly and directly access a particular stored record based on a given field value. The placement of each record is based on the same function, the function of some field fields of the record. Inserts and updates using the same function.

The problem with hashing is that the physical order of the records has no relation to their logical order. In addition, a hash can have a large number of unused areas on the disk.

Figure 2 Hash

k-d (k-d tree)

Data with two dimensions, such as longitude and latitude, can be effectively stored and retrieved by using the k-d tree transformation, called the 2-d tree.

In this structure, the data type of each node is the field information, two coordinates, and the left and right pointers to two child nodes.

Fig. 3 2-d Tree

This structure is beneficial to the range query. That is, if the user specifies a point (xx, XX) and a distance, then the query returns a collection of all points within the distance of the specified original point.

The 2-d tree is easy to implement. However, because a 2-d tree with K nodes has a K height, the inserts and queries are complex.

Dot Four fork tree (Point Quadtree)

The point four fork tree, shown in Figure 4, is also used to represent point data in a two-dimensional space, but these structures divide the region into four parts, and the 2-d tree is divided into two. The field of the node record type consists of the property information, which includes two coordinates and a azimuth point pointing to four subnodes, clockwise, such as Northwest NW, SW, NE, se.

Figure 4 Point Quadtree index structure

A four-fork tree is as easy to achieve as a 2-d tree. A four-fork tree that contains K nodes has a K height, and the inserts and queries are complex. Each comparison is required for at least two coordinates. In practice, however, the length from root to leaf is often shorter in the point four-forked tree.

Copy the Python code provided in the second link above to make appropriate changes. Because the Web page provides code that can only run in the lower version of Python. The version after Python 3 is a big difference from the previous. So, download the last source code for this article and run it in the Python 3.3 IDLE. will get the following output:

On Win32
-->
For more information.
-->
>>> ================================ Restart ================================
-->
-->
<?xml version= "1.0" encoding= "Iso-8859-1"?>
-->
Public "-//w3c//dtd SVG 1.1//en"
-->
"http://www.w3.org/graphics/svg/1.1/dtd/svg11.dtd" >
-->
<svg xmlns= "http://www.w3.org/2000/svg" version= "1.1" width= "400pt" height= "400pt" viewbox= "0 0 rpm" > 
-->
<g fill= "none" stroke= "Blue" >
-->
<line x1= "1" y1= "1" x2= "1" y2= "399"/>
-->
<line x1= "1" y1= "399" x2= "399" y2= "399"/>
-->
<line x1= "399" y1= "399" x2= "399" y2= "1"/>
-->
<line x1= "399" y1= "1" x2= "1" y2= "1"/>
-->
<line x1= "y1=" 1 "x2=" y2= "399"/>
-->
<line x1= "1" y1= "x2=" 399 "y2=" "/>"
-->
<line x1= "y1=" "1" x2= "y2="/>
-->
<line x1= "1" y1= "x2=" y2= "" "/>
-->
<line x1= "y1=" "1" x2= "y2=" "/>"
-->
......
-->

The result of the copy output, named. Svg,.html also, opens in the browser and renders the following image:

Figure 51 Point four fork Tree region of 8*8 size

Look at this picture, starting at the top left corner, clockwise. You can be as "as needed, whether the main point, constantly press 4 to split one of the squares."

Download Point Qudatree Python Demo

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.