In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article introduces the relevant knowledge of "what is the reason why the database index uses B-tree and B + tree". In the operation of actual cases, many people will encounter such a dilemma. Next, let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!
Let's start by throwing a question:
(1) the method of storing database files
Database files are stored in the system as disk files, which is the reason why the database can store data persistently.
(2) the principle of reading data from database
Reading data from the database, not considering the situation of reading data from the cache, that is, reading data from disk files, we know that reading data from disk files is more time-consuming, and the time of select operation of the database depends on the number of times of performing disk IO, so minimizing disk IO can significantly improve the query speed of data.
(3) reduce the influencing factors of disk IO operation.
What factors can reduce disk IO? you must first take a look at disk IO and pre-read.
Disk IO and pre-read
Disk reading depends on mechanical motion, which is divided into three parts: seek time, rotation delay and transmission time. The sum of these three parts is the time of a disk IO, about 9ms. This cost is about 100, 000 times that of accessing memory; it is precisely because disk IO is a very expensive operation that the computer operating system optimizes it: read ahead; with each IO, not only the data from the current disk address is loaded into memory, but also adjacent data is loaded into the memory buffer.
Because the principle of local pre-reading states that when you access an address data, the data adjacent to it will soon be accessed. Each time the disk IO reads data, we call it a page. The size of a page is related to the operating system, usually 4k or 8k. This means that when reading data within a page, a disk IO actually occurs.
It is because of the disk IO pre-read mechanism that it is possible to reduce disk IO, because a disk IO operation can find a large piece of data adjacent to physical storage.
Take the index as a B+ tree as an example:
There is a relationship between the number of disk IO and the number of index data structure queries, as well as disk IO and pre-read, specific relationship: disk IO times
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.