MYSQL 浅谈MyISAM 存储引擎
mysql中用的最多存储引擎就是innodb和myisam。做为Mysql的默认存储引擎,myisam值得我们学习一下,以下是我对《高性能MYSQL》书中提到的myisam的理解,请大家多多指教
思维导图 介绍 mysql中用的最多存储引擎就是innodb和myisam。做为Mysql的默认存储引擎,myisam值得我们学习一下,以下是我对《高性能MYSQL》书中提到的myisam的理解,请大家多多指教。 特点 > 不支持事务 证明如下: >> 表记录:t2表的engine是myisam。
>> 操作
注意:如果你在数据库进行事务操作,但是事务无法成功,你就要看你的表引擎了,看这种引擎是否支持事务。 >> 下面请看innodb中的事务操作 > 存储结构:数据文件(.MYD),索引文件(.MYI)和结构文件(.frm) >> 特点:可以在不同服务器上拷贝数据文件和索引文件。 > 加锁和并发 加锁:对整张表进行加锁,而不是行。 并发:在读数据的时候,所有的表上都可以获得共享锁(读锁),每个连接都不互相干扰。 在写数据的时候,获得排他锁,会把整个表进行加锁,而其他的连接请求(读,写请求)都处于等待中。 > 修复表 >> 查看表状态 >> check一下表,看表是否正常。 >> repair(修复) 一下表。呵呵,我的这张表是正常的。 > 列索引。可以基于BLOB或TEXT类型列的前500个字符,创建相关索引。 >> 给t2表添加一个text列。 >> 表结构如下>> 为content字段添加全文索引
>> 查看表的索引情况
> 延迟更新索引。MYISAM 默认把DELAY_KEY_WRITE开启, 整个选项是MYISAM引擎独有的。
注意:在查询结束后,不会将索引的改变数据写入磁盘,而是改变内存中的索引数据。只有在清理缓冲区或关闭表时才将索引块转储到磁盘。
> 压缩表
>> 查看数据文件位置
>> 压缩文件
总结 myisam在索引层和压缩层的卓越贡献,所以我们经常把myisam用于slave层,供客户端去读取。而myisam在写库操作的时候会产生排他锁,如果写操作一直占用的话,那么其他连接请求一直就处于等待中,从而造成堵塞,甚至能把服务器dang掉。 参考文件:《高性能MYSQL》
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

Choosing the appropriate storage structure using the MySQL storage engine When using the MySQL database, choosing the appropriate storage engine is crucial. Different storage engines have different characteristics and applicable scenarios. Choosing a suitable storage engine can improve database performance and efficiency. This article will introduce several common storage engines in MySQL and give corresponding code examples. InnoDB engine The InnoDB engine is MySQL's default storage engine, which has transaction support and ACID features. It is suitable for handling high-concurrency applications

Efficient storage and high-speed reading: MySQL tips and strategies for using the Aria engine Introduction: As a commonly used relational database management system, MySQL provides a variety of storage engines for users to choose from. Among them, the Aria engine is a storage engine that supports transactions and concurrent read and write operations, and has efficient storage and high-speed reading characteristics. This article will introduce several techniques and strategies for using the Aria engine to improve MySQL storage and reading performance, and provide corresponding code examples. Basic usage of Aria engine in MyS

MySQL is a powerful open source relational database that can be used in applications of all sizes. MySQL supports a variety of different storage engines, such as MyISAM, InnoDB, Memory, CSV, etc. Different engines have different functions and performance characteristics. When optimizing the underlying MySQL, the choice of storage engine is a very important step. This article will discuss how to choose a storage engine suitable for your project and how to compare performance. 1. MyISAM storage engine MyIS

MySQL storage engine selection comparison: InnoDB, MyISAM and Memory performance index evaluation Introduction: In the MySQL database, the choice of storage engine plays a vital role in system performance and data integrity. MySQL provides a variety of storage engines, the most commonly used engines include InnoDB, MyISAM and Memory. This article will evaluate the performance indicators of these three storage engines and compare them through code examples. 1. InnoDB engine InnoDB is My

MySQL can change the storage engine of a table by specifying the storage engine when creating the table, using the ALTER TABLE statement to modify the storage engine, modifying the MySQL configuration file, and using the storage engine conversion tool. Detailed introduction: 1. Specify the storage engine when creating a table. When creating a table, you can change the default storage engine of the table by specifying the storage engine. By using the ENGINE keyword and specifying the storage engine name in the CREATE TABLE statement, you can change the table's default storage engine. The storage engine is set to InnoDB and so on.

MySQL is a widely used database management system, and different storage engines have different impacts on database performance. MyISAM and InnoDB are the two most commonly used storage engines in MySQL. They have different characteristics and improper use may affect the performance of the database. This article will introduce how to use these two storage engines to optimize MySQL performance. 1. MyISAM storage engine MyISAM is the most commonly used storage engine for MySQL. Its advantages are fast speed and small storage space. MyISA

How to write a custom storage engine in MySQL using C# Summary: MySQL is a popular relational database management system that provides many built-in storage engines, such as InnoDB, MyISAM, etc. However, sometimes we need to customize the storage engine to meet specific needs. This article will introduce how to write a custom storage engine using C# and provide detailed code examples. Introduction MySQL's storage engine is the core component responsible for processing data. It is responsible for data storage, retrieval, indexing and other operations. My

Tips and strategies to improve the read performance of MySQL storage engine: Comparative analysis of MyISAM and InnoDB Introduction: MySQL is one of the most commonly used open source relational database management systems, mainly used to store and manage large amounts of structured data. In applications, the read performance of the database is often very important, because read operations are the main type of operations in most applications. This article will focus on how to improve the read performance of the MySQL storage engine, focusing on a comparative analysis of MyISAM and InnoDB, two commonly used storage engines.
