Bug 723044 - Don't trigger moz_hosts frecency update when updating frecency on idle.

r=dietrich
This commit is contained in:
Marco Bonardo 2012-02-07 15:59:09 +01:00
Родитель f5ceac8dc9
Коммит faa872ff80
2 изменённых файлов: 13 добавлений и 1 удалений

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

@ -3933,6 +3933,8 @@ nsNavHistory::DecayFrecency()
// values of pages that haven't been visited for a while, i.e., they do
// not get an updated frecency. A scaling factor of .975 results in .5 the
// original value after 28 days.
// When changing the scaling factor, ensure that the barrier in
// moz_places_afterupdate_frecency_trigger still ignores these changes.
nsCOMPtr<mozIStorageAsyncStatement> decayFrecency = mDB->GetAsyncStatement(
"UPDATE moz_places SET frecency = ROUND(frecency * .975) "
"WHERE frecency > 0"

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

@ -106,13 +106,23 @@
"END" \
)
// For performance reasons the host frecency is updated only when the page
// frecency changes by a meaningful percentage. This is because the frecency
// decay algorithm requires to update all the frecencies at once, causing a
// too high overhead, while leaving the ordering unchanged.
#define CREATE_PLACES_AFTERUPDATE_TRIGGER NS_LITERAL_CSTRING( \
"CREATE TEMP TRIGGER moz_places_afterupdate_frecency_trigger " \
"AFTER UPDATE OF frecency ON moz_places FOR EACH ROW " \
"WHEN NEW.frecency >= 0 " \
"AND ABS(" \
"IFNULL((NEW.frecency - OLD.frecency) / CAST(NEW.frecency AS REAL), " \
"(NEW.frecency - OLD.frecency))" \
") > .05 " \
"BEGIN " \
"UPDATE moz_hosts " \
"SET frecency = (SELECT MAX(frecency) FROM moz_places WHERE rev_host = NEW.rev_host OR rev_host = NEW.rev_host || 'www.') " \
"SET frecency = (SELECT MAX(frecency) FROM moz_places " \
"WHERE rev_host = NEW.rev_host " \
"OR rev_host = NEW.rev_host || 'www.') " \
"WHERE host = fixup_url(get_unreversed_host(NEW.rev_host)); " \
"END" \
)