15

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.

unor
  • 3,066
  • 3
  • 27
  • 54
user626528
  • 918
  • 6
  • 19
  • 40

1 Answers1

21

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.

Cauterite
  • 452
  • 5
  • 11
  • 1
    came from https://superuser.com/a/995462/ – n611x007 Nov 04 '15 at 08:16
  • it's in *v4*, at least v4.0b11, see my comment https://superuser.com/questions/647546/how-to-set-up-firefox-to-absolutely-never-to-delete-any-history-items/995462#comment1375132_995462 – n611x007 Nov 04 '15 at 09:18
  • 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
  • doesn't seem to be taking effect on Android. haven't worked out why yet – Cauterite Jul 09 '18 at 08:37
  • "… try setting _max_pages_ to 2147483647 … " https://superuser.com/questions/1269516/what-exactly-does-the-number-listed-under-places-history-expiration-transient-c#comment2013063_1307644 I wonder about automated changes to transient`places.history.expiration.transient_current_max_pages` – Graham Perrin Jul 30 '18 at 05:06
  • 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
  • @Cauterite, is [this](https://superuser.com/a/1341908/285720) a viable solution? – user Apr 18 '19 at 00:35
  • 3
    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 '19 at 01:02
  • @user (re: question 1341762): i guess that could work, but seems like overkill — the value of `places.history.expiration.transient_current_max_pages` has still never changed in my browser since i set the `places.history.expiration.max_pages` option in 2015 – Cauterite Apr 19 '19 at 01:36
  • @Cauterite: That's good then, after your previous comment I was under the impression that it no longer works. Could you also confirm that you have history entries from 2015? – user Apr 19 '19 at 03:24
  • 1
    @user You bet — i have all my history since *2014*. The changes i was worried about seem to add some new behaviour it detects low disk-space, so for now i recommend always keeping your FF profile on a volume with ample space. – Cauterite Apr 19 '19 at 04:13