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

Reclaim fragments of the mysql table

2025-04-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

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

As the operator deleted a large number of 20 million rows of data from the relationship table, but mysql did not automatically reclaim space, it decided to defragment (test first):

Myisamchk-r relationship

I did it under mysql, and when I finished the query, there was the following problem:

ERROR 1030 (00000): Got error 1030 from table handler

This problem is very depressing, and there should be no problem. Later, when I checked the data, I found a problem (http://www.xinlian.net/school/pc/MySQLinstall/):

If you run mysqld with-- skip-locking (which is the default on some systems, such as Linux), when

You cannot reliably use myisamchk to check a table when mysqld is using the same table. If you can

Make sure no one is accessing the table through mysqld when you run myisamchk, before you start checking the table

All you have to do is mysqladmin flush-tables. If you can't guarantee it, then when you check the list, you must

Mysqld must be stopped. If you run myisamchk while mysqld is updating the table, you may get a table

A warning that has been broken, even if it does not.

If you don't use-- skip-locking, you can use the myisamchk checklist at any time. When you do this,

All customers who try to update the table will wait until the myisamchk is ready before continuing.

If you use myisamchk to repair or optimize tables, you must always make sure that the mysqld server is no longer using tables such as

If you are using-- skip-locking, this also applies. If you keep dropping the mysqld, before you run

Before myisamchk, you should at least do a mysqladmin flush-tables.

And my database happens to be under linux, and is started by skip-locking, there is this problem!

1) this command can also stop mysql and then do it, and this problem will not occur.

2) you can also restart the database after doing it online

3) you can also run mysqladmin flush-tables before executing this command, and this problem will not occur!

[@ more@]

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: 302

*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