[open-ils-commits] r13837 - trunk/Open-ILS/src/sql/Pg (miker)

svn at svn.open-ils.org svn at svn.open-ils.org
Thu Aug 13 23:11:54 EDT 2009


Author: miker
Date: 2009-08-13 23:11:51 -0400 (Thu, 13 Aug 2009)
New Revision: 13837

Modified:
   trunk/Open-ILS/src/sql/Pg/extend-reporter.sql
Log:
access circulation tables directly instead of through the all_circulation view to avoid pathological query plans

Modified: trunk/Open-ILS/src/sql/Pg/extend-reporter.sql
===================================================================
--- trunk/Open-ILS/src/sql/Pg/extend-reporter.sql	2009-08-13 21:12:27 UTC (rev 13836)
+++ trunk/Open-ILS/src/sql/Pg/extend-reporter.sql	2009-08-14 03:11:51 UTC (rev 13837)
@@ -26,10 +26,11 @@
 );
 
 CREATE OR REPLACE VIEW extend_reporter.full_circ_count AS
- SELECT cp.id, COALESCE(sum(c.circ_count), 0::bigint) + COALESCE(count(circ.id), 0::bigint) AS circ_count
+ SELECT cp.id, COALESCE(sum(c.circ_count), 0::bigint) + COALESCE(count(circ.id), 0::bigint) + COALESCE(count(acirc.id), 0::bigint) AS circ_count
    FROM asset."copy" cp
    LEFT JOIN extend_reporter.legacy_circ_count c USING (id)
-   LEFT JOIN "action".all_circulation circ ON circ.target_copy = cp.id
+   LEFT JOIN "action".circulation circ ON circ.target_copy = cp.id
+   LEFT JOIN "action".aged_circulation acirc ON acirc.target_copy = cp.id
   GROUP BY cp.id;
 
 CREATE OR REPLACE VIEW extend_reporter.global_bibs_by_holding_update AS



More information about the open-ils-commits mailing list