mirror of
https://github.com/M66B/FairEmail.git
synced 2025-02-23 22:51:02 +00:00
Analyze before vacuum
This commit is contained in:
parent
358711e2dc
commit
46bf264f1c
1 changed files with 10 additions and 8 deletions
|
@ -292,6 +292,16 @@ public class WorkerCleanup extends Worker {
|
|||
int logs = db.log().deleteLogs(now - KEEP_LOG_DURATION);
|
||||
Log.i("Deleted logs=" + logs);
|
||||
|
||||
if (BuildConfig.DEBUG) {
|
||||
// https://sqlite.org/lang_analyze.html
|
||||
Log.i("Analyze");
|
||||
long start = new Date().getTime();
|
||||
try (Cursor cursor = db.getOpenHelper().getWritableDatabase().query("PRAGMA analysis_limit=1000; PRAGMA optimize;")) {
|
||||
cursor.moveToNext();
|
||||
}
|
||||
EntityLog.log(context, "Analyze=" + (new Date().getTime() - start) + " ms");
|
||||
}
|
||||
|
||||
if (manual) {
|
||||
// https://www.sqlite.org/lang_vacuum.html
|
||||
long size = context.getDatabasePath(db.getOpenHelper().getDatabaseName()).length();
|
||||
|
@ -306,14 +316,6 @@ public class WorkerCleanup extends Worker {
|
|||
" size=" + Helper.humanReadableByteCount(size) +
|
||||
"/" + Helper.humanReadableByteCount(available));
|
||||
}
|
||||
|
||||
if (BuildConfig.DEBUG) {
|
||||
// https://sqlite.org/lang_analyze.html
|
||||
Log.i("Analyze");
|
||||
try (Cursor cursor = db.getOpenHelper().getWritableDatabase().query("PRAGMA analysis_limit=1000; PRAGMA optimize;")) {
|
||||
cursor.moveToNext();
|
||||
}
|
||||
}
|
||||
} catch (Throwable ex) {
|
||||
Log.e(ex);
|
||||
} finally {
|
||||
|
|
Loading…
Reference in a new issue