From 831643d16cf8d83e8423231b42be496c809d91e3 Mon Sep 17 00:00:00 2001 From: miker Date: Fri, 14 Aug 2009 03:11:51 +0000 Subject: [PATCH] access circulation tables directly instead of through the all_circulation view to avoid pathological query plans git-svn-id: svn://svn.open-ils.org/ILS/trunk@13837 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- Open-ILS/src/sql/Pg/extend-reporter.sql | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Open-ILS/src/sql/Pg/extend-reporter.sql b/Open-ILS/src/sql/Pg/extend-reporter.sql index 12af541907..156df6cecf 100644 --- a/Open-ILS/src/sql/Pg/extend-reporter.sql +++ b/Open-ILS/src/sql/Pg/extend-reporter.sql @@ -26,10 +26,11 @@ CREATE TABLE extend_reporter.legacy_circ_count ( ); 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 -- 2.11.0