This time I will bring you a summary of some MySQL traps. What are the precautions when using MySQL? The following is a practical case, let's take a look.
MysqlInstallation is simple, fast and feature-rich. In addition, it is also a benchmark for the open source movement. Its great achievements show us that a successful company can be built on open source code.
However, everyone who has used MySQL has waved their fists at the monitor. But you can't invent a technology that can save thousands of rows of Internet data per second without any errors.
To get excited this summer, we list 8 reasons to complain about open source relational databases. The reasons listed below are not limited to MySQL, some are specific to relational databases. If we don't figure out relational databases and MySQL, we will always be stuck in the thinking of the 1990s. We need to tear these down and then rebuild them. Or we turn to a recently popular database that hasn't been around long enough to justify a bunch of reasons like the one below.
1. Deep-rooted bugs
Any large software package has bugs. But if you dig a little deeper, you will find that the bugs related to Mysql are self-contained. Suddenly you need to pay attention, because NULL doesn't appear the same way, foreign key constraints don't perform the way you think, and even primary key auto-increment goes wrong.
Small problems abound and aren't always fixable, which is why some people keep a list. Fortunately, MySQL maintains a very good bug reporting system, so that we can know things we can't imagine and know that others are going through the same ordeal.
2. Inflexibility of relational tables
Relationship tables are organized, and organization is good - but it forces programmers to make up or force Stuff some data into a column with a defined schema. One of the reasons why NoSQL is becoming more and more popular is that it provides programmers with enough flexibility to speed up the use of databases. If a street address needs an extra row, you can easily insert it into a NoSQL document. If you want to add a complete new block of data, no matter what it contains, the document model can also accept your data unchanged without having to change it to the data format it requires.
Imagine that you create a table with all zip codes in integer format. This table is very efficient and the rules it enforces are very good. Suddenly, someone uploaded a nine-digit zip code that used hyphens. Or maybe, you get a letter from a customer in Canada with a postal code on it.
At this time, everything was in chaos. The boss demands that the website be back up and running within a few hours. However, there is no time to rebuild the database. What can programmers do? Perhaps, hackers can be used to change the Canadian postal code from base64 digital format to base 10 format? Or set up an auxiliary table that uses escape codes to indicate the real zip code or other? Who knows? There are hackers everywhere and they are dangerous. But you don’t have time to figure it out.
MySQL's association rules keep everyone honest and cautious, but they force us to avoid the trouble of being vulnerable and cheating.
3. JOINJoint query
Once upon a time, saving data in separate tables was a great innovation in the history of computer science. The separated table not only has a simple structure, but also simplifies use. But it requires using join statement for query.
SQL's complex queries built through a series of joins push developers into the abyss of confusion and despair. Moreover, the storage engine also needs to efficiently parse the join statement in an optimal way. Developers need to rack their brains to write query statements, and then the database parses them.
This is why many developers who focus on running speed abandon data sub-tables and use non-standard data tables instead. Do not differentiate between data entities and save all data into one large table - to avoid complex queries. This is really fast and the server doesn't run out of memory.
Disk space is cheap nowadays. 8TB disks are already on sale, and larger ones are coming soon. We no longer need to rack our brains to use join.
4. Branch confusion
Yes, a reliable, well-supported MySQL fork can bring competition and choice, but it can also cause confusion and confusion. To make matters worse, there is a fork of MySQL called MariaDB, maintained by Monty Widenius. He is also involved in writing MySQL. So, is MariaDB truly independent and worthy of our support? Or is it MySQL? Should we stick with core code operated by the organization that created the original MySQL database? Or should we join in the often-cool defectors who are considered smarter?
Also, how should we obtain information about compatibility? On the one hand, we are convinced that MariaDB and MySQL are very similar. On the other hand, we have to believe there is a difference - otherwise why is everyone arguing about it? Maybe they work the same way in both camps, in terms of performance and the scope of our query? But maybe they are different - or will be different in the future.
5. Storage engine confusion
MySQL is not actually the same database; it is composed of several databases, and most of their details are covered by a unified surface. cover. In the beginning, there was a MyISAM engine, which was fast but not complete in terms of consistency. Sometimes it's good when you need speed and can accept inconsistent results.
When people needed more, InnoDB with complete transaction support appeared. But this is not enough. Now, it may have 20 storage engine choices - enough to drive a database administrator crazy. Of course, there are times when it's nice to switch between different storage engines without having to rewrite your SQL, but there will always be chaos after switching. Should I choose MyISAM or innoDB as the engine for this table? Alternatively, will the data I decide to output be in CSV format?
6. Profit Motive
Although MySQL is a successful open source product, it is still a business full of professionals who rely on it to get paid Developer. While most users continue to enjoy the best experience brought by open source licenses, there is no doubt that this company is still struggling to make enough money to maintain operations. This leads to a strange bifurcation of free code between "community editions" and full products sold to enterprises.
Should you pay? How much money do you make here? Is it fair to operate on a community version? Are the extra features in the enterprise version just a gimmick to lure us into paying more? This at least shows that it is another set of questions that need to be answered. Which version to choose? Under which license? Which feature set should I use?
7. Lack of native JSON support
The best way to see the age of MySQL is to install it, and then you will realize that you need to add more drivers to make it It's available. MySQL usually communicates on port 3306, and it typically outputs formatted data that it has difficulty understanding. If you want your code to talk to it, you have to add another layer of code that translates the language of MySQL into something useful. The code for these layers is distributed as a library, often requiring people to purchase a commercial license.
Modern data storage layers often communicate directly in JSON. While MySQL and MariaDB now have the ability to parse the JSON part of SQL, this is far from good enough, and the native JSON interface is already widely used in CouchDB, MongoDB, or any of the latest tools.
8. The rise of closed source and proprietary modules
Did I mention MySQL is open source? It is, except for some newer, non-open source code and proprietary modules developed around the "open source core". Programmers need to eat, and Oracle needs to exchange the fruits of its hard work for money. This is one of the realities of business. It's not like those hospitals where you get free medical care using MySQL. It's not like those farmers who use MySQL to give away food.
It's a bit unfair to require MySQL to always hold itself to a very high standard, because open source success can be a trap. That's just because it can be free to begin with, but that doesn't mean it can always be that way. If businesses want many new features, they will have to pay for them one way or another. Sometimes it's cheaper to pay Oracle than to write the code yourself. Sometimes commercial, non-open source code makes sense. The facts speak for themselves.
I believe you have mastered the method after reading the case in this article. For more exciting information, please pay attention to other related articles on the php Chinese website!
Recommended reading:
JS gets the value in the first element in the select drop-down box
How to deal with failure to install Electron
The above is the detailed content of Summarize some MySQL pitfalls. For more information, please follow other related articles on the PHP Chinese website!

