summaryrefslogtreecommitdiffstats
path: root/src/bmserver
diff options
context:
space:
mode:
authorjasplin <qt-info@nokia.com>2010-03-19 15:30:24 +0100
committerjasplin <qt-info@nokia.com>2010-03-19 15:30:24 +0100
commit0e07ec93cb389af37f3b4a3f6abfd5d599f32186 (patch)
tree7541bc5899b6229f45300e4b23633eb2ee6bdbc2 /src/bmserver
parent22807b3aaf4f1bb07a088124c50f6d8900a2fb72 (diff)
Added index to result table to speed up fetching a basic time series.
The result table is now indexed on (bmcontextId, timestamp) which speeds up fetching a time series that doesn't need the snapshot, typically: SELECT timestamp, value FROM result \ WHERE bmcontextId=... \ ORDER BY timestamp ASC;
Diffstat (limited to 'src/bmserver')
-rw-r--r--src/bmserver/main.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/bmserver/main.cpp b/src/bmserver/main.cpp
index 7da8be0..dd57b96 100644
--- a/src/bmserver/main.cpp
+++ b/src/bmserver/main.cpp
@@ -176,7 +176,12 @@ static bool initDatabase(const QString &dbfile, QString *error)
ok = query.exec("CREATE INDEX index_result_timestamp ON result(timestamp);");
Q_ASSERT(ok);
- ok = query.exec("CREATE INDEX index_result_all ON result(snapshotId, bmcontextId);");
+ ok = query.exec(
+ "CREATE INDEX index_result_bmcontextId_timestamp ON result(bmcontextId, timestamp);");
+ Q_ASSERT(ok);
+
+ ok = query.exec(
+ "CREATE INDEX index_result_bmcontextId_snapshotId ON result(bmcontextId, snapshotId);");
Q_ASSERT(ok);
ok = query.exec("CREATE INDEX index_index_name ON index_(name);");