Re: FLUSH statement
Posted by: Harrison Fisk
Date: October 24, 2004 07:22PM

Hi,

When you FLUSH TABLES; it will close all open tables. Basically the idea is that MySQL will cache certain meta-data and file descriptors used by queries. When you flush them, it will close the file descriptors and force a re-read of the meta-data. If someone is doing a query, it will close and then immediately re-open the table cache information, with the query only delaying as long as neccesary for this process to happen (normally a very short time)

The reason it is required before doing an OS level backup, is because MyISAM doesn't neccesarily write out information immediately when it is changed. Things like DELAY_KEY_WRITE can cause it to delay writing out index information. Also the OS can possibly do caching where the data isn't really written out yet. By flushing the table, and forcing MySQL to close the file descriptor, it will guarantee that data is definately on disk.

Harrison Fisk, Trainer and Consultant
MySQL AB, www.mysql.com



Edited 1 time(s). Last edit at 10/24/2004 07:23PM by Harrison Fisk.

Options: ReplyQuote


Subject
Written By
Posted
October 21, 2004 08:27PM
Re: FLUSH statement
October 24, 2004 07:22PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.