From 1ebb92b43de57f6358bf0f16d8b89ed1944c32a1 Mon Sep 17 00:00:00 2001 From: blake Date: Mon, 9 Apr 2018 19:52:08 -0500 Subject: [PATCH] LP1758160_Deleting_patrons_can_exceed_staff_client_timeouts 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 Signed-off-by: Jason Boyer Signed-off-by: Jason Stephenson --- Open-ILS/src/sql/Pg/090.schema.action.sql | 1 + .../sql/Pg/upgrade/XXXX.schema.auch-source_circ-index.sql | 12 ++++++++++++ 2 files changed, 13 insertions(+) create mode 100644 Open-ILS/src/sql/Pg/upgrade/XXXX.schema.auch-source_circ-index.sql diff --git a/Open-ILS/src/sql/Pg/090.schema.action.sql b/Open-ILS/src/sql/Pg/090.schema.action.sql index 7d06aba9fb..2fb3659e6c 100644 --- a/Open-ILS/src/sql/Pg/090.schema.action.sql +++ b/Open-ILS/src/sql/Pg/090.schema.action.sql @@ -1547,6 +1547,7 @@ CREATE TABLE action.usr_circ_history ( ); 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 diff --git a/Open-ILS/src/sql/Pg/upgrade/XXXX.schema.auch-source_circ-index.sql b/Open-ILS/src/sql/Pg/upgrade/XXXX.schema.auch-source_circ-index.sql new file mode 100644 index 0000000000..2f0673a194 --- /dev/null +++ b/Open-ILS/src/sql/Pg/upgrade/XXXX.schema.auch-source_circ-index.sql @@ -0,0 +1,12 @@ +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; -- 2.11.0