InnoDBBufferPool reduces disk I/O by caching data and indexing pages, improving database performance. Its working principle includes: 1. Data reading: Read data from BufferPool; 2. Data writing: After modifying the data, write to BufferPool and refresh it to disk regularly; 3. Cache management: Use the LRU algorithm to manage cache pages; 4. Reading mechanism: Load adjacent data pages in advance. By sizing the BufferPool and using multiple instances, database performance can be optimized.

Compared with other programming languages, MySQL is mainly used to store and manage data, while other languages such as Python, Java, and C are used for logical processing and application development. MySQL is known for its high performance, scalability and cross-platform support, suitable for data management needs, while other languages have advantages in their respective fields such as data analytics, enterprise applications, and system programming.

MySQL is worth learning because it is a powerful open source database management system suitable for data storage, management and analysis. 1) MySQL is a relational database that uses SQL to operate data and is suitable for structured data management. 2) The SQL language is the key to interacting with MySQL and supports CRUD operations. 3) The working principle of MySQL includes client/server architecture, storage engine and query optimizer. 4) Basic usage includes creating databases and tables, and advanced usage involves joining tables using JOIN. 5) Common errors include syntax errors and permission issues, and debugging skills include checking syntax and using EXPLAIN commands. 6) Performance optimization involves the use of indexes, optimization of SQL statements and regular maintenance of databases.

MySQL is suitable for beginners to learn database skills. 1. Install MySQL server and client tools. 2. Understand basic SQL queries, such as SELECT. 3. Master data operations: create tables, insert, update, and delete data. 4. Learn advanced skills: subquery and window functions. 5. Debugging and optimization: Check syntax, use indexes, avoid SELECT*, and use LIMIT.

MySQL efficiently manages structured data through table structure and SQL query, and implements inter-table relationships through foreign keys. 1. Define the data format and type when creating a table. 2. Use foreign keys to establish relationships between tables. 3. Improve performance through indexing and query optimization. 4. Regularly backup and monitor databases to ensure data security and performance optimization.

MySQL is an open source relational database management system that is widely used in Web development. Its key features include: 1. Supports multiple storage engines, such as InnoDB and MyISAM, suitable for different scenarios; 2. Provides master-slave replication functions to facilitate load balancing and data backup; 3. Improve query efficiency through query optimization and index use.

SQL is used to interact with MySQL database to realize data addition, deletion, modification, inspection and database design. 1) SQL performs data operations through SELECT, INSERT, UPDATE, DELETE statements; 2) Use CREATE, ALTER, DROP statements for database design and management; 3) Complex queries and data analysis are implemented through SQL to improve business decision-making efficiency.

The basic operations of MySQL include creating databases, tables, and using SQL to perform CRUD operations on data. 1. Create a database: CREATEDATABASEmy_first_db; 2. Create a table: CREATETABLEbooks(idINTAUTO_INCREMENTPRIMARYKEY, titleVARCHAR(100)NOTNULL, authorVARCHAR(100)NOTNULL, published_yearINT); 3. Insert data: INSERTINTObooks(title, author, published_year)VA


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

mPDF
mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

SecLists
SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

VSCode Windows 64-bit Download
A free and powerful IDE editor launched by Microsoft

Dreamweaver CS6
Visual web development tools

MantisBT
Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.