Closed Bug 407298 Opened 18 years ago Closed 17 years ago

when expiring visits older than the max-age cap, we aren't deleting the oldest first?

Categories

(Firefox :: Bookmarks & History, defect)

x86
All
defect
Not set
normal

Tracking

()

RESOLVED WORKSFORME

People

(Reporter: moco, Unassigned)

Details

when expiring visits older than the max-age cap, we aren't deleting the oldest first? about this code in nsNavHistoryExpire.cpp: // Select records older than the max-age cap // Setting the visit cap as the OFFSET value selects the next aNumToExpire // records above the cap. sqlMinAge.AppendLiteral("WHERE v.visit_date < ?1 " "ORDER BY v.visit_date DESC LIMIT ?2 OFFSET ?3"); could we do: // Select records older than the max-age cap // Setting the visit cap as the OFFSET value selects the next aNumToExpire // records above the cap. sqlMinAge.AppendLiteral("WHERE v.visit_date < ?1 " "ORDER BY v.visit_date ASC LIMIT ?2") and use mHistory->mExpireSites as the second param? order by visit date ascending should mean the oldest to newest, and then we'd remove the oldest <mHistory->mExpireSites> visits first, right?
> That depends on if the cost of the sorting is more or less than the cost of the > OFFSET. we have to sort either way (asc or desc), right? I guess I don't see how the current code is correct (even though I remember reviewing and discussing it!) > It'd be interesting to quantify the distribution of the performance boost for > the first query. We should isolate and measure the DESC -> ASC change. the change in bug #407124 is the "performance boost for the first query" makes the query super fast, at least with the dreaded ispiked profile.
(In reply to comment #1) > > That depends on if the cost of the sorting is more or less than the cost of the > > OFFSET. > > we have to sort either way (asc or desc), right? > > I guess I don't see how the current code is correct (even though I remember > reviewing and discussing it!) yes, we should be deleting oldest first.
sqlMinAge.AppendLiteral("WHERE v.visit_date < ?1 " "ORDER BY v.visit_date DESC LIMIT ?2 OFFSET ?3"); this order from the newer to the older, then goes to offset 40000 (that is the cap), then takes the first 50. clearly it will not delete oldest visits, but instead will delete newest visits over the cap. sqlMinAge.AppendLiteral("WHERE v.visit_date < ?1 " "ORDER BY v.visit_date ASC LIMIT ?2") this order from older to newer and takes the 50 oldest, but there is no way to use the 40000 cap here, since you can start from a point and go on, but you cannot know if there are more than 40000 entries
we are, actually, so resolving wfm
Status: NEW → RESOLVED
Closed: 17 years ago
Resolution: --- → WORKSFORME
Bug 451915 - move Firefox/Places bugs to Firefox/Bookmarks and History. Remove all bugspam from this move by filtering for the string "places-to-b-and-h". In Thunderbird 3.0b, you do that as follows: Tools | Message Filters Make sure the correct account is selected. Click "New" Conditions: Body contains places-to-b-and-h Change the action to "Delete Message". Select "Manually Run" from the dropdown at the top. Click OK. Select the filter in the list, make sure "Inbox" is selected at the bottom, and click "Run Now". This should delete all the bugspam. You can then delete the filter. Gerv
Component: Places → Bookmarks & History
QA Contact: places → bookmarks
You need to log in before you can comment on or make changes to this bug.