On Fri, May 17, 2013 at 9:06 AM, Paolo Bolzoni <
paolo.bolzoni.br...@gmail.com> wrote:

> In my programs I often use savepoints so in case
> of errors I can rollback leaving the db untouched.
>
> I use savepoint instead of begin transaction because
> it fits more naturally in the nested structure of a C
> program.
> When I write a function I do not need to recall if the
> caller already  opened the transaction.
> When the last savepoint is released the data is safely
> written in the db.
>
> First of all, did I understand correctly?
>

yes.


> Secondly, is there a significant difference of performance
> to use nested savepoints instead of a single transaction?
>

Yes.  SQLite must open a new rollback journal for each nested savepoint.
These secondary rollback journals do not need to be synced like the primary
journal (or WAL file) so they are not nearly as expensive.  But neither are
they free.

-- 
D. Richard Hipp
d...@sqlite.org
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to