Mercurial > hg > orthanc
diff OrthancServer/PrepareDatabase.sql @ 1158:badc14fee61f db-changes
speed up db
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 16 Sep 2014 18:01:42 +0200 |
parents | 72dc919a028c |
children | 8f9d49192815 |
line wrap: on
line diff
--- a/OrthancServer/PrepareDatabase.sql Tue Sep 16 14:22:22 2014 +0200 +++ b/OrthancServer/PrepareDatabase.sql Tue Sep 16 18:01:42 2014 +0200 @@ -10,7 +10,15 @@ parentId INTEGER REFERENCES Resources(internalId) ON DELETE CASCADE ); -CREATE TABLE MainDicomTags( +CREATE TABLE MainResourcesTags( + id INTEGER REFERENCES Resources(internalId) ON DELETE CASCADE, + tagGroup INTEGER, + tagElement INTEGER, + value TEXT, + PRIMARY KEY(id, tagGroup, tagElement) + ); + +CREATE TABLE MainInstancesTags( id INTEGER REFERENCES Resources(internalId) ON DELETE CASCADE, tagGroup INTEGER, tagElement INTEGER, @@ -67,9 +75,10 @@ CREATE INDEX ResourceTypeIndex ON Resources(resourceType); CREATE INDEX PatientRecyclingIndex ON PatientRecyclingOrder(patientId); -CREATE INDEX MainDicomTagsIndex1 ON MainDicomTags(id); -CREATE INDEX MainDicomTagsIndex2 ON MainDicomTags(tagGroup, tagElement); -CREATE INDEX MainDicomTagsIndexValues ON MainDicomTags(value COLLATE BINARY); +CREATE INDEX MainResourcesTagsIndex1 ON MainResourcesTags(id); +CREATE INDEX MainResourcesTagsIndex2 ON MainResourcesTags(tagGroup, tagElement); +CREATE INDEX MainResourcesTagsIndexValues ON MainResourcesTags(value COLLATE BINARY); +CREATE INDEX MainInstancesTagsIndex ON MainInstancesTags(id); CREATE INDEX ChangesIndex ON Changes(internalId); @@ -85,6 +94,7 @@ CREATE TRIGGER ResourceDeleted AFTER DELETE ON Resources BEGIN + SELECT SignalResourceDeleted(old.publicId, old.resourceType); -- New in Orthanc 0.8.4 (db v5) SELECT SignalRemainingAncestor(parent.publicId, parent.resourceType) FROM Resources AS parent WHERE internalId = old.parentId; END; @@ -107,4 +117,4 @@ -- Set the version of the database schema -- The "1" corresponds to the "GlobalProperty_DatabaseSchemaVersion" enumeration -INSERT INTO GlobalProperties VALUES (1, "4"); +INSERT INTO GlobalProperties VALUES (1, "5");