Closed Bug 401985 Opened 17 years ago Closed 17 years ago

change places.sqlite default page_size value to 4K

Categories

(Firefox :: Bookmarks & History, defect)

defect
Not set
normal

Tracking

()

VERIFIED FIXED
Firefox 3 beta1

People

(Reporter: mtschrep, Assigned: moco)

References

()

Details

Attachments

(1 file)

We set the default sqlite page size to 1024 (http://lxr.mozilla.org/mozilla/source/toolkit/components/places/src/nsNavHistory.cpp#124). We should set this to the cluster size of the file system. Which, unfortunately, will depend on OS + file system, plus other stuff. So we should first make sure it is worth it, then see if we can query the cluster size, if not might want to set different defaults for different OSs.
from the google gears documentation http://code.google.com/apis/gears/api_database.html#sqlite_changes PRAGMA page_size = 4096; Desktop operating systems mostly have default virtual memory and disk block sizes of 4k and higher. As schrep points out, for PRAGMA page_size, we are doing 1024 (instead of 4096). We can't hange this for an existing places.sqlite db, from http://www.sqlite.org/pragma.html, "The page-size may only be set if the database has not yet been created."
odd, in bug #331158 comment #11, brett writes: "I also upped the default page size to 4K for new databases since seeks look like they're the limiting factor when paging." and the patch in that bug has: +#define DEFAULT_DB_PAGE_SIZE 4096 but in lxr, we have (as schrep points out) 1024 (note the code use to live in mozilla/browser but now lives in mozilla/toolkit)
Sounds like an easy 1 liner for ya seth :-)
Flags: blocking-firefox3?
> Sounds like an easy 1 liner for ya seth :-) yes, that change would be good to do before beta. the harder part is about migrating any existing users. note, we already have this same problem with existing places.sqlite and incremental auto vacuuming. (http://lxr.mozilla.org/seamonkey/source/toolkit/components/places/src/nsNavHistory.cpp#514) I'll whip up a patch for this bug, and log another one about tracking the harder issues (with existing sqlite databases)
Assignee: nobody → sspitzer
> Sounds like an easy 1 liner for ya seth :-) the easier one liners are getting hard to come by. while testing to make sure the on liner indeed sets the page size, and I find that it does not! the problem is that when I added the code to set "pragma auto_vacuum=2" (see bug #385834), I added it before the call to set the page size. a side effect of setting that auto_vacuum pragma is that we create the database, and once created, pageSizeFixed is set (so future calls to change the page size will fail.) moving around the code, patch coming.
Status: NEW → ASSIGNED
Target Milestone: --- → Firefox 3 M9
Comment on attachment 286936 [details] [diff] [review] patch. use brettw's original comment (from bug #331158) move the pragmas around (setting page_size *must* be first) looks good, r=me.
Attachment #286936 - Flags: review?(dietrich) → review+
Comment on attachment 286936 [details] [diff] [review] patch. use brettw's original comment (from bug #331158) move the pragmas around (setting page_size *must* be first) a+ from schrep so that folks in b1 can get DB's created witht he right page size. Note that the comment is wrong you say "8K is +// sqlite's default max page size." s/8k/1k and you are good.
Attachment #286936 - Flags: approvalM9? → approvalM9+
> Note that the comment is wrong the comment is wrong, but for another reason. 1k is the default page size. at some point, 8K may have been the default max page size, but the default max page size is now 32k (see http://lxr.mozilla.org/seamonkey/source/db/sqlite3/src/sqlite3.c#2940) I'll fix that before checking in. thanks for logging and approving this one, schrep!
fixed. Checking in toolkit/components/places/src/nsNavHistory.cpp; /cvsroot/mozilla/toolkit/components/places/src/nsNavHistory.cpp,v <-- nsNavHis tory.cpp new revision: 1.180; previous revision: 1.179 done
Status: ASSIGNED → RESOLVED
Closed: 17 years ago
Resolution: --- → FIXED
Summary: Investigate page_size values for places on windows → change places.sqlite default page_size value to 4K
note to qa: one way to verify this is to create a new profile, exit, then use sqlite browser, open places.sqlite and verify that "pragma page_size" gives you 4096. > and log another one about tracking the harder issues (with existing sqlite > databases) logged bug #402076
Flags: blocking-firefox3? → blocking-firefox3+
Seth: I tried your steps in Comment 11 to verify, however I do not see the pragma page_size listed when I browse with SQLLite Database Browser 1.3.
marcia, you have to execute "pragma page_size" as a query.
note: dr hipp, while he has also seen reports about how this benefits windows users, never noticed the performance gains of 4k vs 1k on linux. (he chose 1k as the default because on linux that gave the best results (by a slight amount.) today he ran the speed1.test with 1k, 2k, 4k, 8k for page size (I'll attach the test) on his mac book pro, and we didn't see any gains on mac, either (against sqlite 3.5.1)
just a note - we don't have 3.5.1 in tree, and probably won't for 1.9 (unless someone tells me to work on it for perf reasons - it'll be a big change).
(In reply to comment #13) > marcia, you have to execute "pragma page_size" as a query. > Sorry, I am sql-lite challenged. Here is what I get on the Mac, with my exact STR: 1. Create a new Minefield profile on the Mac. 2. Launch the browser with that profile. 3. Do nothing in the browser. File->Quit 4. Launch sql-lite browser and perform pragma page_size query. 5. Returns 1024, not 4096. I am running Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.4; en-US; rv:1.9a9pre) Gecko/2007110104 Minefield/3.0a9pre. I tried this twice with two different profiles and got the same results.
marcia, those are the right steps but you are testing 2007110104 (4 am on 11/1), but I checked in at 10 am on 11/1. can you try again with tomorrow's build?
verified fixed using Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.4; en-US; rv:1.9a9pre) Gecko/2007110204 Minefield/3.0a9pre. I verified using the steps in Comment 16. Thanks to seth for the very helpful STR.
Status: RESOLVED → VERIFIED
Bug 451915 - move Firefox/Places bugs to Firefox/Bookmarks and History. Remove all bugspam from this move by filtering for the string "places-to-b-and-h". In Thunderbird 3.0b, you do that as follows: Tools | Message Filters Make sure the correct account is selected. Click "New" Conditions: Body contains places-to-b-and-h Change the action to "Delete Message". Select "Manually Run" from the dropdown at the top. Click OK. Select the filter in the list, make sure "Inbox" is selected at the bottom, and click "Run Now". This should delete all the bugspam. You can then delete the filter. Gerv
Component: Places → Bookmarks & History
QA Contact: places → bookmarks
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: