Bug 479739 - Make location bar autocomplete even faster. r=sdwilsh
authorEdward Lee <edward.lee@engineering.uiuc.edu>
Wed, 25 Feb 2009 21:46:13 -0800
changeset 25530 0fa543fc5ed5ea14bd72cbfa021cf7ebe115a0ba
parent 25529 1b9db4b7c6049705e8aad30ef1ecc8e93e1c8a66
child 25532 63e4495a9b1e8f45f728f122049a7ba4083422cd
push id5594
push useredward.lee@engineering.uiuc.edu
push dateThu, 26 Feb 2009 05:46:29 +0000
treeherdermozilla-central@0fa543fc5ed5 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssdwilsh
bugs479739
milestone1.9.2a1pre
Bug 479739 - Make location bar autocomplete even faster. r=sdwilsh
toolkit/components/places/src/nsNavHistoryAutoComplete.cpp
--- a/toolkit/components/places/src/nsNavHistoryAutoComplete.cpp
+++ b/toolkit/components/places/src/nsNavHistoryAutoComplete.cpp
@@ -197,31 +197,25 @@ void GetAutoCompleteBaseQuery(nsACString
 // slower. Limiting moz_places with OFFSET+LIMIT will mostly help speed
 // of first chunks, that are usually most wanted.
 // Can do this only if there aren't additional conditions on final resultset.
 
 // Note: h.frecency is selected because we need it for ordering, but will
 // not be read later and we don't have an associated kAutoCompleteIndex_
   aQuery = NS_LITERAL_CSTRING(
       "SELECT h.url, h.title, f.url") + BOOK_TAG_SQL + NS_LITERAL_CSTRING(", "
-        "h.visit_count, h.typed, h.frecency "
-      "FROM moz_places_temp h "
+        "h.visit_count, h.typed "
+      "FROM ("
+        "SELECT * FROM moz_places_temp "
+        "UNION ALL "
+        "SELECT * FROM moz_places "
+        "ORDER BY frecency DESC LIMIT ?2 OFFSET ?3) h "
       "LEFT OUTER JOIN moz_favicons f ON f.id = h.favicon_id "
       "WHERE h.frecency <> 0 "
-      "{ADDITIONAL_CONDITIONS} "
-      "UNION ALL "
-      "SELECT h.url, h.title, f.url") + BOOK_TAG_SQL + NS_LITERAL_CSTRING(", "
-        "h.visit_count, h.typed, h.frecency "
-      "FROM moz_places h "
-      "LEFT OUTER JOIN moz_favicons f ON f.id = h.favicon_id "
-      "WHERE h.id NOT IN (SELECT id FROM moz_places_temp) "
-      "AND h.frecency <> 0 "
-      "{ADDITIONAL_CONDITIONS} "
-      // ORDER BY h.frecency
-      "ORDER BY 9 DESC LIMIT ?2 OFFSET ?3");
+      "{ADDITIONAL_CONDITIONS}");
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 //// nsNavHistoryAutoComplete Helper Functions
 
 /**
  * Returns true if the string starts with javascript:
  */