On Sat, 11 Apr 2009 20:16:32 -0700, Tito Ciuro <tci...@mac.com> wrote:
>Hi Lawrence, > >On Apr 11, 2009, at 7:51 PM, Lawrence Gold wrote: > >> I can't offer a formula, but I suggest making it an option for the >> users of the software, with sufficient warning that it could take some >> time, as well as a Cancel button. Another thing you could do is to >> schedule the vacuum for a time when you know the software won't be in >> use -- for example, those of us who write software for K-12 schools >> can safely schedule operations like this for midnight on >> weekends. :-) > >It's not an application. It's a framework which is used by a daemon >process. There can't be a UI, and scheduling a vacuum when it's not >needed is wasteful, especially because the databases can be quite >large. This is why I was looking for some way to determine whether >vacuum is needed, so that it's performed when it makes sense to do so. > >Thanks anyway, I appreciate your input! :-) PRAGMA freelist_count; tells you how many pages are free. If there are many free pages, you may have a reason to vacuum. It doesn't tell anything about the average percentage of payload in database pages, which would be another reason to vacuum. For a full analysis, you'd have to run the sqlite3_analyzer program, or incorporate part of its code in your application. -- ( Kees Nuyt ) c[_] _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users