From 420b6a2aaa22f5871380ebcf248cb0ec164c9286 Mon Sep 17 00:00:00 2001 From: dbs Date: Thu, 7 Aug 2008 14:30:43 +0000 Subject: [PATCH] Per Brandon Uhlmann's suggestion, speed up loading of bibs by automatically disabling/reenabling materialized record trigger git-svn-id: svn://svn.open-ils.org/ILS/trunk@10299 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- Open-ILS/src/extras/import/pg_loader.pl | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Open-ILS/src/extras/import/pg_loader.pl b/Open-ILS/src/extras/import/pg_loader.pl index 679f44edd6..ef07a05ce0 100755 --- a/Open-ILS/src/extras/import/pg_loader.pl +++ b/Open-ILS/src/extras/import/pg_loader.pl @@ -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); } -- 2.43.2