Bug 479739 - Make location bar autocomplete even faster. r=sdwilsh
--- 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:
*/