[sqlite] Load a Sqlite Database on Disk as an In-memory Database

2013-02-04 Thread Alex Cheng
Hi guys,

I want to write a program to load a sqlite database on disk as an in-memory
database, for sake of reducing number of disk I/O operations. Do you know
how to achieve it?

Thank you in advance.

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


Re: [sqlite] Load a Sqlite Database on Disk as an In-memory Database

2013-02-04 Thread Simon Slavin

On 5 Feb 2013, at 7:33am, Alex Cheng  wrote:

> I want to write a program to load a sqlite database on disk as an in-memory
> database, for sake of reducing number of disk I/O operations. Do you know
> how to achieve it?

Probably to use the SQLite backup API:

http://www.sqlite.org/backup.html

of course, a program which did nothing more than what you described above would 
be useless: immediately the program quits, the in-memory database will 
disappear.

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


Re: [sqlite] Load a Sqlite Database on Disk as an In-memory Database

2013-02-05 Thread Roger Binns
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 04/02/13 23:33, Alex Cheng wrote:
> I want to write a program to load a sqlite database on disk as an
> in-memory database, for sake of reducing number of disk I/O operations.
> Do you know how to achieve it?

You may not need to actually do that.  Since your database is smaller than
memory it should be sufficient to just read the file contents sequentially
before opening in SQLite.  This will populate the operating system file
system cache so disk operations are served out of cache memory.

(Doesn't work on XP with default settings but does work on every other
modern operating system.)

Roger

-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.11 (GNU/Linux)

iEYEARECAAYFAlEQxrAACgkQmOOfHg372QTlLgCeLI2dZP/v6Pw4VlgcgRGUKqHB
xcwAnjM1RAHNzGgvi9nnGnP4uoYG6vqV
=DCOk
-END PGP SIGNATURE-
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users