USA - Toll Free: +1-866-221-0634
USA - From abroad: +1-408-701-9009
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 38 72 00
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
Asia Pacific: +81 3 5918 7507
Learn about new MySQL releases, technical articles, events and more.
Is there any way to ensure, that when data is written, it is also really written to disk? I.e. I can sure data in memory and disk are in sync.
This is a question about usage of sync(). MySQL does all OS call pertaining to writting data to disk. The only thing missing is sync()-ing, which we do not do as it would make things very slow. Sync-ing may take long time. So, MySQL actually writes all data to OS, and it is a feature of "lazy writes" that some OS's exhibit that prohibits immediate writing to disk.
On Windows we have --flush-time option, which creates a separate thread which flushes everything to disk at the interval that is passed as the argument. This means MySQL is flushing data with some commands, plus when some other conditions are met. Value 0 means, that there is no separate thread, that is dealing with flushing.
So if you want to ensure, that data is really written from memory to disk, you need to check, how your OS in use handles the OS data writes.
Does it do the "lazy writes" or does it do immediate writes.
