summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSeif Lotfy <seif@lotfy.com>2012-12-31 02:18:58 +0100
committerSeif Lotfy <seif@lotfy.com>2012-12-31 02:18:58 +0100
commit6c6bb27da8d3e3ecfdcf2e2bfa14e21f1a420615 (patch)
tree3b8a512533c0ffae4ebf9eea87e725890b56c2b4
parent51a4579121d3f3a6b2a726a6a6f37c416a4a48b9 (diff)
Execute ANALYZE statement after each 1000 inserts
-rw-r--r--src/engine.vala4
-rw-r--r--src/sql.vala6
2 files changed, 9 insertions, 1 deletions
diff --git a/src/engine.vala b/src/engine.vala
index 8d7e1517..58a5bc0d 100644
--- a/src/engine.vala
+++ b/src/engine.vala
@@ -354,7 +354,9 @@ public class Engine : DbReader
{
handle_move_event (event);
}
-
+ // After every 1000 events we analyze the queries
+ if (event.id % 1000 == 0)
+ Idle.add((SourceFunc)database.analyze);
return event.id;
}
diff --git a/src/sql.vala b/src/sql.vala
index e208e771..1bb24685 100644
--- a/src/sql.vala
+++ b/src/sql.vala
@@ -445,6 +445,12 @@ namespace Zeitgeist.SQLite
assert_query_success (rc, "Payload insertion query error");
}
+ public bool analyze() throws EngineError
+ {
+ int rc = database.exec("ANALYZE");
+ assert_query_success (rc, "Event ID retrieval query error");
+ return false;
+ }
protected void update_callback (Sqlite.Action action,
string dbname, string table, int64 rowid)