UI: StatManager: Vacuum on bulk deletes.

This commit is contained in:
Nodir Temirkhodjaev 2021-05-12 19:18:10 +03:00
parent b88e396df2
commit 25bbd18d3b
3 changed files with 8 additions and 2 deletions

View File

@ -214,6 +214,8 @@ bool StatManager::clear()
if (!sqliteDb()->execute(StatSql::sqlClear)) if (!sqliteDb()->execute(StatSql::sqlClear))
return false; return false;
sqliteDb()->execute(StatSql::sqlVacuum);
clearAppIdCache(); clearAppIdCache();
quotaManager()->clear(); quotaManager()->clear();
@ -401,6 +403,8 @@ bool StatManager::deleteConnAll()
sqliteDb()->stmt(StatSql::sqlDeleteAllConnBlock) }, sqliteDb()->stmt(StatSql::sqlDeleteAllConnBlock) },
sqliteDb()->stmt(StatSql::sqlSelectDeletedAllConnAppList)); sqliteDb()->stmt(StatSql::sqlSelectDeletedAllConnAppList));
sqliteDb()->execute(StatSql::sqlVacuum);
sqliteDb()->commitTransaction(); sqliteDb()->commitTransaction();
m_connBlockIdMin = m_connBlockIdMax = 0; m_connBlockIdMin = m_connBlockIdMax = 0;

View File

@ -203,5 +203,6 @@ const char *const StatSql::sqlClear = "DELETE FROM app;"
"DELETE FROM conn;" "DELETE FROM conn;"
"DELETE FROM conn_block;" "DELETE FROM conn_block;"
"DELETE FROM conn_traffic;" "DELETE FROM conn_traffic;"
"DELETE FROM conn_flow;" "DELETE FROM conn_flow;";
"VACUUM;";
const char *const StatSql::sqlVacuum = "VACUUM;";

View File

@ -81,6 +81,7 @@ public:
static const char *const sqlSelectDeletedAllConnAppList; static const char *const sqlSelectDeletedAllConnAppList;
static const char *const sqlClear; static const char *const sqlClear;
static const char *const sqlVacuum;
}; };
#endif // STATSQL_H #endif // STATSQL_H