Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

mysql - FLUSH TABLE needed?

After I REPAIR OPTIMIZE ANALYZE OR CHECK a table, do I need to FLUSH it?

like image 652
Hope4You Avatar asked Feb 09 '12 18:02

Hope4You


People also ask

Is flush privileges necessary?

FLUSH PRIVILEGES is really needed if we modify the grant tables directly using such as INSERT, UPDATE or DELETE, the changes have no effect on privileges checking until we either restart the server or tell it to reload the tables.

What does MySQL flush tables do?

The idea of FLUSH TABLES is to force all tables to be closed. This is mainly to ensure that if someone adds a new table outside of MySQL (for example, by copying files into a database directory with cp ), all threads will start using the new table.

Which privilege must you have to execute a flush statement?

To execute FLUSH , you must have the RELOAD privilege.

How do I grant flush privileges in MySQL?

To tell the server to reload the grant tables, perform a flush-privileges operation. This can be done by issuing a FLUSH PRIVILEGES statement or by executing a mysqladmin flush-privileges or mysqladmin reload command.


1 Answers

A flush is not necessary.

When it comes to ANALYZE TABLE or CHECK TABLE, they just read the table. ANALYZE will write index statistics elsewhere.

When it comes to REPAIR TABLE or OPTIMIZE TABLE, they perform full DDL by copying the MyISAM table to a temp table and then renaming the table back.

like image 195
RolandoMySQLDBA Avatar answered Oct 26 '22 23:10

RolandoMySQLDBA