Try to optimize when closing the sqlite connection
This commit is contained in:
@@ -47,6 +47,12 @@ namespace Database
|
||||
prepare();
|
||||
}
|
||||
|
||||
~Connection()
|
||||
{
|
||||
// make use of per-connection usage stats to optimize
|
||||
optimize();
|
||||
}
|
||||
|
||||
private:
|
||||
Connection& operator=(const Connection&) = delete;
|
||||
|
||||
@@ -64,6 +70,13 @@ namespace Database
|
||||
LMS_LOG(DB, DEBUG) << "Setting per-connection settings done!";
|
||||
}
|
||||
|
||||
void optimize()
|
||||
{
|
||||
LMS_LOG(DB, DEBUG) << "connection close: Running pragma optimize...";
|
||||
executeSql("pragma optimize");
|
||||
LMS_LOG(DB, DEBUG) << "connection close: pragma optimize complete";
|
||||
}
|
||||
|
||||
std::filesystem::path _dbPath;
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user