On 8 Jan 2013, at 2:05pm, "Jimmy Martin" <[email protected]> wrote:

>                I have recently taken over a position that uses a SQLite
> database.  The database is currently 24GB and running extremely slow.

Your best friend here might be the SQLite shell tool:

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

download from here:

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

> Is there a quick way to archive data and free-up some space?

Do you understand the data structure and know what rows you can delete ?  If 
so, just issue some DELETE commands and then do a VACUUM.

> Also, are
> there any risks to running the "vacuum" command...such as losing data?

It's no more or less safe than any other SQL command.  Obviously, you'd take a 
backup of your database file before you did anything at all to it -- that's 
your archive -- but there are no known corruption problems especially related 
to VACUUM.

> I would like to archive a year's worth of data.  Archiving the data via
> the application is taking roughly 30min for every 3-5MB.  Unfortunately
> our application cannot be down for such an extended time to Archive the
> years worth of data we need.


You can use the .backup command to backup the database while other applications 
have it open.  The command will continue trying to take a copy until it gets a 
consistent snapshot.  If you do use VACUUM then note that it does lock the 
database, possibly for a long time, so even if your normal apps are still 
running they may give 'cannot access database' problems.  It depends how the 
programmer wrote them.

Simon.
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to