The world's most popular open source database
USA - Toll Free: +1-866-221-0634
USA - From abroad: +1-208-327-6494
USA - Subscription Renewals: +1-866-830-4410
Latin America: +1 512 535 7751
UK: +44 845 399 1124
Ireland: +353 1 6919191
Germany: +49 89 420 95 98 95
France: +33 1 70 61 48 95
Sweden: +46 730 207 871
Benelux: +358 50 5710 528
Italy: +39 06-99268193
Israel: +358 50 5710 528
Spain & Portugal: + 34 933905461
Other EMEA countries: +353 1 6919191
Australia/NZ: +61 2 42314328
Asia Pacific: +81 3 5843 1140
Newsletters older than 6 months may have links that are out of date. Please use the Search to check for updated links.
How can I ensure that when data is written, it is also really written to disk.
When MySQL writes data, it gives it to the operating system. It is a feature of some operating systems that they use "lazy writes." That is, they do not actually write the data immediately, but buffer it in memory for a short while. This allows the operating system to optimize disk I/O in general. However, it also means that data written by MySQL may not actually be written to disk immediately.
On Windows, MySQL has a --flush-time option that creates a separate thread. This thread flushes unwritten data to disk at the interval given as the value of the option. A value of 0 means that no separate thread is created to take care of flushing unwritten data.
So if you want to ensure that data is really written from memory to disk, you need to check how your operating system handles data writes. InnoDB handles flushing by itself. You can control that with the innodb_flush_log_at_trx_commit values.

