Per Brandon Uhlmann's suggestion, speed up loading of bibs by automatically disabling...
authordbs <dbs@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Thu, 7 Aug 2008 14:30:43 +0000 (14:30 +0000)
committerdbs <dbs@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Thu, 7 Aug 2008 14:30:43 +0000 (14:30 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@10299 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/src/extras/import/pg_loader.pl

index 679f44e..ef07a05 100755 (executable)
@@ -89,6 +89,10 @@ for my $h (@order) {
 
        my $fields = join(',', @{ $fieldcache{$h}{fields} });
        $output->print( "DELETE FROM $fieldcache{$h}{table};\n" ) if (grep {$_ eq $h } @wipe);
+       # Speed up loading of bib records
+       if ($h eq 'mfr') {
+               $output->print("\nSELECT reporter.disable_materialized_simple_record_trigger();\n");
+       }
        $output->print( "COPY $fieldcache{$h}{table} ($fields) FROM STDIN;\n" );
 
        for my $line (@{ $lineset{$h} }) {
@@ -115,6 +119,10 @@ for my $h (@order) {
 
        $output->print('\.'."\n\n");
        
+       if ($h eq 'mfr') {
+               $output->print("SELECT reporter.enable_materialized_simple_record_trigger();\n");
+       }
+
        $output->print("SELECT setval('$fieldcache{$h}{sequence}'::TEXT, (SELECT MAX($fieldcache{$h}{pkey}) FROM $fieldcache{$h}{table}), TRUE);\n\n")
                if (!grep { $_ eq $h} @auto);
 }