# HG changeset patch # User Alain Mazy # Date 1791448470 -7200 # Node ID 47f2edc0200da0c506aca181eb65f2b70c2c0628 # Parent 35d32f786499f19ea944bc8bbfa9810244be2081 cleanup + disabled analyze/optimize for good diff -r 35d32f786499 -r 47f2edc0200d NEWS --- a/NEWS Thu Oct 08 09:15:18 2026 +0200 +++ b/NEWS Thu Oct 08 10:34:30 2026 +0200 @@ -6,8 +6,6 @@ * With the default SQLite database: - Optimized some queries to access single resources. - - Optimized many queries thanks to improved query planning. An Optimization step can - sometimes run at startup which slows down the Orthanc startup. - Added/updated 2 indexes: the first startup with this version migth be slower to rebuild these indexes. diff -r 35d32f786499 -r 47f2edc0200d OrthancFramework/Sources/SQLite/Connection.cpp --- a/OrthancFramework/Sources/SQLite/Connection.cpp Thu Oct 08 09:15:18 2026 +0200 +++ b/OrthancFramework/Sources/SQLite/Connection.cpp Thu Oct 08 10:34:30 2026 +0200 @@ -232,6 +232,7 @@ return false; } + // currently not used but it might be useful in the future if we want to add an "optimize-db" API route void Connection::Optimize(bool onlyIfStatsDontExistsYet) { if (onlyIfStatsDontExistsYet) diff -r 35d32f786499 -r 47f2edc0200d OrthancServer/Sources/Database/SQLiteDatabaseWrapper.cpp --- a/OrthancServer/Sources/Database/SQLiteDatabaseWrapper.cpp Thu Oct 08 09:15:18 2026 +0200 +++ b/OrthancServer/Sources/Database/SQLiteDatabaseWrapper.cpp Thu Oct 08 10:34:30 2026 +0200 @@ -2899,9 +2899,6 @@ LOG(INFO) << "Installing the \"AttachedFilesUuidIndex\" index"; ExecuteEmbeddedScript(db_, ServerResources::INSTALL_ATTACHED_FILES_UUID_INDEX); } - - // // New in Orthanc 1.13.1 run optimize at each startup, provided there are enough data to perform a relevant analysis - // Optimize(false); } transaction->Commit(0); @@ -3035,7 +3032,7 @@ } } - + // currently not used but it might be useful in the future if we want to add an "optimize-db" API route bool SQLiteDatabaseWrapper::Optimize(bool onlyIfStatsDontExistsYet) { SQLite::Statement countResources(db_, std::string("SELECT COUNT(*) FROM Resources WHERE resourceType=") + boost::lexical_cast(ResourceType_Study)); @@ -3054,15 +3051,6 @@ void SQLiteDatabaseWrapper::FlushToDisk() { boost::recursive_mutex::scoped_lock lock(mutex_); - // static bool hasRunOptimizeOnce = false; - - // if (!hasRunOptimizeOnce) - // { - // // This will run ANALYZE only once whe the Resources table contains reaches a predefined size and if there are no index statistics yet. - // // Then, an OPTIMIZE step will run at each startup (and will execute ANALYZE if it makes sense) - // hasRunOptimizeOnce = Optimize(true /* onlyIfStatsDontExistsYet */); - // } - db_.FlushToDisk(); }