I have read a lot of summaries about B-TREE on the Internet, b-tree, B-tree, B+ tree, B* tree (why does Emma still have 4? She is almost confused),
Some of them are really exciting and admirable, but they are all too long. A long paragraph of text is daunting. Let’s just make a simplified version of the summary, introduce it in a simple and mobile way, and talk about their differences.
1. B-tree
##Binary Tree is a binary tree. (The formulas for K, h, and n will not be discussed here. If you are interested, you can search it yourself..)
(1) All non-leaf nodesHave at most two sons(Left and Right);
(2)All node storageA keyword;
(3) The left pointer of a non-leaf node points to less than its key The subtree of a word, the right pointer points to the subtree larger than its keyword; (Simply put, the left side of is smaller than itself, and the right side is larger than itself)
## FigureB tree
#
#二.B-TreeBalance Binary Tree --AVL tree [The B here actually means balance~]
(1) The depth of the left subtree and right subtree of the root node differs at most by 1.(This ensures that it will not occur The extreme phenomenon on the right side of the picture above)
(2) The left subtree and right subtree of the root node are both a balanced binary tree .
(3) All nodes have storage Keywords;
No matter what the inserted sequence is, we can build a balanced binary tree through adjustments to ensure that the balance factor of each node in the binary tree will not be greater than 1, Ensures that the depth of the tree reaches the shallowest, so the number of comparisons will be fewer and the time complexity will be reduced
Figure B-Tree
#三.B+tree
The search of B+ is basically the same as that of B-tree. The difference is that B+ tree only hits the leaf node (B-tree can hit non-leaf nodes)(1) All keywords appear in the linked list of leaf nodes (dense index), and the keywords in the linked list happen to be ordered; ( Only the root node stores the keyword and the end of the tree has a value )
(2) Non-leaf nodes are equivalent to leaf nodes Index (sparse index), leaf nodes are equivalent to the data layer that stores (keyword) data. (Non-root node actually stores the index pointing to the root node)
(3 ) Because of the first two points, it is impossible to store data in non-leaf nodes. (The third difference between B-)
(4) The root node also has a chain pointer horizontally (it’s convenient to follow the clues quickly, but there is no such thing) Pointer, even if the next value is an adjacent neighbor, you have to run in a circle to get it)
Note that most of the index results we generally use, or the B-TREE structure we usually refer to, refer to the B+ structure~~Picture B+Tree## Four. B* tree
is the B+
tree Variants,(1)B+The non-root and non-leaf nodes of the tree add pointers to brothers; [Compare to item 4 of B+ above, in the non-root The node also adds a horizontal linked list]#Figure B * TreeB tree: binary tree,
##5. Summary:Each node Only one keyword is stored. If it is equal, it will hit. If it is smaller, it will go to the left node, if it is greater, it will go to the right node; (But the B-tree may lead to different structures after multiple insertions and deletions ), for this reason, a balanced binary tree is generated after adding the balancing algorithm, also known as B-tree
##B-tree: Based on the B-tree, plus the balancing algorithm and multi-path search tree,1. Each node stores M/ 2 to M keywords,2. Non-leaf nodes store child nodes pointing to the keyword range;3. All The keyword appears in the entire tree and only appears once,4. Both leaf nodes and non-leaf nodes can be hit (whether data is stored);
##B+ tree: Based on B-tree,1. Add a linked list pointer to the leaf node;
2. All keywords appear in leaf nodes,
3. Non-leaf nodes are used as indexes of leaf nodes;4. The B+ tree always hits the leaf node;
B* tree : Based on the B+ tree, the linked list pointer is also added to the non-leaf nodes, and the minimum utilization of the node is increased from 1 /2 increased to 2/3;
# Question: B* is more efficient, but why do you think b* trees are used less? ????Or where is it useful? ? Maybe I still see too little. . Children's shoes who know something can learn from each other, please give me some advice, thank you in advance~
Answer: I recently learned that there is a person named Reiser4’s file system seems to use this structure. Its author Hans Reiser, killed his wife because she made him cuckold and was imprisoned, which directly affected the progress of the project. . .
Introduction:Linux File System ReiserFS Author Hans Reiser was sentenced to 15 years in prison for murdering his wife. The development of ReiserFS has not stopped, although it has not yet been merged. Go to the Linux main branch. A small group of developers continues to work on the fourth version of ReiserFS (Reiser4 for short), and they released the new version last month. ##, supports Linux3.5.4 kernel. The above is the content of Mysql-index-BTree type [simplified]. For more related content, please pay attention to the PHP Chinese website (www.php.cn)!
#

