mirror of
https://github.com/GoldenCheetah/GoldenCheetah.git
synced 2026-02-13 16:18:42 +00:00
Improve metricDB query performance
Remarkably, using transactions even when querying SQLITE databases improves performance. If you have a lot of metric charts on the home window then this patch will make startup a lot faster. Additionally, as we refresh the charts as rides are added and deleted this should help to reduce the performance impact when lots of charts are open. There is an SQLITE performance FAQ that provides more background here; http://web.utk.edu/~jplyon/sqlite/SQLite_optimization_FAQ.html
This commit is contained in:
@@ -293,7 +293,13 @@ MetricAggregator::getAllMetricsFor(QDateTime start, QDateTime end)
|
||||
qDebug()<<"lost db connection?";
|
||||
return empty;
|
||||
}
|
||||
return dbaccess->getAllMetricsFor(start, end);
|
||||
|
||||
// apparently using transactions for queries
|
||||
// can improve performance!
|
||||
dbaccess->connection().transaction();
|
||||
QList<SummaryMetrics> results = dbaccess->getAllMetricsFor(start, end);
|
||||
dbaccess->connection().commit();
|
||||
return results;
|
||||
}
|
||||
|
||||
QList<SummaryMetrics>
|
||||
|
||||
Reference in New Issue
Block a user