fix for bug #407124: performance problem with expiration code due to query in FindVisits() for people with lots of history. patch=Marco Bonardo <mak77@supereva.it> r=sspitzer, dietrich a=blocking-firefox-3+ p1 / m10

This commit is contained in:
sspitzer@mozilla.org 2007-12-07 09:44:57 -08:00
Родитель 904745fbad
Коммит 5784e1be45
1 изменённых файлов: 5 добавлений и 5 удалений

Просмотреть файл

@ -433,9 +433,9 @@ nsNavHistoryExpire::FindVisits(PRTime aExpireThreshold, PRUint32 aNumToExpire,
// is bookmarked or not. // is bookmarked or not.
nsCAutoString sqlBase; nsCAutoString sqlBase;
sqlBase.AssignLiteral( sqlBase.AssignLiteral(
"SELECT v.id, v.place_id, v.visit_date, h.url, h.favicon_id, h.hidden, b.fk " "SELECT v.id, v.place_id, v.visit_date, h.url, h.favicon_id, h.hidden, "
"FROM moz_places h LEFT OUTER JOIN moz_historyvisits v ON h.id = v.place_id " "(SELECT fk FROM moz_bookmarks WHERE fk = h.id) "
"LEFT OUTER JOIN moz_bookmarks b on h.id = b.fk "); "FROM moz_places h JOIN moz_historyvisits v ON h.id = v.place_id ");
// 1. Expire records older than the max-age cap // 1. Expire records older than the max-age cap
nsCAutoString sqlMaxAge; nsCAutoString sqlMaxAge;
@ -444,7 +444,7 @@ nsNavHistoryExpire::FindVisits(PRTime aExpireThreshold, PRUint32 aNumToExpire,
if (aNumToExpire) { if (aNumToExpire) {
// Select records older than the max-age cap // Select records older than the max-age cap
sqlMaxAge.AppendLiteral("WHERE v.visit_date < ?1 " sqlMaxAge.AppendLiteral("WHERE v.visit_date < ?1 "
"ORDER BY v.visit_date DESC LIMIT ?2"); "ORDER BY v.visit_date ASC LIMIT ?2");
} }
nsCOMPtr<mozIStorageStatement> selectStatement; nsCOMPtr<mozIStorageStatement> selectStatement;