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

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

index a28740a..5d16f4b 100755 (executable)
@@ -1,5 +1,6 @@
 #!/usr/bin/perl
 use strict;
+use warnings;
 
 use lib '/openils/lib/perl5/';
 
@@ -42,7 +43,6 @@ $main_out->print("SET CLIENT_ENCODING TO 'UNICODE';\n\n");
 $main_out->print("BEGIN;\n\n");
 
 my %out_files;
-my %out_headers;
 for my $h (@order) {
        $out_files{$h} = FileHandle->new(">$output.$h.sql");
        binmode($out_files{$h},'utf8');
@@ -82,6 +82,10 @@ while ( my $rec = <> ) {
 
                my $fields = join(',', @{ $fieldcache{$hint}{fields} });
                $main_out->print( "DELETE FROM $fieldcache{$hint}{table};\n" ) if (grep {$_ eq $hint } @wipe);
+               # Speed up loading of bib records
+               if ($hint eq 'mfr') {
+                       $main_out->print("\nSELECT reporter.disable_materialized_simple_record_trigger();\n");
+               }
                $main_out->print( "COPY $fieldcache{$hint}{table} ($fields) FROM '$pwd/$output.$hint.sql';\n" );
 
        }
@@ -114,5 +118,8 @@ while ( my $rec = <> ) {
        $count++;
 }
 
+if (grep /^mfr$/, %out_files) {
+       $main_out->print("SELECT reporter.enable_materialized_simple_record_trigger();\n");
+}
 $main_out->print("-- COMMIT;\n\n");
 $main_out->close;