http://www.sqlite.org/lang_analyze.html We should measure to see if this helps. We should be prepared to re-analyze when the weight of the database shifts -- e.g., after adding lots of visits or URLs.
Run ANALYZE on DB long query
I just did this and didn't see a measurable difference in top sites query timing, probably because there's not much one can do to improve a scanning query like that. We can revisit this when we materialize frecency data: it'll make a difference then.