I can't see all your requirements for this database but I believe
you'd better not use temporary or in-memory databases. You'd better
use regular database but use all kinds of tricks to speed up work with
it (like "pragma synchronous off", "pragma journal_mode off", in some
cases some tricks can be incorporated into VFS if you write your own
one). Yes, those tricks can lead to corrupted database in case of
application or OS crash or sudden power outage. But I believe you can
tolerate that and just delete old database if it is corrupted (in case
of in-memory or temporary database you wouldn't see it after crash at
all). If your application needs to be sure that all data is written
and can be restored later you can either call fsync() for the database
or make a backup copy of it (depending on what your application will
do after that and what requirements you have about possibility of
corruption later). But if you need for example only to store the data
on application's exit and then restore it on next run then with
regular database you'll get that automatically.


Pavel

On Wed, Jan 27, 2010 at 11:20 PM, Trapper Schuler
<trapper.schu...@technosoft.com> wrote:
> Hello,
>
> I am new to SQLite, but have experience with other database management
> systems.  Performance is very critical in my application, but the data
> is getting too large to keep in memory.  My application is not just a
> database front end.  The database is just a part of the overall application.
>
> What is the best way to "buffer" the database in memory while still
> being able to save the database to disk when needed later?
>
> ==========================================
> Some Relevant Links:
> ==========================================
> http://www.sqlite.org/inmemorydb.html
> http://www.sqlite.org/faq.html   (See #19 "INSERT is really slow...")
> http://www.sqlite.org/c3ref/funclist.html
> ==========================================
>
> I have read about "In-Memory Databases".
>
> I have read about "Temporary Databases".  This seems to be useful.  How
> well does it detect "memory pressure"?  How large is a database that
> becomes "too large"?  In my application, the database will have to share
> memory with other parts of my application.  How soon does it detect
> "memory pressure" before the application itself starts to use Virtual
> Memory?
>
> If I use a "Temporary Database" or an "In-Memory Database", is there an
> easy way to take that database and write it to disk when I need to
> (programmatically)?  (Is there a database copying function that will
> take a "From" handle and a "To" handle or something similar?)  (When I
> state "write it to disk", I want to write it to a file with a specific
> name.)
>
> Any information that you can provide is appreciated.
>
> Thank you.
> _______________________________________________
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to