From c4f4b5734bfe42159100e21ae7baf83b01f7abb6 Mon Sep 17 00:00:00 2001 From: Doug Kyle Date: Thu, 3 Apr 2014 10:32:57 -0400 Subject: [PATCH] Add join condition for dups to get use of existing copy barcode index, removed uneeded smart float index on barcode Signed-off-by: Doug Kyle --- Open-ILS/src/sql/Pg/smart_float.sql | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Open-ILS/src/sql/Pg/smart_float.sql b/Open-ILS/src/sql/Pg/smart_float.sql index 2bd6dd4b20..b2db38c26d 100644 --- a/Open-ILS/src/sql/Pg/smart_float.sql +++ b/Open-ILS/src/sql/Pg/smart_float.sql @@ -28,7 +28,7 @@ BEGIN select org_unit from config.smart_float where active is true group by 1 ), duplibs as ( -select circ_lib,count(circ_lib) from asset.copy where barcode != bcode and status in (0,7) and call_number in (select id from asset.call_number where record in (select record from asset.call_number join asset.copy on call_number.id=copy.call_number and copy.barcode=bcode)) group by 1 +select circ_lib,count(circ_lib) from asset.copy where barcode != bcode and status in (0,7) and call_number in (select id from asset.call_number where record in (select record from asset.call_number join asset.copy on call_number.id=copy.call_number and copy.barcode=bcode and copy.deleted is false)) group by 1 ) select sflibs.org_unit,coalesce(duplibs.count,0) as count from sflibs left join duplibs on sflibs.org_unit=duplibs.circ_lib; END; @@ -247,4 +247,3 @@ $function$; -- !!! need some new indexes create index concurrently cp_location_idx on asset.copy (location); -create index concurrently cp_smart_float_dup_counts_idx on asset.copy (barcode); -- 2.11.0