关于MySQL的Myisam和Innodb的一些比较总结_MySQL
bitsCN.com
关于MySQL的Myisam和Innodb的一些比较总结
总结一下MySQL的Myisam和Innodb引擎的一些差别,权当复习了。
首先二者在文件构成上:
Myisam会存储三个文件:.frm 存储表结构,.MYD存储表的数据,.MYI文件存储表的索引;所以完整的拷贝一张表这三个文件都需要。另外Myisam会对索引进行压缩。用Myisam备份会更简单。
Innodb也有 .frm表结构文件,但是数据存储就不同了,由于有表空间的概念,所以数据文件可能是独立的,也可能是空闲的,独立的话数据和索引都会在一个.ibd文件内。
对事务的支持:
Myisam不支持;所以如果你真的需要诸如事务,外键等特性,放弃它吧。
Innodb支持 事物,回滚等一些事务安全的ACID特性,支持外键。
锁:
Myisam只支持表锁,意即如果你执行了一条DML(数据操纵语言,即增删改查)语句,整张表会获得一把锁,在操作执行完之前其他人不能够再操作这张表了,所以如果表的并发高,Myisam性能会差一些
Myisam支持行锁,即可以只给某一行上锁而非整个表,所以在并发情况下,Update之类的操作性能会更好。当然如果一条SQL语句不能确定扫描范围时,也会锁表,诸如where like'%'的操作。更简单来说,Innodb使用where检索的列没有索引,那么就会锁表了。
DML(Insert, Select, Update, Delete):
Select:一般认为Myisam的读性能会比Innodb更好,所以如果是个读多写少的项目,这点上Myisam可以有加分。
Insert:这个要分情况来说,单线程操作,Myisam明显会快,但是并发多的话就不一定了。还有需要说明的是Myisam支持Insert Delayed操作,如果你的应用可以接受这种使用方式(可能延迟一下才生效),那么它会更好一些
Update:一般认为Innodb更快
Delete:Innodb,它会一行行的删除表,而不是重新建立表
其他:
count(*) :Myisam会保存表的具体行数,而innodb不会,所以你在用phpmyadmin来查看时,表的行数会显示'~'大约多少行。所以select count(*) 用Myisam当然快,不过这是不加where条件的情况下
Myisam还支持全文索引,比如说搜索诸如某些text字段时 where * like "%*"时性能和效率会更好
Auto_Increment:Innodb必须包含只有该字段的索引,而Myisam可以使用联合索引。
Myisam建立的表可以使用Myisam_merge引擎,在某些情况下很有用。
bitsCN.com
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

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

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

Hot Topics

Full table scanning may be faster in MySQL than using indexes. Specific cases include: 1) the data volume is small; 2) when the query returns a large amount of data; 3) when the index column is not highly selective; 4) when the complex query. By analyzing query plans, optimizing indexes, avoiding over-index and regularly maintaining tables, you can make the best choices in practical applications.

Yes, MySQL can be installed on Windows 7, and although Microsoft has stopped supporting Windows 7, MySQL is still compatible with it. However, the following points should be noted during the installation process: Download the MySQL installer for Windows. Select the appropriate version of MySQL (community or enterprise). Select the appropriate installation directory and character set during the installation process. Set the root user password and keep it properly. Connect to the database for testing. Note the compatibility and security issues on Windows 7, and it is recommended to upgrade to a supported operating system.

InnoDB's full-text search capabilities are very powerful, which can significantly improve database query efficiency and ability to process large amounts of text data. 1) InnoDB implements full-text search through inverted indexing, supporting basic and advanced search queries. 2) Use MATCH and AGAINST keywords to search, support Boolean mode and phrase search. 3) Optimization methods include using word segmentation technology, periodic rebuilding of indexes and adjusting cache size to improve performance and accuracy.

The difference between clustered index and non-clustered index is: 1. Clustered index stores data rows in the index structure, which is suitable for querying by primary key and range. 2. The non-clustered index stores index key values and pointers to data rows, and is suitable for non-primary key column queries.

MySQL is an open source relational database management system. 1) Create database and tables: Use the CREATEDATABASE and CREATETABLE commands. 2) Basic operations: INSERT, UPDATE, DELETE and SELECT. 3) Advanced operations: JOIN, subquery and transaction processing. 4) Debugging skills: Check syntax, data type and permissions. 5) Optimization suggestions: Use indexes, avoid SELECT* and use transactions.

MySQL and MariaDB can coexist, but need to be configured with caution. The key is to allocate different port numbers and data directories to each database, and adjust parameters such as memory allocation and cache size. Connection pooling, application configuration, and version differences also need to be considered and need to be carefully tested and planned to avoid pitfalls. Running two databases simultaneously can cause performance problems in situations where resources are limited.

In MySQL database, the relationship between the user and the database is defined by permissions and tables. The user has a username and password to access the database. Permissions are granted through the GRANT command, while the table is created by the CREATE TABLE command. To establish a relationship between a user and a database, you need to create a database, create a user, and then grant permissions.

Data Integration Simplification: AmazonRDSMySQL and Redshift's zero ETL integration Efficient data integration is at the heart of a data-driven organization. Traditional ETL (extract, convert, load) processes are complex and time-consuming, especially when integrating databases (such as AmazonRDSMySQL) with data warehouses (such as Redshift). However, AWS provides zero ETL integration solutions that have completely changed this situation, providing a simplified, near-real-time solution for data migration from RDSMySQL to Redshift. This article will dive into RDSMySQL zero ETL integration with Redshift, explaining how it works and the advantages it brings to data engineers and developers.
