On 06/02/12 03:15 pm, Lewis Rosenthal thus wrote :
> On 06/02/12 02:07 am, Andy thus wrote :
>> On Sat, 2 Jun 2012 06:01:22 UTC, "Andy" <
abwi...@yahoo.com> wrote:
>>
>>> On Fri, 1 Jun 2012 14:00:52 UTC, Lewis Rosenthal
>>> <
lgros...@2-de-sp-am-2rosenthals.com> wrote:
>>>
>>>> Instead of using a GUI app which allows for the maintenance of one file
>>>> at a time, the SQLite library (available - dare I say it - via yum from
>>>> Netlabs...not sure whether there's a WPI for it) can be called (assuming
>>>> it's in the %PATH%) from the FF/SM/TB profile directory (with FF/SM/TB
>>>> closed or at least with that profile inactive!) like so:
>>>>
>>>> for %a in (*.sqlite) do sqlite3.exe %a vacuum;
>>>>
>>>> (yes, the ";" is required)
>>>>
<snip>
>>>> I was able to successfully vacuum 14 of 16 files. Two could not be
>>>> accessed (and there seemed to be no reason, as I used this on an
>>>> inactive profile):
>>>>
>>>> places.sqlite
>>>> cookies.sqlite
>>>>
<snip>
>>> My sqlite3 can open places but not cookies. I had a backup places
>>> that was larger than my current one so I switched it and sqlite3 could
>>> not open it. I then ran the vacuum from the error console which
>>> didn't seem to help in this case but then sqlite3 did open it fine
>>> (though it ultimately was no smaller than what it began as, it
>>> intially had increased by 5M but then got back down to almost the
>>> original size of 15M).
>>> The orginal places was 10M and is now 4M but unfortunately I forgot to
>>> check sizes to determine if it was the sqlite3 or the error console as
>>> I had run the error console first several times before shutting down
>>> and running the sqlite3.
>>>
I think Dave hit on it when he reminded me of the WAL journaling. I
think we may have a regression bug in our port of sqlite 3.7.2.
Supposedly, 3.7.0 and above could access WAL-journaled files. I haven't
tested my theory by moving one of my databases to a Linux box running
another build of sqlite, though, so this is merely conjecture.
>> I just answered some of it... I put the original places back and then
>> launched Seamonkey and it grew back to the 10M. Running the command
>> from the error console did not affect the size. However, when I do
>> not run the command from the error console before closing Seamonkey
>> then sqlite3 cannot open the file. If I do run the command then
>> sqlite3 can vacuum it and it takes it back down to 4M but it gains it
>> right back as soon as I launch Seamonkey again.
>>
I compacted my places.sqlite using the SQLite Manager extension. Using
that method, I got it down to 2MB from 10MB.
<snip>
> Frankly, I hadn't thought of running the vacuum from the error console;
> thanks for pointing me in that direction. It's also possible, then, to
> add something to the Tools menu via userChrome.js, like:
>
> (function() {
> var menuitem = document.createElement("menuitem");
> menuitem.setAttribute("label", "Database Vacuum");
> menuitem.setAttribute("accesskey", "V");
> menuitem.setAttribute("oncommand",
> 'Components.classes["@
mozilla.org/browser/nav-history-service;1"].getService(Components.interfaces.nsPIPlacesDatabase).DBConnection.executeSimpleSQL("VACUUM");');
> var optionsitem = document.getElementById("addonsmgr");
> optionsitem.parentNode.insertBefore(menuitem, optionsitem);
> })();
>
well, for SeaMonkey, the above turned out to be:
(function() {
var menuitem = document.createElement("menuitem");
menuitem.setAttribute("label", "Database Vacuum");
menuitem.setAttribute("accesskey", "V");
menuitem.setAttribute("oncommand",
'Components.classes["@
mozilla.org/browser/nav-history-service;1"].getService(Components.interfaces.nsPIPlacesDatabase).DBConnection.executeSimpleSQL("VACUUM");');
var optionsitem = document.getElementById("sync-setup");
optionsitem.parentNode.insertBefore(menuitem, optionsitem);
})();
(which places the menu item just above the menu separator above Web
Development.)
> And further still (haven't played with it, though) to make a submenu for
> Vacuuming, and add all of the db's there, as well as a bit of javascript
> to process the lot of them in sequence.
>
Ugh... Thinking about this some more, it's much easier to do menus in
xul than js, and more efficient in that case to just do an extension.
There is one which runs under FF (I tweaked it to install under SM), but
it's a bit rough:
https://addons.mozilla.org/en-US/firefox/addon/sqlite-optimizer/
The English is rather broken in the UI (I can't comment on the Korean or
the Japanese, and I haven't really looked at the German). Some people
complained that it trashed the db for Stylish, though I doubt that would
have anything to do with the extension itself (it just calls the same
routines we've been discussing). What it does do nicely is vacuums all
the databases and then reindexes them (I've added a reindex pass to my
offline script, as well).
I may clean up the UI a little bit and either see if the original author
wants to release an update or fork it.