Index Interpretation

First, what is the index?

Second, the index data structure?

Third, the index of species?

Fourth, the index of the advantages and disadvantages?

1. What is the index?

  In the end what is the index? When we say the database index always not open around this concept, we all have been using the index, the index in the end is what? You can contact with the operating system to speak with a deep talk about the index.

  Index is a special kind of look-up table, similar to a book catalog. In the operating system, the file is stored structure tree storage, which is a leaf node file, the path for the non-leaf nodes. Generally speaking, the absolute path is the access path from the root to the file. When you create a file consists of two parts, the file system will allocate storage space to create, in addition, the system also assigns a node i to the file, which is stored in the file name and file location, so when you create a document, in fact, that file + i node. i-node is the index of the file. That's why when creating a file, a folder with the file name must be unique, because the name is the primary key.

  , The tree structure is stored in a node below the index i, corresponding to the index file, which is why the use of the index will increase the time overhead and space overhead. Because when adding files, except to save the file, but also on the index tree maintenance.

   To quote explanation of others, if we execute a SQL statement: select * from table where id = 1256; first locate the index to 1256 This leaf node value is located, and then through the leaf nodes get to the id equal to the data line 1256 . Not here to explain the details of running a balanced tree, but can be seen from the figure, a total of three tree from root to leaf nodes only need to be able to get the results look after three. As shown below

Second, the index data structure

  Index generally use a balanced tree data structure, that is, b tree or b + tree, the important thing to say three times: "balanced tree, balanced tree, balanced tree." In addition, some database also use data structures hash bucket effect index.

Third, the type index

(1) general index: This is the most basic index, it does not have any restrictions.

(2) unique index: it is similar to the foregoing general index, it is different: the value of the index columns must be unique, but allow nulls. If it is a combination of the index, the column value must be unique.

(3) primary key index: it is a special unique index, does not allow nulls.

(4) composite index: you can have multiple columns.

(5) full-text index

Fourth, the index of the advantages and disadvantages

  advantage:

  1, increasing the speed of data retrieval

  2, all of the data does not need to traverse

  Disadvantages:

  1, slow down the speed of data entry

  2, increase the storage overhead

 

Guess you like

Origin www.cnblogs.com/wobushangwangl/p/11412763.html