On 14 Feb 2010, at 5:32am, Michael Tharp wrote:

> I see that a sqlite commit is split into two distinct phases, the first 
> being acquiring an exclusive lock and flushing dirty pages and the 
> second being the unlinking of the journal which constitutes the actual 
> commit. I would like to invoke the first phase manually since it can 
> take a non-trivial amount of time, then commit the filesystem journal 
> and finish the sqlite commit. This would minimize the window during 
> which an interruption could cause inconsistencies.
> 
> Is there a sanctioned way to cause sqlite to perform the first phase 
> commit, or to otherwise make the actual commit as fast as possible?

First look at

<http://www.sqlite.org/lang_transaction.html>

and read the distinctions between the different types of 'BEGIN'.  You might 
want 'BEGIN IMMEDIATE'.  But second, you should know that even the default 
behaviour of SQLite is extremely quick at this.  Even just ignoring 
transactions and issuing a bare 'INSERT' will be extremely fast from begin to 
end.  In fact the extra time it takes to issue the BEGIN and COMMIT commands 
may actually increase the time between updating your journal and SQLite 
committing the change.  Run some time tests yourself.

The one thing I wouldn't do is have a second process/thread messing with the 
same database file.  Multi-access won't speed things up and may slow them down, 
depending on what you're doing and in what order.

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

Reply via email to