# HG changeset patch # User Alain Mazy # Date 1789390972 -7200 # Node ID e76a0b1763dcc25bdd187a145aa3007779c4d314 # Parent 68b52a3696851c58fc04dbbdd2e4f25945860741 Added an index on AttachedFiles uuids to speed-up Set/GetAttachmentCustomData diff -r 68b52a369685 -r e76a0b1763dc PostgreSQL/NEWS --- a/PostgreSQL/NEWS Mon Sep 14 14:54:00 2026 +0200 +++ b/PostgreSQL/NEWS Mon Sep 14 15:02:52 2026 +0200 @@ -2,15 +2,16 @@ =============================== Changes: +* Added an index on AttachedFiles uuids to speed-up the SDK calls + SetAttachmentCustomData and GetAttachmentCustomData * Small update of the "DeleteResource" function to avoid a warning when multiple clients are trying to delete the same resource at the same time. - TODO: handle migration. - Warning: - test_concurrent_uploads_same_study (Concurrency.test_concurrency.TestConcurrency.test_concurrent_uploads_same_study) ... 2025-12-05 08:04:24.133 UTC [73] ERROR: null value in column "resourcetype" of relation "deletedresources" violates not-null constraint - 2025-12-05 08:04:24.133 UTC [73] DETAIL: Failing row contains (null, null). - 2025-12-05 08:04:24.133 UTC [73] CONTEXT: SQL statement "INSERT INTO DeletedResources VALUES (deleted_resource_row.resourceType, deleted_resource_row.publicId)" - PL/pgSQL function deleteresource(bigint) line 85 at SQL statement - 2025-12-05 08:04:24.133 UTC [73] STATEMENT: SELECT * FROM DeleteResource($1) + Warning: + test_concurrent_uploads_same_study (Concurrency.test_concurrency.TestConcurrency.test_concurrent_uploads_same_study) ... 2025-12-05 08:04:24.133 UTC [73] ERROR: null value in column "resourcetype" of relation "deletedresources" violates not-null constraint + 2025-12-05 08:04:24.133 UTC [73] DETAIL: Failing row contains (null, null). + 2025-12-05 08:04:24.133 UTC [73] CONTEXT: SQL statement "INSERT INTO DeletedResources VALUES (deleted_resource_row.resourceType, deleted_resource_row.publicId)" + PL/pgSQL function deleteresource(bigint) line 85 at SQL statement + 2025-12-05 08:04:24.133 UTC [73] STATEMENT: SELECT * FROM DeleteResource($1) Release 10.3 (2026-08-19) diff -r 68b52a369685 -r e76a0b1763dc PostgreSQL/Plugins/SQL/Downgrades/Rev1099ToRev10.sql --- a/PostgreSQL/Plugins/SQL/Downgrades/Rev1099ToRev10.sql Mon Sep 14 14:54:00 2026 +0200 +++ b/PostgreSQL/Plugins/SQL/Downgrades/Rev1099ToRev10.sql Mon Sep 14 15:02:52 2026 +0200 @@ -106,6 +106,8 @@ END IF; END; +DROP INDEX IF EXISTS AttachedFilesUuid; + -- set the global properties that actually documents the DB version, revision and some of the capabilities -- modify only the ones that have changed DELETE FROM GlobalProperties WHERE property IN (4); diff -r 68b52a369685 -r e76a0b1763dc PostgreSQL/Plugins/SQL/PrepareIndex.sql --- a/PostgreSQL/Plugins/SQL/PrepareIndex.sql Mon Sep 14 14:54:00 2026 +0200 +++ b/PostgreSQL/Plugins/SQL/PrepareIndex.sql Mon Sep 14 15:02:52 2026 +0200 @@ -854,7 +854,11 @@ CREATE INDEX IF NOT EXISTS InvalidChildCountsId ON InvalidChildCounts (id); -- see https://discourse.orthanc-server.org/t/increase-in-cpu-usage-of-database-after-update-to-orthanc-1-12-7/6057/6 +-- new in rev 1099 +CREATE INDEX IF NOT EXISTS AttachedFilesUuid ON AttachedFiles (uuid); + +---------------------------------- -- set the global properties that actually documents the DB version, revision and some of the capabilities DELETE FROM GlobalProperties WHERE property IN (1, 4, 6, 10, 11, 12, 13, 14); diff -r 68b52a369685 -r e76a0b1763dc PostgreSQL/Plugins/SQL/Upgrades/Rev10ToRev1099.sql --- a/PostgreSQL/Plugins/SQL/Upgrades/Rev10ToRev1099.sql Mon Sep 14 14:54:00 2026 +0200 +++ b/PostgreSQL/Plugins/SQL/Upgrades/Rev10ToRev1099.sql Mon Sep 14 15:02:52 2026 +0200 @@ -1,3 +1,4 @@ -- Update from Rev 10 to Rev 1099 + -- the DeleteResource function is updated in PrepareIndex.sql - +-- the AttachedFilesUuid index is created in PrepareIndex.sql