Commit 767950c1 authored by Jens Georg's avatar Jens Georg
Browse files

Add indexs to PhotoTable



To speed up duplicate searches. This is the first try on my rather limited set
of images; if these don't provide a decent speedup, we might need to create
some covering indexes.
Signed-off-by: Jens Georg's avatarJens Georg <mail@jensge.org>

https://bugzilla.gnome.org/show_bug.cgi?id=742670
parent 2744ffdc
......@@ -158,6 +158,33 @@ public class PhotoTable : DatabaseTable {
if (res2 != Sqlite.DONE)
fatal("create photo table", res2);
// These are for duplicate searches
// https://bugzilla.gnome.org/show_bug.cgi?id=742670
//
// 1) index on md5,file_format
res = db.prepare_v2 ("CREATE UNIQUE INDEX IF NOT EXISTS PhotoTableMD5Format on PhotoTable(md5, file_format)", -1, out stmt);
assert (res == Sqlite.OK);
res = stmt.step ();
if (res == Sqlite.DONE) {
DatabaseTable.warning ("Failed to create index on md5 and file_format", res);
}
// 2) index on thumbnail_md5,file_format
res = db.prepare_v2 ("CREATE UNIQUE INDEX IF NOT EXISTS PhotoTableThumbnailMD5Format on PhotoTable(md5, file_format)", -1, out stmt);
assert (res == Sqlite.OK);
res = stmt.step ();
if (res == Sqlite.DONE) {
DatabaseTable.warning ("Failed to create index on md5 and file_format", res);
}
// 3) index on thumbnail_md5,md5
res = db.prepare_v2 ("CREATE UNIQUE INDEX IF NOT EXISTS PhotoTableThumbnailMD5MD5 on PhotoTable(thumbnail_md5, md5)", -1, out stmt);
assert (res == Sqlite.OK);
res = stmt.step ();
if (res == Sqlite.DONE) {
DatabaseTable.warning ("Failed to create index on thumbnail_md5 and md5", res);
}
set_table_name("PhotoTable");
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment