----- Original Message -----
> From: "Zhangzhigang" <zzgang_2008@stripped>
>
> As i known, the mysql writes the data to disk directly but does not
> use the Os cache when the table is updating.
If it were to use the OS cache for reading but not writing, then the OS cache would be
inconsistent with the underlying filesystem as soon as you wrote a block, and you'd need
some complicated logic to figure out which of the two was correct.
No, the MyISAM engine will simply yield to whatever the kernel/VFS wants to do with the
blocks; whereas InnoDB explicitly opens the files with O_SYNC and bypasses the OS cache
entirely, because it manages it's own buffer cache.
> If it writes to the Os cache, which leads to massive system invoking,
> when the table is inserted a lot of rows one by one.
From the code's point of view, you simply request a read or a write. Wether or not the OS
cache gets in between is entirely a matter for the kernel to decide, assuming you
specified no specific options at file open time.
--
Bier met grenadyn
Is als mosterd by den wyn
Sy die't drinkt, is eene kwezel
Hy die't drinkt, is ras een ezel