Re: [WebSQLDatabase] Adding a vacuum() call

On Fri, 12 Mar 2010 04:07:21 +0100, Dumitru Daniliuc <>  

> joao,
> if i understand correctly, you basically want to have an automated system
> implemented in the browser that decides when to vacuum databases (or at
> least make sure it doesn't happen too often). and the vacuum() calls  
> would
> be just one of the parameters that the system takes into account. i think
> having such a system is fine, but doesn't need to be spec'ed. at the same
> time, i think it's worth having a spec'ed vacuum() call that gives the  
> app
> some guarantees. in particular, i would like the completionCallback to  
> be a
> signal that the database is in a good shape and ready for more work. so  
> how
> about this:
>    1. if the UA doesn't support the vacuum() call, go to step 3.
>    2. queue up a task to vacuum the database. if the UA decides that
>    vacuuming is not needed at this time, the vacuuming task scheduled in  
> this
>    step could be a no-op.
>    3. when the vacuuming task completes, queue up a task to invoke the
>    completion callback, if one was specified.
> i think this spec should allow you to treat the vacuum() call as a hint,
> while also guaranteeing that:
> 1. the UA believes the database is in a good shape when the completion
> callback is called.
> 2. the completion callback is called as soon as UA believes the DB is in  
> a
> good shape.
> what do you think?

Looks better, and more flexible.

I wonder if sqlite has a way to query the number of pages in the freelist ?
Probably something like 10% of pages in the freelist would be a good  
threshold to allow a vacuum.

> thanks,
> dumi

Received on Friday, 12 March 2010 03:18:26 UTC