comparison PostgreSQL/Plugins/PostgreSQLIndex.cpp @ 57:f4d5c2c70f98

Suggestion by Karsten Hilbert: CREATE EXTENSION IF NOT EXISTS pg_trgm
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 04 Sep 2018 08:56:42 +0200
parents 4f66bc893fc3
children 714c5d2bee76
comparison
equal deleted inserted replaced
56:4f66bc893fc3 57:f4d5c2c70f98
141 **/ 141 **/
142 try 142 try
143 { 143 {
144 // We've observed 9 minutes on DB with 100000 studies 144 // We've observed 9 minutes on DB with 100000 studies
145 LOG(WARNING) << "Trying to enable trigram matching on the PostgreSQL database " 145 LOG(WARNING) << "Trying to enable trigram matching on the PostgreSQL database "
146 << "to speed up wildcard searches. This may take several minutes"; 146 << "to speed up wildcard searches. This may take several minutes";
147 147
148 db->Execute( 148 db->Execute(
149 "CREATE EXTENSION pg_trgm; " 149 "CREATE EXTENSION IF NOT EXISTS pg_trgm; "
150 "CREATE INDEX DicomIdentifiersIndexValues2 ON DicomIdentifiers USING gin(value gin_trgm_ops);"); 150 "CREATE INDEX DicomIdentifiersIndexValues2 ON DicomIdentifiers USING gin(value gin_trgm_ops);");
151 151
152 SetGlobalIntegerProperty(*db, t, Orthanc::GlobalProperty_HasTrigramIndex, 1); 152 SetGlobalIntegerProperty(*db, t, Orthanc::GlobalProperty_HasTrigramIndex, 1);
153 LOG(WARNING) << "Trigram index has been created"; 153 LOG(WARNING) << "Trigram index has been created";
154 154