Added an index to action.usr_circ_history for much needed postgresql justice.
This will increase the speed when deleting patrons with large number of circulations.
Signed-off-by: blake <blake@mobiusconsortium.org>
Signed-off-by: Jason Boyer <jboyer@library.in.gov>
Signed-off-by: Jason Stephenson <jason@sigio.com>
);
CREATE INDEX action_usr_circ_history_usr_idx ON action.usr_circ_history ( usr );
+CREATE INDEX action_usr_circ_history_source_circ_idx ON action.usr_circ_history ( source_circ );
CREATE TRIGGER action_usr_circ_history_target_copy_trig
AFTER INSERT OR UPDATE ON action.usr_circ_history
--- /dev/null
+BEGIN;
+
+SELECT evergreen.upgrade_deps_block_check('XXXX', :eg_version);
+
+-- Add an index to action.usr_circ_history (source_circ) to speed up aging circs and purging accounts
+
+CREATE INDEX action_usr_circ_history_source_circ_idx
+ ON action.usr_circ_history
+ USING btree
+ (source_circ);
+
+COMMIT;