(This is mostly for my own reference, because at one time I had encountered the information, but forgot where I stored it.)
To compact the database used by FireFox 3.x from the Error Console,
Components.classes[ "@mozilla.org/browser/nav-history-service;1" ].getService( Components.interfaces.nsPIPlacesDatabase ).DBConnection.executeSimpleSQL( "VACUUM" );
(Many thanks to the folks on #firefox on irc.mozilla.org, and especially to dr|z3d, who was able to quickly offer me with clue in this instance.)
Thanks for posting that.
With the SQLite Manager FF extension, you can open its dialog window, select each of the Firefox databases in turn (they are all listed by default), and click on the "compact database" menu item, in the "database" menu.
And you don't need to remember anything.