Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

MyISAM table

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

1. not support transactions

MyISAM: locks the entire table, locking the entire table instead of the rows. Shared locks (read locks) can be acquired on all tables when reading data, and each connection does not interfere with each other. At write time, or exclusive lock, the entire table is locked while other join requests (read and write) are pending.

MySQL has two modes of table-level locking: shared table Read lock and exclusive table write lock. MyISAM automatically adds read locks to all tables involved before executing query statements (SELECT), and automatically adds write locks to all tables involved before executing update operations (UPDATE, Delete, INSERT, etc.).

Therefore, when operating on the MyISAM table, the following situations will occur:

Read operations (read locks) on MyISAM tables will not block read requests from other processes on the same table, but will block write requests on the same table. Only when the read lock is released will other processes 'writes be executed.

b. Write operations to MyISAM tables (add write locks) will block other processes from reading and writing to the same table. Only when the write locks are released will read and write operations of other processes be performed.

2. MyIASM repair table

[root@MyO test]# echo "a" >> myisam_tab.MYD

mysql> check table myisam_tab;

+-----------------+-------+----------+---------------------------------------------------+

| Table | Op | Msg_type | Msg_text |

+-----------------+-------+----------+---------------------------------------------------+

| test.myisam_tab | check | warning | Size of datafile is: 102 Should be: 100 |

| test.myisam_tab | check | error | got error: 120 when reading datafile at record: 5 |

| test.myisam_tab | check | error | Corrupt |

+-----------------+-------+----------+---------------------------------------------------+

3 rows in set (0.01 sec)

mysql> repair table myisam_tab;

+-----------------+--------+----------+----------+

| Table | Op | Msg_type | Msg_text |

+-----------------+--------+----------+----------+

| test.myisam_tab | repair | status | OK |

+-----------------+--------+----------+----------+

1 row in set (0.01 sec)

mysql> check table myisam_tab;

+-----------------+-------+----------+----------+

| Table | Op | Msg_type | Msg_text |

+-----------------+-------+----------+----------+

| test.myisam_tab | check | status | OK |

+-----------------+-------+----------+----------+

1 row in set (0.00 sec)

Reference: www.cnblogs.com/baochuan/archive/2012/03/15/2398276.html

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.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report