Bug 332934 r=annie.sullivan Fix places startup time by adding index on referrer.

This commit is contained in:
brettw%gmail.com 2006-04-20 18:04:00 +00:00
Родитель 5e767aadb6
Коммит 072daa0934
2 изменённых файлов: 13 добавлений и 2 удалений

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

@ -502,7 +502,7 @@ nsNavBookmarks::FillBookmarksHash()
rv = DBConn()->CreateStatement(NS_LITERAL_CSTRING(
"SELECT h.id "
"FROM moz_bookmarks b "
"JOIN moz_history h ON b.item_child = h.id"),
"LEFT JOIN moz_history h ON b.item_child = h.id where b.item_child IS NOT NULL"),
getter_AddRefs(statement));
NS_ENSURE_SUCCESS(rv, rv);
while (NS_SUCCEEDED(statement->ExecuteStep(&hasMore)) && hasMore) {
@ -523,7 +523,8 @@ nsNavBookmarks::FillBookmarksHash()
"FROM moz_bookmarks b "
"LEFT JOIN moz_historyvisit v1 on b.item_child = v1.page_id "
"LEFT JOIN moz_historyvisit v2 on v2.from_visit = v1.visit_id "
"WHERE v2.visit_type = 5 OR v2.visit_type = 6 " // perm. or temp. RDRs
"WHERE b.item_child IS NOT NULL "
"AND v2.visit_type = 5 OR v2.visit_type = 6 " // perm. or temp. RDRs
"GROUP BY v2.page_id"),
getter_AddRefs(statement));
NS_ENSURE_SUCCESS(rv, rv);

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

@ -532,6 +532,15 @@ nsNavHistory::InitDB(PRBool *aDoImport)
NS_ENSURE_SUCCESS(rv, rv);
}
// This must be outside of the visit creation above because the alpha1 shipped
// without this index. This makes a big difference in startup time for
// large profiles because of finding bookmark redirects using the referring
// page. For final release, if we think everybody running alpha1 has run
// alpha2 or later, we can put it in the if statement above for faster
// startup time (same as above for the moz_history_faviconindex)
mDBConn->ExecuteSimpleSQL(NS_LITERAL_CSTRING(
"CREATE INDEX moz_historyvisit_fromindex ON moz_historyvisit (from_visit)"));
rv = transaction.Commit();
NS_ENSURE_SUCCESS(rv, rv);
@ -2956,6 +2965,7 @@ nsNavHistory::LazyTimerCallback(nsITimer* aTimer, void* aClosure)
void
nsNavHistory::CommitLazyMessages()
{
mozStorageTransaction transaction(mDBConn, PR_TRUE);
for (PRUint32 i = 0; i < mLazyMessages.Length(); i ++) {
LazyMessage& message = mLazyMessages[i];
switch (message.type) {