Bug 381795 places indexes need review (r=sspitzer)

This commit is contained in:
dietrich@mozilla.com 2007-11-01 20:24:03 -07:00
parent 81a003c93d
commit 46395e4413
2 changed files with 10 additions and 13 deletions

View File

@ -251,9 +251,6 @@ nsAnnotationService::InitTables(mozIStorageConnection* aDBConn)
"dateAdded INTEGER DEFAULT 0,"
"lastModified INTEGER DEFAULT 0)"));
NS_ENSURE_SUCCESS(rv, rv);
rv = aDBConn->ExecuteSimpleSQL(NS_LITERAL_CSTRING(
"CREATE INDEX moz_annos_place_idindex ON moz_annos (place_id)"));
NS_ENSURE_SUCCESS(rv, rv);
rv = aDBConn->ExecuteSimpleSQL(NS_LITERAL_CSTRING(
"CREATE INDEX moz_annos_attributesindex ON moz_annos (anno_attribute_id)"));
NS_ENSURE_SUCCESS(rv, rv);
@ -283,9 +280,6 @@ nsAnnotationService::InitTables(mozIStorageConnection* aDBConn)
"dateAdded INTEGER DEFAULT 0,"
"lastModified INTEGER DEFAULT 0)"));
NS_ENSURE_SUCCESS(rv, rv);
rv = aDBConn->ExecuteSimpleSQL(NS_LITERAL_CSTRING(
"CREATE INDEX moz_annos_item_idindex ON moz_items_annos (item_id)"));
NS_ENSURE_SUCCESS(rv, rv);
rv = aDBConn->ExecuteSimpleSQL(NS_LITERAL_CSTRING(
"CREATE INDEX moz_items_annos_attributesindex ON moz_items_annos (item_id, anno_attribute_id)"));
NS_ENSURE_SUCCESS(rv, rv);

View File

@ -677,10 +677,6 @@ nsNavHistory::InitDB(PRBool *aDoImport)
rv = mDBConn->ExecuteSimpleSQL(
NS_LITERAL_CSTRING("CREATE INDEX moz_places_urlindex ON moz_places (url)"));
NS_ENSURE_SUCCESS(rv, rv);
rv = mDBConn->ExecuteSimpleSQL(
NS_LITERAL_CSTRING("CREATE INDEX moz_places_titleindex ON moz_places (title)"));
NS_ENSURE_SUCCESS(rv, rv);
}
// FIXME: this should be moved inside the moz_places table creation block.
@ -1069,7 +1065,7 @@ nsNavHistory::CleanUpOnQuit()
NS_LITERAL_CSTRING("CREATE INDEX moz_places_hostindex ON moz_places (rev_host)"));
NS_ENSURE_SUCCESS(rv, rv);
rv = mDBConn->ExecuteSimpleSQL(
NS_LITERAL_CSTRING("CREATE INDEX moz_places_visitcount ON moz_places (rev_host)"));
NS_LITERAL_CSTRING("CREATE INDEX moz_places_visitcount ON moz_places (visit_count)"));
NS_ENSURE_SUCCESS(rv, rv);
// 5. copy all data into moz_places
@ -1085,6 +1081,15 @@ nsNavHistory::CleanUpOnQuit()
NS_ENSURE_SUCCESS(rv, rv);
transaction.Commit();
}
// bug #381795 - remove unused indexes
mozStorageTransaction idxTransaction(mDBConn, PR_FALSE);
rv = mDBConn->ExecuteSimpleSQL(
NS_LITERAL_CSTRING("DROP INDEX IF EXISTS moz_places_titleindex"));
rv = mDBConn->ExecuteSimpleSQL(
NS_LITERAL_CSTRING("DROP INDEX IF EXISTS moz_annos_item_idindex"));
idxTransaction.Commit();
return NS_OK;
}
@ -4958,8 +4963,6 @@ nsNavHistory::CreateLookupIndexes()
rv = mDBConn->ExecuteSimpleSQL(
NS_LITERAL_CSTRING("CREATE INDEX moz_places_visitcount ON moz_places (visit_count)"));
//NS_ENSURE_SUCCESS(rv, rv);
rv = mDBConn->ExecuteSimpleSQL(
NS_LITERAL_CSTRING("CREATE INDEX moz_places_titleindex ON moz_places (title)"));
// Visit table indexes
rv = mDBConn->ExecuteSimpleSQL(