[open-ils-commits] ***SPAM*** [GIT] Evergreen ILS branch master updated. e953ba1b9a3260d352f62ca7fa44fd45188e0308

Evergreen Git git at git.evergreen-ils.org
Thu Apr 10 17:25:09 EDT 2014


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Evergreen ILS".

The branch, master has been updated
       via  e953ba1b9a3260d352f62ca7fa44fd45188e0308 (commit)
      from  ce9f58a3a8293ebf9070587f7c4b5806e196ceb6 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit e953ba1b9a3260d352f62ca7fa44fd45188e0308
Author: Mike Rylander <mrylander at gmail.com>
Date:   Thu Apr 10 13:03:30 2014 -0400

    LP#1306133: Avoid metabib.rec_descriptor where possible
    
    metabib.rec_descriptor has been a view over other data structures
    for some time now, but with the advent of the new attribute infrastructure
    it is a view over a view over a view, variously transforming IDs to
    a slim table to an HSTORE structure and finally to a wide table. Thus,
    it is extremely expensive to query. So we won't unless we're asked to.
    Which, in the TPAC world, is never.
    
    Signed-off-by: Mike Rylander <mrylander at gmail.com>
    Signed-off-by: Doug Kyle <dkyle at grpl.org>

diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Publisher/metabib.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Publisher/metabib.pm
index 6f29126..625f5ab 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Publisher/metabib.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Publisher/metabib.pm
@@ -556,12 +556,14 @@ sub biblio_multi_search_full_rec {
     my ($t_filter, $f_filter) = ('','');
     my ($a_filter, $l_filter, $lf_filter) = ('','','');
 
+    my $use_rd = 0;
     if (my $a = $args{audience}) {
         $a = [$a] if (!ref($a));
         my @aud = @$a;
             
         $a_filter = ' AND rd.audience IN ('.join(',',map{'?'}@aud).')';
         push @binds, @aud;
+        $use_rd = 1;
     }
 
     if (my $l = $args{language}) {
@@ -570,6 +572,7 @@ sub biblio_multi_search_full_rec {
 
         $l_filter = ' AND rd.item_lang IN ('.join(',',map{'?'}@lang).')';
         push @binds, @lang;
+        $use_rd = 1;
     }
 
     if (my $f = $args{lit_form}) {
@@ -578,6 +581,7 @@ sub biblio_multi_search_full_rec {
 
         $lf_filter = ' AND rd.lit_form IN ('.join(',',map{'?'}@lit_form).')';
         push @binds, @lit_form;
+        $use_rd = 1;
     }
 
     if (my $f = $args{item_form}) {
@@ -586,6 +590,7 @@ sub biblio_multi_search_full_rec {
 
         $f_filter = ' AND rd.item_form IN ('.join(',',map{'?'}@forms).')';
         push @binds, @forms;
+        $use_rd = 1;
     }
 
     if (my $t = $args{item_type}) {
@@ -594,6 +599,7 @@ sub biblio_multi_search_full_rec {
 
         $t_filter = ' AND rd.item_type IN ('.join(',',map{'?'}@types).')';
         push @binds, @types;
+        $use_rd = 1;
     }
 
 
@@ -603,10 +609,12 @@ sub biblio_multi_search_full_rec {
         my @forms = split '', $f;
         if (@types) {
             $t_filter = ' AND rd.item_type IN ('.join(',',map{'?'}@types).')';
+            $use_rd = 1;
         }
 
         if (@forms) {
             $f_filter .= ' AND rd.item_form IN ('.join(',',map{'?'}@forms).')';
+            $use_rd = 1;
         }
         push @binds, @types, @forms;
     }
@@ -661,6 +669,8 @@ sub biblio_multi_search_full_rec {
         $sort = undef;
     }
 
+    my $rd_join = $use_rd ? "$metabib_record_descriptor rd," : '';
+    my $rd_filter = $use_rd ? 'AND rd.record = f.record' : '';
 
     if ($copies_visible) {
         $select = <<"        SQL";
@@ -671,16 +681,16 @@ sub biblio_multi_search_full_rec {
                 $cs_table cs,
                 $cl_table cl,
                 $br_table br,
-                $metabib_record_descriptor rd,
+                $rd_join
                 $descendants d
             WHERE   br.id = f.record
                 AND cn.record = f.record
-                AND rd.record = f.record
                 AND cp.status = cs.id
                 AND cp.location = cl.id
                 AND br.deleted IS FALSE
                 AND cn.deleted IS FALSE
                 AND cp.deleted IS FALSE
+                $rd_filter
                 $has_vols
                 $has_copies
                 $copies_visible
@@ -696,11 +706,11 @@ sub biblio_multi_search_full_rec {
         $select = <<"        SQL";
             SELECT  f.record, 1, 1, $rank
             FROM    $search_table f,
-                $br_table br,
-                $metabib_record_descriptor rd
+                $rd_join
+                $br_table br
             WHERE   br.id = f.record
-                AND rd.record = f.record
                 AND br.deleted IS FALSE
+                $rd_filter
                 $t_filter
                 $f_filter
                 $a_filter

-----------------------------------------------------------------------

Summary of changes:
 .../Application/Storage/Publisher/metabib.pm       |   20 +++++++++++++++-----
 1 files changed, 15 insertions(+), 5 deletions(-)


hooks/post-receive
-- 
Evergreen ILS


More information about the open-ils-commits mailing list