[open-ils-commits] r16589 - in trunk/Open-ILS/src/sql/Pg: . upgrade (dbs)
svn at svn.open-ils.org
svn at svn.open-ils.org
Thu Jun 3 23:54:17 EDT 2010
Author: dbs
Date: 2010-06-03 23:54:14 -0400 (Thu, 03 Jun 2010)
New Revision: 16589
Added:
trunk/Open-ILS/src/sql/Pg/upgrade/0292.schema.action-target_copy-index.sql
Modified:
trunk/Open-ILS/src/sql/Pg/002.schema.config.sql
trunk/Open-ILS/src/sql/Pg/090.schema.action.sql
Log:
Improve circ transaction performance by indexing NULL circs (Launchpad 587031)
Creating a unique index on target_copy in the action.circulation table where
the checkin_time is NULL will increase the speed of circ transactions,
particularly on systems with a lot of traffic. The uniqueness also
ensures that a given item will not be able to be checked out multiple times
concurrently.
Thanks to James Fournie from BC Sitka for suggesting the index in Launchpad
bug 587031!
Modified: trunk/Open-ILS/src/sql/Pg/002.schema.config.sql
===================================================================
--- trunk/Open-ILS/src/sql/Pg/002.schema.config.sql 2010-06-04 03:29:03 UTC (rev 16588)
+++ trunk/Open-ILS/src/sql/Pg/002.schema.config.sql 2010-06-04 03:54:14 UTC (rev 16589)
@@ -65,7 +65,7 @@
install_date TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW()
);
-INSERT INTO config.upgrade_log (version) VALUES ('0291'); -- dbs
+INSERT INTO config.upgrade_log (version) VALUES ('0292'); -- dbs
CREATE TABLE config.bib_source (
id SERIAL PRIMARY KEY,
Modified: trunk/Open-ILS/src/sql/Pg/090.schema.action.sql
===================================================================
--- trunk/Open-ILS/src/sql/Pg/090.schema.action.sql 2010-06-04 03:29:03 UTC (rev 16588)
+++ trunk/Open-ILS/src/sql/Pg/090.schema.action.sql 2010-06-04 03:54:14 UTC (rev 16589)
@@ -147,8 +147,8 @@
CREATE INDEX circ_circ_staff_idx ON action.circulation ( circ_staff );
CREATE INDEX circ_checkin_staff_idx ON action.circulation ( checkin_staff );
CREATE UNIQUE INDEX circ_parent_idx ON action.circulation ( parent_circ ) WHERE parent_circ IS NOT NULL;
+CREATE UNIQUE INDEX only_one_concurrent_checkout_per_copy ON action.circulation(target_copy) WHERE checkin_time IS NULL;
-
CREATE TRIGGER mat_summary_create_tgr AFTER INSERT ON action.circulation FOR EACH ROW EXECUTE PROCEDURE money.mat_summary_create ('circulation');
CREATE TRIGGER mat_summary_change_tgr AFTER UPDATE ON action.circulation FOR EACH ROW EXECUTE PROCEDURE money.mat_summary_update ();
CREATE TRIGGER mat_summary_remove_tgr AFTER DELETE ON action.circulation FOR EACH ROW EXECUTE PROCEDURE money.mat_summary_delete ();
Added: trunk/Open-ILS/src/sql/Pg/upgrade/0292.schema.action-target_copy-index.sql
===================================================================
--- trunk/Open-ILS/src/sql/Pg/upgrade/0292.schema.action-target_copy-index.sql (rev 0)
+++ trunk/Open-ILS/src/sql/Pg/upgrade/0292.schema.action-target_copy-index.sql 2010-06-04 03:54:14 UTC (rev 16589)
@@ -0,0 +1,4 @@
+BEGIN;
+INSERT INTO config.upgrade_log (version) VALUES ('0292'); -- dbs
+CREATE UNIQUE INDEX only_one_concurrent_checkout_per_copy ON action.circulation(target_copy) WHERE checkin_time IS NULL;
+COMMIT;
More information about the open-ils-commits
mailing list