zyguan
2/20/2016 - 12:10 PM

top_10_hosts.sql

-- Firefox saves your browsing history data in places.sqlite. So it's 
-- possible to know about your behavior by a sql select statement.
-- Here is an example.
-- 
-- (https://support.mozilla.org/en-US/kb/recovering-important-data-from-an-old-profile)
--

SELECT host, count(*) FROM moz_historyvisits h LEFT JOIN
  (SELECT id, substr(substr(url, instr(url,'://')+3),
                     0,instr(substr(url, instr(url,'://')+3),'/')) AS host
   FROM moz_places WHERE substr(url,0,5) = 'http') p ON h.place_id = p.id
GROUP BY host ORDER BY count(*) DESC LIMIT 10;