On 1/06/2009 5:29 PM, pierr wrote:
> Hi all,
> 
> Section 7.9 of http://www.sqlite.org/atomiccommit.html mentioned:
> 
> "On embedded systems with synchronous filesystems, TRUNCATE results in
> slower behavior than PERSIST. The commit operation is the same speed. But
> subsequent transactions are slower following a TRUNCATE because it is faster
> to overwrite existing content than to append to the end of a file. New
> journal file entries will always be appended following a TRUNCATE but will
> usually overwrite with PERSIST."
> 
> why " New journal file entries will always be appended following a TRUNCATE
> but will usually overwrite with PERSIST"?  I think if we trancate the
> journey file to _zero_ , and the following write to that file is going to
> overwrite the old data. Why append?

Truncate means to set the end of the file to a smaller value than 
before; pages so freed are then owned by the filesystem. Writing more 
data then requires appending which requires pages to be obtained from 
the filesystem, which is not a zero-cost operation. It may write over 
old data (you get your old pages back), or it may not (someone else has 
grabbed your freed pages in the meantime).

HTH,
John
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to