Mercurial > hg > orthanc
changeset 7155:12bcfedb323a
perform SQL analyze only once we have 50 studies in the DB
| author | Alain Mazy <am@orthanc.team> |
|---|---|
| date | Wed, 23 Sep 2026 15:47:45 +0200 |
| parents | b1f7adfc3847 |
| children | 8c8be0a58e46 |
| files | OrthancFramework/Sources/SQLite/Connection.cpp |
| diffstat | 1 files changed, 3 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/OrthancFramework/Sources/SQLite/Connection.cpp Thu Sep 17 19:49:04 2026 +0200 +++ b/OrthancFramework/Sources/SQLite/Connection.cpp Wed Sep 23 15:47:45 2026 +0200 @@ -54,7 +54,7 @@ #endif #include <sqlite3.h> - +#include <boost/lexical_cast.hpp> namespace Orthanc { @@ -238,9 +238,9 @@ { if (!DoesTableExist("sqlite_stat1")) // create the table if it does not exist yet and if there are enough data in the Resources table { - Statement countResources(*this, "SELECT COUNT(*) FROM Resources"); + Statement countResources(*this, std::string("SELECT COUNT(*) FROM Resources WHERE resourceType=") + boost::lexical_cast<std::string>(ResourceType_Study)); countResources.Step(); - if (countResources.ColumnInt64(0) > 1000) // no need to ANALYZE if there are not enough data in the table + if (countResources.ColumnInt64(0) > 50) // no need to ANALYZE if there are not enough data in the table (wait for 50 studies) { CLOG(WARNING, SQLITE) << "SQLite: Performing first ANALYZE to improve the query planner"; Statement analyze(*this, "ANALYZE");
