[sqlite] Attached database atomic-ness

2009-02-20 Thread Clark Christensen

Hello,

In the docs for ATTACH, I see this information:

Transactions involving multiple attached databases are atomic,
assuming that the main database is not ":memory:".  If the main
database is ":memory:" then 
transactions continue to be atomic within each individual
database file. But if the host computer crashes in the middle
of a COMMIT where two or more database files are updated,
some of those files might get the changes where others
might not.

I'm looking for clarification on the last sentence:

"But if the host computer crashes in the middle
of a COMMIT where two or more database files are updated,
some of those files might get the changes where others
might not."

If both the main database, and the attached database(s) are disk-based, is 
there more risk of data loss during a crash in the middle of a COMMIT than with 
a single database file?

Thanks!

 -Clark
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Attached database atomic-ness

2009-02-20 Thread Dan

On Feb 21, 2009, at 5:57 AM, Clark Christensen wrote:

>
> Hello,
>
> In the docs for ATTACH, I see this information:
>
> Transactions involving multiple attached databases are atomic,
> assuming that the main database is not ":memory:".  If the main
> database is ":memory:" then
> transactions continue to be atomic within each individual
> database file. But if the host computer crashes in the middle
> of a COMMIT where two or more database files are updated,
> some of those files might get the changes where others
> might not.
>
> I'm looking for clarification on the last sentence:
>
> "But if the host computer crashes in the middle
> of a COMMIT where two or more database files are updated,
> some of those files might get the changes where others
> might not."
>
> If both the main database, and the attached database(s) are disk- 
> based, is there more risk of data loss during a crash in the middle  
> of a COMMIT than with a single database file?


Possibly slightly more. But committing a multi-file transaction when the
main database is disk-based is officially considered a safe thing to do
(whereas a multi-file transaction where the main database is in-memory  
is
not).

Dan.



___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users