6

How do I set how many URLs (maximum) can be stored in the browsing history of Firefox?

I don't see such an option in the settings dialog.

9

NOTE: I'm using Firefox 40.0.3 here.

I believe the relevant option is places.history.expiration.max_pages. It doesn't exist by default, so you'll have to go to about:config and create it.

Once you create it and set it, check the value of places.history.expiration.transient_current_max_pages — it should automatically adjust itself to match your .max_pages setting. If this is the case, it means you've set .max_pages correctly.

Results:

(Now on Firefox 52.0.2)

It's 2017 and since I wrote this answer I don't seem to have lost any history. My oldest history entries (from 2013) are still there. I have well over 100,000 pages in history and my "places.sqlite" is 71 MB.

Technical details:

The relevant function is PEX__loadPrefs() in nsPlacesExpiration.js. It tries to determine the limit by first checking PREF_MAX_URIS (which is "max_pages"). If PREF_MAX_URIS isn't set or is a negative value, it then attempts to calculate the 'optimal database size' based on available memory and disc space. So, it appears that setting places.history.expiration.max_pages overrides all this logic.

If you want it to retain all history ('infinite' history) you could try setting max_pages to 2147483647 (the highest 32-bit signed integer). I haven't actually tested this myself, but the database would probably be crushed under its own weight before reaching this limit.

  • 1
    came from superuser.com/a/995462 – n611x007 Nov 4 '15 at 8:16
  • 3
    Thank you for this answer. For someone who's new in firefox-dabbling, how can I create a new option in about:config? – Silvio Levy Nov 11 '15 at 12:22
  • 2
    Got it (thanks again google) - right-click in the window and choose Integer. – Silvio Levy Nov 11 '15 at 12:42
  • 1
    i recently took another look at the code; things seem to have changed a lot since i wrote this answer. i'm planning to see if i can find an updated solution (which works on android hopefully) – Cauterite Jul 30 '18 at 10:44
  • 1
    Also I think it's worth to recommend setting places.history.expiration.interval_seconds to a large number so that it doesn't even try to expire every 180 seconds (by default). For better performance. – user Apr 18 at 1:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.