Backout 6831521f03ac to fix Bug 446621 - Slowdown on AutoComplete - AwesomeBar. a=beltzner
authorEdward Lee <edward.lee@engineering.uiuc.edu>
Tue, 22 Jul 2008 08:49:39 -0700
changeset 16116 16708f23daf5fbf23e298eeb28d7693e42ec6d34
parent 16115 c43960703c42efce10bac54baee5c3ff58c18555
child 16117 94c517bad31b36e42aa2729f82ff2922c228e6ef
child 16136 9d9941eacb14827fdab4716710042fdde84eb60d
push id777
push useredward.lee@engineering.uiuc.edu
push dateTue, 22 Jul 2008 15:50:07 +0000
treeherdermozilla-central@16708f23daf5 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbeltzner
bugs446621
milestone1.9.1a1pre
backs out6831521f03ac63ba33b6804656f78c4ea6108355
Backout 6831521f03ac to fix Bug 446621 - Slowdown on AutoComplete - AwesomeBar. a=beltzner
toolkit/components/places/src/nsNavHistoryAutoComplete.cpp
--- a/toolkit/components/places/src/nsNavHistoryAutoComplete.cpp
+++ b/toolkit/components/places/src/nsNavHistoryAutoComplete.cpp
@@ -254,19 +254,25 @@ nsNavHistory::CreateAutoCompleteQueries(
 {
   // Define common pieces of various queries
   nsCString sqlHead = NS_LITERAL_CSTRING(
     "SELECT h.url, h.title, f.url") + BOOK_TAG_SQL + NS_LITERAL_CSTRING(", "
       "h.visit_count "
     "FROM moz_places h "
     "LEFT OUTER JOIN moz_favicons f ON f.id = h.favicon_id "
     "WHERE h.frecency <> 0 ");
+  // NOTE:
+  // after migration or clear all private data, we might end up with
+  // a lot of places with frecency < 0 (until idle)
+  //
+  // XXX bug 412736
+  // in the case of a frecency tie, break it with h.typed and h.visit_count
+  // which is better than nothing.  but this is slow, so not doing it yet.
   nsCString sqlTail = NS_LITERAL_CSTRING(
-    "ORDER BY h.frecency DESC, h.typed DESC, h.visit_count DESC "
-    "LIMIT ?2 OFFSET ?3");
+    "ORDER BY h.frecency DESC LIMIT ?2 OFFSET ?3");
 
   nsresult rv = mDBConn->CreateStatement(sqlHead + (mAutoCompleteOnlyTyped ?
       NS_LITERAL_CSTRING("AND h.typed = 1 ") : EmptyCString()) + sqlTail,
     getter_AddRefs(mDBAutoCompleteQuery));
   NS_ENSURE_SUCCESS(rv, rv);
 
   rv = mDBConn->CreateStatement(sqlHead +
       NS_LITERAL_CSTRING("AND h.visit_count > 0 ") + sqlTail,
@@ -287,17 +293,17 @@ nsNavHistory::CreateAutoCompleteQueries(
     "SELECT h.url, h.title, f.url") + BOOK_TAG_SQL + NS_LITERAL_CSTRING(", "
       "h.visit_count, "
       "ROUND(MAX(((i.input = ?2) + (SUBSTR(i.input, 1, LENGTH(?2)) = ?2)) * "
                 "i.use_count), 1) rank "
     "FROM moz_inputhistory i "
     "JOIN moz_places h ON h.id = i.place_id "
     "LEFT OUTER JOIN moz_favicons f ON f.id = h.favicon_id "
     "GROUP BY i.place_id HAVING rank > 0 "
-    "ORDER BY rank DESC, h.frecency DESC, h.typed DESC, h.visit_count DESC");
+    "ORDER BY rank DESC, h.frecency DESC");
   rv = mDBConn->CreateStatement(sql, getter_AddRefs(mDBAdaptiveQuery));
   NS_ENSURE_SUCCESS(rv, rv);
 
   sql = NS_LITERAL_CSTRING(
     "SELECT REPLACE(s.url, '%s', ?2) search_url, h.title, IFNULL(f.url, "
       "(SELECT f.url "
        "FROM moz_places r "
        "JOIN moz_favicons f ON f.id = r.favicon_id "
@@ -531,17 +537,17 @@ nsNavHistory::StartSearch(const nsAStrin
         if (i)
           sql += NS_LITERAL_CSTRING(",");
 
         // +2 to skip over the ?1 for the tag root parameter
         sql += nsPrintfCString("?%d", i + 2);
       }
 
       sql += NS_LITERAL_CSTRING(") "
-        "ORDER BY h.frecency DESC, h.typed DESC, h.visit_count DESC");
+        "ORDER BY h.frecency DESC");
 
       rv = mDBConn->CreateStatement(sql, getter_AddRefs(mDBPreviousQuery));
       NS_ENSURE_SUCCESS(rv, rv);
 
       // Collect the previous result's URLs that we want to process
       nsStringArray urls;
       (void)mCurrentResultURLs.EnumerateRead(HashedURLsToArray, &urls);