Stored procedures are precompiled SQL statements in MySQL for improving performance and simplifying complex operations. 1. Improve performance: After the first compilation, subsequent calls do not need to be recompiled. 2. Improve security: Restrict data table access through permission control. 3. Simplify complex operations: combine multiple SQL statements to simplify application layer logic.

The working principle of MySQL query cache is to store the results of SELECT query, and when the same query is executed again, the cached results are directly returned. 1) Query cache improves database reading performance and finds cached results through hash values. 2) Simple configuration, set query_cache_type and query_cache_size in MySQL configuration file. 3) Use the SQL_NO_CACHE keyword to disable the cache of specific queries. 4) In high-frequency update environments, query cache may cause performance bottlenecks and needs to be optimized for use through monitoring and adjustment of parameters.

The reasons why MySQL is widely used in various projects include: 1. High performance and scalability, supporting multiple storage engines; 2. Easy to use and maintain, simple configuration and rich tools; 3. Rich ecosystem, attracting a large number of community and third-party tool support; 4. Cross-platform support, suitable for multiple operating systems.

The steps for upgrading MySQL database include: 1. Backup the database, 2. Stop the current MySQL service, 3. Install the new version of MySQL, 4. Start the new version of MySQL service, 5. Recover the database. Compatibility issues are required during the upgrade process, and advanced tools such as PerconaToolkit can be used for testing and optimization.

MySQL backup policies include logical backup, physical backup, incremental backup, replication-based backup, and cloud backup. 1. Logical backup uses mysqldump to export database structure and data, which is suitable for small databases and version migrations. 2. Physical backups are fast and comprehensive by copying data files, but require database consistency. 3. Incremental backup uses binary logging to record changes, which is suitable for large databases. 4. Replication-based backup reduces the impact on the production system by backing up from the server. 5. Cloud backups such as AmazonRDS provide automation solutions, but costs and control need to be considered. When selecting a policy, database size, downtime tolerance, recovery time, and recovery point goals should be considered.

MySQLclusteringenhancesdatabaserobustnessandscalabilitybydistributingdataacrossmultiplenodes.ItusestheNDBenginefordatareplicationandfaulttolerance,ensuringhighavailability.Setupinvolvesconfiguringmanagement,data,andSQLnodes,withcarefulmonitoringandpe

Optimizing database schema design in MySQL can improve performance through the following steps: 1. Index optimization: Create indexes on common query columns, balancing the overhead of query and inserting updates. 2. Table structure optimization: Reduce data redundancy through normalization or anti-normalization and improve access efficiency. 3. Data type selection: Use appropriate data types, such as INT instead of VARCHAR, to reduce storage space. 4. Partitioning and sub-table: For large data volumes, use partitioning and sub-table to disperse data to improve query and maintenance efficiency.

TooptimizeMySQLperformance,followthesesteps:1)Implementproperindexingtospeedupqueries,2)UseEXPLAINtoanalyzeandoptimizequeryperformance,3)Adjustserverconfigurationsettingslikeinnodb_buffer_pool_sizeandmax_connections,4)Usepartitioningforlargetablestoi


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool

EditPlus Chinese cracked version
Small size, syntax highlighting, does not support code prompt function

ZendStudio 13.5.1 Mac
Powerful PHP integrated development environment

Dreamweaver Mac version
Visual web development tools

MinGW - Minimalist GNU for Windows
This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.
