Bug 708151 - Add indexes where needed in local bookmarks/history DB (r=blassey, a=mfinkle)
authorLucas Rocha <lucasr@mozilla.com>
Tue, 13 Dec 2011 14:46:58 +0000
changeset 84135 aae06ac0f572c007919c7db02678a5fd6aba629b
parent 84134 5a439e5fbf04d1963a45d9ab9a2a4462cdb701dc
child 84136 617f56ac76e61706074beb9551f79e4d387dde34
push id519
push userakeybl@mozilla.com
push dateWed, 01 Feb 2012 00:38:35 +0000
treeherdermozilla-beta@788ea1ef610b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersblassey, mfinkle
bugs708151
milestone11.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 708151 - Add indexes where needed in local bookmarks/history DB (r=blassey, a=mfinkle)
mobile/android/base/db/BrowserProvider.java
--- a/mobile/android/base/db/BrowserProvider.java
+++ b/mobile/android/base/db/BrowserProvider.java
@@ -245,44 +245,64 @@ public class BrowserProvider extends Con
                     Bookmarks.DESCRIPTION + " TEXT," +
                     Bookmarks.TAGS + " TEXT," +
                     Bookmarks.DATE_CREATED + " INTEGER," +
                     Bookmarks.DATE_MODIFIED + " INTEGER," +
                     Bookmarks.GUID + " TEXT," +
                     Bookmarks.IS_DELETED + " INTEGER NOT NULL DEFAULT 0" +
                     ");");
 
+            db.execSQL("CREATE INDEX bookmarks_url_index ON " + TABLE_BOOKMARKS + "("
+                    + Bookmarks.URL + ")");
+            db.execSQL("CREATE UNIQUE INDEX bookmarks_guid_index ON " + TABLE_BOOKMARKS + "("
+                    + Bookmarks.GUID + ")");
+            db.execSQL("CREATE INDEX bookmarks_modified_index ON " + TABLE_BOOKMARKS + "("
+                    + Bookmarks.DATE_MODIFIED + ")");
+
             Log.d(LOGTAG, "Creating " + TABLE_HISTORY + " table");
             db.execSQL("CREATE TABLE " + TABLE_HISTORY + "(" +
                     History._ID + " INTEGER PRIMARY KEY AUTOINCREMENT," +
                     History.TITLE + " TEXT," +
                     History.URL + " TEXT NOT NULL," +
                     History.VISITS + " INTEGER NOT NULL DEFAULT 0," +
                     History.DATE_LAST_VISITED + " INTEGER," +
                     History.DATE_CREATED + " INTEGER," +
                     History.DATE_MODIFIED + " INTEGER," +
                     History.GUID + " TEXT," +
                     History.IS_DELETED + " INTEGER NOT NULL DEFAULT 0" +
                     ");");
 
+            db.execSQL("CREATE INDEX history_url_index ON " + TABLE_HISTORY + "("
+                    + History.URL + ")");
+            db.execSQL("CREATE UNIQUE INDEX history_guid_index ON " + TABLE_HISTORY + "("
+                    + History.GUID + ")");
+            db.execSQL("CREATE INDEX history_modified_index ON " + TABLE_HISTORY + "("
+                    + History.DATE_MODIFIED + ")");
+            db.execSQL("CREATE INDEX history_visited_index ON " + TABLE_HISTORY + "("
+                    + History.DATE_LAST_VISITED + ")");
+
             Log.d(LOGTAG, "Creating " + TABLE_IMAGES + " table");
             db.execSQL("CREATE TABLE " + TABLE_IMAGES + " (" +
                     Images._ID + " INTEGER PRIMARY KEY AUTOINCREMENT," +
                     Images.URL + " TEXT UNIQUE NOT NULL," +
                     Images.FAVICON + " BLOB," +
                     Images.FAVICON_URL + " TEXT," +
                     Images.THUMBNAIL + " BLOB," +
                     Images.DATE_CREATED + " INTEGER," +
                     Images.DATE_MODIFIED + " INTEGER," +
                     Images.GUID + " TEXT," +
                     Images.IS_DELETED + " INTEGER NOT NULL DEFAULT 0" +
                     ");");
 
             db.execSQL("CREATE INDEX images_url_index ON " + TABLE_IMAGES + "("
                     + Images.URL + ")");
+            db.execSQL("CREATE UNIQUE INDEX images_guid_index ON " + TABLE_IMAGES + "("
+                    + Images.GUID + ")");
+            db.execSQL("CREATE INDEX images_modified_index ON " + TABLE_IMAGES + "("
+                    + Images.DATE_MODIFIED + ")");
 
             // FIXME: Create default bookmarks here
         }
 
         @Override
         public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
             Log.d(LOGTAG, "Upgrading browser.db: " + db.getPath() + " from " +
                     oldVersion + " to " + newVersion);