On Wed, Jul 22, 2009 at 3:22 PM, Igor Tandetnik<itandet...@mvps.org> wrote:
> Zachary Turner <divisorthe...@gmail.com>
> wrote:
>> I still don't understand the transactions.  For example, I issue a
>> single BEGIN at the start of my application and then insert about
>> 500MB of data through many small inserts (about 4KB each).  During
>> this whole time I never issue a commit.  But the main db file grows
>> very large, and the journal file remains small.  Is sqlite manually
>> forcing commits for me at some fixed threshold?
>
> SQLite uses an undo journal: changes are written to the database file,
> and the journal keeps the original pages. Committing a transaction
> simply means discarding the journal; rolling back means copying saved
> pages from journal back to database file.
>
> Your massive insert operation doesn't modify many pages in the database
> file - it mostly creates new ones by extending the file. For this case,
> the only thing one needs to store in the journal is the original size of
> the database, so that the file could be truncated on rollback. That's
> why the journal file remains the same size even as the main file grows.
>
> Igor Tandetnik

I branched this off into a new thread since the topic is changing slightly.

Speaking of extending the file, if I know in advance that my database
is ultimately going to end up being very large, is there any way for
me to extend the file up front?  Or to specify the increment in which
sqlite will extend the file when it needs to, rather than just having
it extend the file by the exact amount needed to satisfy a commit?  It
seems like this might result in some performance improvements for very
large databases.
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to