On Tue, Jul 6, 2010 at 5:58 PM, Kristoffer Danielsson
<kristoffer.daniels...@live.se> wrote:
> However, I do believe there are times when vacuuming would be beneficial. For 
> instance, if a database for software X is detected to have 90% unused space 
> for a couple of weeks, then why bloat the harddrive? (I don't know how to do 
> that though :P)
> In my opinion, the user should always have the option to vacuum the database. 
> My goal is to let software X have some logic to give the user a hint when 
> this action would be appropriate.

It can also be beneficial for performance reasons, although you'd
obviously have to do testing to see whether the very-CPU-intensive
VACUUM operation is worth the gain in subsequent performance.  There
are some cases where it clearly is.

As for your original question, I would think that you'd want to use
some ratio of 'PRAGMA freelist_count;' to 'PRAGMA page_count;' to make
your determination:


Once the number of unused pages gets large enough compared to the
total database size, it might be an appropriate time to VACUUM.

Matthew L. Creech
sqlite-users mailing list

Reply via email to