This patch adds a new index on acq.edi_message to speed up
the check for duplicate EDI messages that edi_fetcher.pl runs,
replacing use of "ilike" with invocations of the evergreen.lowercase()
stored procedure.
To test
-------
[1] Arrange to create or simulate an EDI message that failed
processing.
[2] Run edi_fetcher.pl to have it attempt to download the
failed message in step #1; verify that the file is
/not/ downloaded again and that no additonal acq.edi_message
rows are created for it.
[3] (Extra credit) Try steps 1 and 2 in a database that has a
very large number of rows in acq.edi_message.
Signed-off-by: Galen Charlton <gmc@equinoxinitiative.org>
Signed-off-by: Bill Erickson <berickxx@gmail.com>
password => $account->password,
in_dir => $account->in_dir
},
- remote_file => {ilike => $remote_file},
+ remote_file => {'=' => {
+ transform => 'evergreen.lowercase',
+ value => ['evergreen.lowercase', $remote_file]
+ }},
status => {'in' => [qw/ processed proc_error trans_error /]},
},
{ join => {"acqedi" => {}}, limit => 1 }
);
CREATE INDEX edi_message_account_status_idx ON acq.edi_message (account,status);
CREATE INDEX edi_message_po_idx ON acq.edi_message (purchase_order);
+CREATE INDEX edi_message_remote_file_idx ON acq.edi_message (evergreen.lowercase(remote_file));
-- Note below that the primary key is NOT a SERIAL type. We will periodically truncate and rebuild
-- the table, assigning ids programmatically instead of using a sequence.
--- /dev/null
+BEGIN;
+
+-- SELECT evergreen.upgrade_deps_block_check('XXXX', :eg_version);
+
+CREATE INDEX edi_message_remote_file_idx ON acq.edi_message (evergreen.lowercase(remote_file));
+
+COMMIT;