Firefox 29 - how do I delete history entries visited fewer than x times

Solution 1:

With some research (see at end for 'references'), I've come up with this (kind of) simple solution:


BACKUP FIRST. CLOSE FIREFOX FIRST


This requires you to edit the SQLite Database (a self-contained SQL database; see Wikipedia article) of Mozilla Firefox by making a query to find all records that satisfy the condition (in your case - viewed less than 5 times and not visited in the last 120 days).


BACKUP FIRST. CLOSE FIREFOX FIRST

Instructions start:


This works (tested and working with my Firefox v. 29.0.1). In 12 easy(ish) steps:

  1. Install SQLite Database Browser

  2. Open it

  3. Click Open Database

  4. Navigate to C:\Users\[USER]\AppData\Roaming\Mozilla\Firefox\Profiles\[PROFILE] editing as required

    BACKUP THE FOLLOWING FILE FIRST!!

  5. Open places.sqlite from the directory you opened in step 4.

    SERIOUSLY, BACKUP FIRST!!

  6. Click the Execute SQL tab.

  7. Enter this:

    SELECT *
    FROM moz_places
    WHERE
        last_visit_date BETWEEN strftime('%s','2014-04-01')*1000000
                        AND strftime('%s','2014-05-30')*1000000
        AND visit_count < x(2)
    
  8. Replace x(2) to 5 (in your example)

  9. Replace 2014-04-01 and 2014-05-30 with the range of dates you want

  10. Press the blue play button.

  11. Check if the sites displayed are correct (they should be, but double check!)

  12. If they are, then replace the first two lines of the above code with:

    DELETE
    FROM moz_places
    

    so your code looks something like:

    DELETE
    FROM moz_places
    WHERE
        last_visit_date BETWEEN strftime('%s','2014-04-01')*1000000
                        AND strftime('%s','2014-05-30')*1000000
        AND visit_count < x(2)
    

DONE! Close the program and click save when closing.

Instructions end


What about the last_visit_date?

The last_visit_date looks encrypted to my naked eye, but I can't see in which way.

I wouldn't call it 'encrypted' (although I don't disagree that it looks encrypted). It's just in another 'system'. The date is in the Unix time system (or Epoch / POSIX). It's the number of seconds that have passed since 00:00:00 (UTC) 1st January 1970. 1 hour is 3600 seconds. 1 year is 31556926 days.

For more info. check this Wikipedia article out, or this website that converts time to and from epoch time.


Screenshots (ignore the SQL queries on these images, they are wrong. These are to tell you mostly where to be looking)

SQLite Database BrowserSQLite Database BrowserSQLite Database Browser

Thanks to ;):

  • How to write an SQL query for SQLite Manager for Firefox places.sqlite?
  • need help pulling up history on specific date (Firefox support forum)
  • SQL DELETE Statement (w3schools)
  • How do I decode the Last_Date_ Visited field in the places.sqlite db? (Firefox support forum)