changeset 473:15e609c439d1

Fixed the MaximumStorageSize & MaximumPatientCount.
author Alain Mazy <am@osimis.io>
date Wed, 14 Feb 2024 13:46:04 +0100
parents d1e1cb3ab741
children b363f94084c0 97c709e400ec
files PostgreSQL/NEWS PostgreSQL/Plugins/PostgreSQLIndex.cpp TODO
diffstat 3 files changed, 12 insertions(+), 19 deletions(-) [+]
line wrap: on
line diff
--- a/PostgreSQL/NEWS	Thu Feb 08 16:18:36 2024 +0100
+++ b/PostgreSQL/NEWS	Wed Feb 14 13:46:04 2024 +0100
@@ -1,6 +1,10 @@
 Pending changes in the mainline
 ===============================
 
+DB schema revision: 2
+
+* Fixed the MaximumStorageSize & MaximumPatientCount.
+
 
 Release 6.0 (2024-02-08)
 ========================
--- a/PostgreSQL/Plugins/PostgreSQLIndex.cpp	Thu Feb 08 16:18:36 2024 +0100
+++ b/PostgreSQL/Plugins/PostgreSQLIndex.cpp	Wed Feb 14 13:46:04 2024 +0100
@@ -240,9 +240,8 @@
     {
       DatabaseManager::CachedStatement statement(
         STATEMENT_FROM_HERE, manager,
-        "SELECT value FROM GlobalIntegers WHERE key = 0");
+        "SELECT * FROM UpdateSingleStatistic(0)");
 
-      statement.SetReadOnly(true);
       statement.Execute();
 
       result = static_cast<uint64_t>(statement.ReadInteger64(0));
@@ -262,9 +261,8 @@
     {
       DatabaseManager::CachedStatement statement(
         STATEMENT_FROM_HERE, manager,
-        "SELECT value FROM GlobalIntegers WHERE key = 1");
+        "SELECT * FROM UpdateSingleStatistic(1)");
 
-      statement.SetReadOnly(true);
       statement.Execute();
 
       result = static_cast<uint64_t>(statement.ReadInteger64(0));
@@ -622,19 +620,11 @@
     uint64_t result;
     
     {
-      DatabaseManager::CachedStatement statement(
-        STATEMENT_FROM_HERE, manager,
-        "SELECT value FROM GlobalIntegers WHERE key = ${key}");
-
-      statement.SetParameterType("key", ValueType_Integer64);
+      DatabaseManager::StandaloneStatement statement(
+        manager,
+        std::string("SELECT * FROM UpdateSingleStatistic(") + boost::lexical_cast<std::string>(resourceType + 2) + ")");  // For an explanation of the "+ 2" below, check out "PrepareIndex.sql"
 
-      Dictionary args;
-
-      // For an explanation of the "+ 2" below, check out "FastCountResources.sql"
-      args.SetIntegerValue("key", static_cast<int>(resourceType + 2));
-
-      statement.SetReadOnly(true);
-      statement.Execute(args);
+      statement.Execute();
 
       result = static_cast<uint64_t>(statement.ReadInteger64(0));
     }
--- a/TODO	Thu Feb 08 16:18:36 2024 +0100
+++ b/TODO	Wed Feb 14 13:46:04 2024 +0100
@@ -26,9 +26,8 @@
 PostgreSQL
 ----------
 
-* reported issue to validate:  uploading lots of files through HTTP with:
-  - 1 client and IndexConnectionsCount==1 took 100s
-  - 2 client and IndexConnectionsCount==2 took 600s (lots of transaction replayed)
+* Have a separate "thread" to UpdateStatistics to avoid large computations ?
+
 
 * Seems Orthanc might deadlock when there are plenty of conflicting transactions:
   https://groups.google.com/g/orthanc-users/c/xQelEcKqL9U/m/HsvxwlkvAQAJ