Enhance upgrade for complete subject indexing: drop the unnecessary final ORDER BY...
authordbs <dbs@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Tue, 13 Oct 2009 15:09:58 +0000 (15:09 +0000)
committerdbs <dbs@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Tue, 13 Oct 2009 15:09:58 +0000 (15:09 +0000)
Cuts upgrade time to about one one-hundredth of what it was before.

git-svn-id: svn://svn.open-ils.org/ILS/trunk@14400 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/src/sql/Pg/030.schema.metabib.sql
Open-ILS/src/sql/Pg/upgrade/0030.data.flat-subject-entries.sql

index f6b8727..6f2d440 100644 (file)
@@ -69,6 +69,7 @@ CREATE TRIGGER metabib_subject_field_entry_fti_trigger
        FOR EACH ROW EXECUTE PROCEDURE oils_tsearch2('subject');
 
 CREATE INDEX metabib_subject_field_entry_index_vector_idx ON metabib.subject_field_entry USING GIST (index_vector);
+CREATE INDEX metabib_subject_field_entry_source_idx ON metabib.subject_field_entry (source);
 
 
 CREATE TABLE metabib.keyword_field_entry (
index 1fcab40..e1ac1fd 100644 (file)
@@ -8,6 +8,8 @@ INSERT INTO config.upgrade_log (version) VALUES ('0030'); -- dbs
 INSERT INTO config.metabib_field (field_class, name, format, xpath ) VALUES
     ( 'subject', 'complete', 'mods32', $$//mods32:mods/mods32:subject//text()$$ );
 
+CREATE INDEX metabib_subject_field_entry_source_idx ON metabib.subject_field_entry (source);
+
 INSERT INTO metabib.subject_field_entry (source, field, value)
     SELECT source, (
             SELECT id 
@@ -26,7 +28,6 @@ INSERT INTO metabib.subject_field_entry (source, field, value)
         SELECT source
         FROM metabib.subject_field_entry
         GROUP BY source
-    ) AS groupee
-    ORDER BY source;
+    ) AS groupee;
 
 COMMIT;