This article brings you relevant knowledge about mysql, which mainly introduces issues related to storage engines, and also includes issues such as index design and use, data type selection, and character set settings. ,I hope everyone has to help.
Recommended study: mysql tutorial
Who said that MySQL querying tens of millions of data is very stretched? Today I will have a good time chatting with you, talk late into the night, and spend New Year's Eve together! This article is also the last one of the year. I hope it can bring you some gains. Unknowingly, I have written so many documents and reference physical books, and I feel surprised. I can’t help but feel that the more you know, the more you know you don’t know.
Developers should pay attention to the storage engine used by MySQL. Choosing the appropriate storage engine will obviously improve the performance of your application. When reading this article, you must have some basic knowledge of MySQL or other databases, otherwise it will be very difficult to read some parts. I have bolded the key points to make it easier to access key knowledge points.
Regarding storage engines, it is impossible for one article to cover everything, and to elaborate on the aspects that I personally think are important and beneficial to my work. If we really dig into it, it would probably take the length of a book. By the way, some data type selection, character set settings, and the use of indexes are also introduced; views, stored procedures, functions, triggers, etc. will be described in detail in the next blog post. But this article will not go into too much detail. This article focuses on the selection of storage engines. If there are any flaws, I hope you can leave your valuable suggestions.
I discovered a magical parameter today: -site:xxxx.net
1. Storage Selection of engine (table type)
1. Introduction to storage engine
The difference from most relational databases is that MySQL has the concept of a storage engine, and you can choose the best one for different storage needs. A suitable storage engine. The plug-in storage engine in MySQL is a major feature. Users can choose how to store, whether to index, and whether to use transactions according to the needs of the application. Hehe, you can also adapt the storage engine that is most suitable for your business according to the business environment.
Oracle sensed business opportunities, acquired MySQL, and has since then had an enterprise version (commercial support). The community version is still available for free download. Another great charm is also because of open source, the community is highly active and everyone can contribute. Next, we will introduce several commonly used storage engines. There is no distinction between good and bad storage engines. There is only one that is more suitable for the corresponding production business environment.
The storage engines supported in MySQL5.0 are FEDERATED, MRG_MYISAM, MyISAM, BLACKHOLE, CSV, MEMORY, ARCHIVE, NDB Cluster, BDB, EXAMPLE, InnoDB (the default storage engine after MySQL5.5 and MariaDB10.2), PERFORMANCE_SCHEMA (unconventional storage data engine). The following is a comparison of the storage engines supported by MySQL and MariaDB. It can be seen that MariaDB has added the Aria engine:
View storage engine
Enter show engines\G;
through the character interface that comes with MySQL login, or use tools that support MySQL query, such as SQLyog, phpMyAdmin, MySQL workbench, etc. to query supported engines. Only some of them are shown here:
[test@cnwangk ~]$ mysql -uroot -p Enter password: mysql> show engines\G;*************************** 2. row *************************** Engine: MRG_MYISAM Support: YES Comment: Collection of identical MyISAM tablesTransactions: NO XA: NO Savepoints: NO*************************** 3. row *************************** Engine: MyISAM Support: YES Comment: MyISAM storage engineTransactions: NO XA: NO Savepoints: NO*************************** 6. row *************************** Engine: MEMORY Support: YES Comment: Hash based, stored in memory, useful for temporary tablesTransactions: NO XA: NO Savepoints: NO*************************** 8. row *************************** Engine: InnoDB Support: DEFAULT Comment: Supports transactions, row-level locking, and foreign keysTransactions: YES XA: YES Savepoints: YES9 rows in set (0.00 sec)
Function Description:
- Engine: Engine name (description);
- Support: Whether the current version of the database supports this storage engine, YES: Support, NO: Not supported; Supports transactions, row-level locking, and foreign keys, Personally translate this passage: Support transactions, row-level locking, and foreign keys;
- Comment: A detailed description of the storage engine, such as whether the engine supports transactions and foreign keys;
- Transactions: A description of whether the storage engine supports transactions, YES: supported, NO: Not supported;
- XA: Whether it meets the XA specification. The XA specification is an open group specification for distributed transaction processing (DTP). YES: Support, NO: Not supported;
- Savepoints: Literally means save points, whether the control of things is supported, YES: Supported, NO: Not supported.
Beep quietly, if you can read and understand some official English documents, this will help you further understand the MySQL storage engine and develop the ability to read source code or documents.
By the way, I would like to mention MariaDB, the sister of MySQL. In MariaDB, the forked version of MySQL, the new engine Aria was used before 10.2. The default storage engine used after MariaDB 10.2 is also InnoDB, which is enough to show the excellence of the InnoDB storage engine. MariaDB's API and protocol are compatible with MySQL, and some additional features have been added to support local non-blocking operations and progress reporting. This means that all connectors, libraries and applications that use MySQL will also work with MariaDB. On this basis, due to concerns about a more closed software project of Oracle MySQL, Linux distributions such as Fedora have replaced MySQL with MariaDB in the latest version, and the servers of the Wikimedia Foundation have also used MariaDB instead of MySQL.
MainSeveral storage engines that need to be understood:
- MyISAM
- InnoDB
- MEMORY
- MERGE
The following will focus on introducing several commonly used storage engines that I have recently learned from reading books, and compare the various storage engines. The difference between them helps us understand how different storage engines are used. For more details, please refer to MySQL's official documentation.
2. Features of some storage engines
Storage engine/support features | Storage restrictions | Transaction security | Lock mechanism | B-tree index | Hash index | Full-text index | Cluster index | Data cache | Index cache | Data can be compressed | Space usage | Memory usage | Batch insert speed | Foreign key support |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
MyISAM | has | table lock | support | Support | Support | Low | Low | High | ||||||
64TB | Support | Row lock | Support |
Support (5.6) |
Support | Support | Support | ##High | HighLow | Support | MEMORY | |||
#table lock | supportsupport |
Support |
N/A | MEDIUM |
HIGH |
MERGE |
||||||||
Table lock |
Support |
##Support |
Low | Low | HighNDB | has|||||||||
row lock | support |
##Support | SupportLow | 高 |
高 |
The above is the detailed content of MySQL you must understand the storage engine. 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

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

SublimeText3 Chinese version
Chinese version, very easy to use

Dreamweaver Mac version
Visual web development tools

Atom editor mac version download
The most popular open source editor

SublimeText3 Mac version
God-level code editing software (SublimeText3)

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.