In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-03 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
Why use a database
Many people will ask why software uses databases to store data. I remember that at that time, a friend who was doing Flash development said that once you do back-end development, you will want to use the database when it comes to storing data. In fact, files can be used to store data. There is some truth in what he says. So when you need to store data, when do you use files, and when do you use databases? Can the front-end storage data be solved using files? This article will answer these questions.
Advantages of relational database
The theory of relational database is based on Descartes' theory of relational mathematics, but in fact, most of the peers who use and maintain the database have little knowledge of relational mathematics, and unfortunately I am one of them. What I know is that the relational database designed based on the theory of relational mathematics can meet the requirements of reducing data redundancy (not absolute avoidance, which has certain benefits) and removing data inconsistency. This is the advantage that the mathematical theory of relational database brings to it, so learning some theoretical knowledge to arm the mind can improve the efficiency of software development, reduce the cost of operation and maintenance, and even create higher value.
The biggest difference between relational database and file storage data is not only this, but also that relational database can bring high performance. A relational database can support hundreds of processes to read and write data at the same time, while a file will be locked when there are multiple processes reading and writing data, and even bring data inconsistency. So how do relational databases ensure high performance and data consistency at the same time? This sentence is somewhat one-sided, in essence, there is a contradiction between the two indicators, there are many levels of data consistency: strong consistency, weak consistency, and final consistency, and the higher the consistency, the lower the performance. It depends on which indicator you pay more attention to when designing the system.
Because the database system runs many processes at the time of design, and divides the data file according to the block as the unit, and also divides the related data and index area in the memory by the block as the unit. When writing data, some databases write logs first and then return them to the program. The database decides whether to write the data back to disk based on the parameters configured by the administrator and the capacity of the memory-related area. With the cooperation of multiple processes, the database can ensure high performance and consistency. At the same time, the designers of the database system use structures such as B+ tree to index the data during storage, and when you query the data, the database applies the index as much as possible, so the data will be read more quickly. At the same time, the database will store hot data in faster storage as a cache (memory, solid-state system hard disk, etc.), which can also significantly improve efficiency.
As for how to adjust parameters to optimize the efficiency of MySQL data, it will be explained in several key parameters of the performance of the database (why the parameters are not set to take effect). )
Therefore, compared with file storage data, relational database has the advantages of high performance, consistency and so on. Compared with Nosql data, high performance of relational database does not count as its strength, consistency becomes the strength of relational database.
How to choose a storage system
If you make a single-person Flash system like my friend, you can consider storing data in files. According to my colleagues who do mobile software, they also choose files to store data when making mobile software. However, most developers who have studied the theory and design of relational databases choose another lightweight relational database when choosing a storage system: Sqlite. This kind of relational database syntax has good compatibility with mysql and can improve the programming quality and efficiency. Here, it is recommended that colleagues use Sqlite to develop mobile phone software and front-end software.
Written at the back.
When laptops first came out, many people said that desktops would disappear. Similarly, after the advent of Mongo, some people predicted that relational databases would be replaced. Diverse and colorful, lovely friends, don't you think?
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.