What I am wanting to work out is how much memory SQLite uses if we have
the entire database in RAM only, the reason I'd like to find this out is
that there is some concern here about SQLite paging to disc at
inopportune moments (we're on an embedded system with a lot of other
random disc access going on) so ideally I'd like the option to be able
to run completely from RAM after the initial load from disc, so that if
paging proves too costly we can sacrifice RAM to escape the paging
issue.

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Stephen
Oberholtzer
Sent: Wednesday, August 06, 2008 5:17 PM
To: General Discussion of SQLite Database
Subject: Re: [sqlite] Loading a existing database 100% into memory

On Wed, Aug 6, 2008 at 6:26 PM, Brown, Daniel <[EMAIL PROTECTED]> wrote:

> Good afternoon list,
>
> I would like to load my current database file completely into memory,
> mostly as an experiment to check SQLite's maximum memory footprint,
> however searching through the documentation I can only find references
> about how to create new databases that are completely memory resident.
> Is there a way to do this?  I'm currently using the SQlite console
> application for my testing if that makes a difference.


What, exactly, is it you're after?  I can load a SQLite database 100%
into
memory quite quickly:

int fd = open("sqlitedb.dat");
struct stat info;
fstat(fd, &info);
char *buf = malloc(info.st_size);
read(fd, buf, info.st_size);

I find it extremely unlikely that this is what you want (although it
might
be an interesting academic exercise to make a VFS port of SQLite that
uses
memory arrays for read/write ops.)

At the other end of the spectrum, you could just dump the entire
database on
disk and then insert all the data into a :memory: database.  However,
this
doesn't seem like it would be very useful, either.

This sounds like an XY problem.  What are you really trying to
accomplish?
What constraints are preventing you from simply using an on-disk
database?

-- 
-- Stevie-O
Real programmers use COPY CON PROGRAM.EXE
_______________________________________________
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