[open-ils-commits] [GIT] Evergreen ILS branch master updated. 5fb92d384aeca7ed0e8b1c34d97447a35f00f256

Evergreen Git git at git.evergreen-ils.org
Wed Feb 27 13:11:38 EST 2013


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  5fb92d384aeca7ed0e8b1c34d97447a35f00f256 (commit)
       via  a605e9beb482bcdc8eee54c91b73125ebbde2f01 (commit)
      from  51044386d3caafeafc4610c7bcd635e0d3d1c9dd (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 5fb92d384aeca7ed0e8b1c34d97447a35f00f256
Author: Mike Rylander <mrylander at gmail.com>
Date:   Fri Feb 8 10:15:39 2013 -0500

    Speed up sorted-related-holds query
    
    In several interfaces, we use a server side method which gathers statistics
    about a hold: related holds, it's position in the (approximate) queue, the
    estimated wait time, etc.  Within this method is a relatively complicated
    json_query that returns the list of related, (FIFO-ish) sorted holds -- ones
    that could be filled by a copy which could fill the hold in question.  This
    commit restructures that query so as to make it faster when the list of
    related holds is large, by removing duplicate (cartesian product, actually)
    hold ids that were being fed into an INNER JOIN clause.
    
    Testing shows a speed increase of 4x for related-hold queue of around 675
    holds [~2s -> ~0.5s] on a relatively large Evergreen installation,
    appropriately tuned.  The speed improvement gets larger with longer queues.
    There is no observed decrease in speed for smaller queue sizes.
    
    Signed-off-by: Mike Rylander <mrylander at gmail.com>
    Signed-off-by: Ben Shum <bshum at biblio.org>

diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Holds.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Holds.pm
index 03f6c98..019b033 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Holds.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Holds.pm
@@ -1332,18 +1332,22 @@ sub retrieve_hold_queue_status_impl {
         # fetch cut_in_line and request_time since they're in the order_by
         # and we're asking for distinct values
         select => {ahr => ['id', 'cut_in_line', 'request_time']},
-        from   => {
-            ahr => {
-                'ahcm' => {
-                    join => {
+        from   => 'ahr',
+        where => {
+            id => { in => {
+                select => { ahcm => ['hold'] },
+                from   => {
+                    'ahcm' => {
                         'ahcm2' => {
                             'class' => 'ahcm',
                             'field' => 'target_copy',
                             'fkey'  => 'target_copy'
                         }
                     }
-                }
-            }
+                },
+                where => { '+ahcm2' => { hold => $hold->id } },
+                distinct => 1
+            }}
         },
         order_by => [
             {
@@ -1355,10 +1359,7 @@ sub retrieve_hold_queue_status_impl {
             },
             { "class" => "ahr", "field" => "request_time" }
         ],
-        distinct => 1,
-        where => {
-            '+ahcm2' => { hold => $hold->id }
-        }
+        distinct => 1
     });
 
     if (!@$q_holds) { # none? maybe we don't have a map ...

commit a605e9beb482bcdc8eee54c91b73125ebbde2f01
Author: Mike Rylander <mrylander at gmail.com>
Date:   Tue Feb 12 11:51:16 2013 -0500

    Use LIMIT to speed EXISTS subqueries
    
    EXISTS without LIMIT is considered harmful in many cases.  Thus, we will
    apply such an explicit planner hint in SuperCat.  This reduces the runtime
    of URI lookups on some records from 1.2s+ to less than 1ms.
    
    Signed-off-by: Mike Rylander <mrylander at gmail.com>
    Signed-off-by: Ben Shum <bshum at biblio.org>

diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/SuperCat.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/SuperCat.pm
index 71b4b5f..dc62eee 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/Application/SuperCat.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/SuperCat.pm
@@ -398,6 +398,7 @@ sub cn_browse {
     if (@$statuses || @$copy_locations) {
         @cp_filter = (
             '-exists' => {
+                limit => 1,
                 from  => 'acp',
 				where => {
                     call_number => { '=' => { '+acn' => 'id' } },
@@ -523,6 +524,7 @@ sub cn_startwith {
     if (@$statuses || @$copy_locations) {
         @cp_filter = (
             '-exists' => {
+                limit => 1,
                 from  => 'acp',
 				where => {
                     call_number => { '=' => { '+acn' => 'id' } },
@@ -2159,7 +2161,8 @@ sub new_record_holdings {
                 call_number => { '=' => {'+acn'=>'id'} },
                 deleted => 'f',
                 circ_lib => \@ou_ids
-              }
+              },
+              limit => 1
             }
         }
     ]);
@@ -2182,6 +2185,7 @@ sub new_record_holdings {
             %subselect = (
                 owning_lib => \@uri_ou_ids,
                 '-exists'  => {
+                    limit => 1,
                     from  => { auricnm => 'auri' },
                     where => {
                         call_number => { '=' => {'+acn'=>'id'} },
@@ -2199,7 +2203,8 @@ sub new_record_holdings {
                         call_number => { '=' => {'+acn'=>'id'} },
                         deleted => 'f',
                         circ_lib => \@ou_ids
-                      }
+                      },
+                      limit => 1
                     }
                 },
                 { '-and' => [
@@ -2209,7 +2214,8 @@ sub new_record_holdings {
                         where => {
                             call_number => { '=' => {'+acn'=>'id'} },
                             '+auri' => { active => 't' }
-                        }
+                        },
+                        limit => 1
                     }}
                 ]}
             ]);
@@ -2281,7 +2287,8 @@ sub new_record_holdings {
         { owning_lib => \@ou_ids },
         { '-exists'  =>
             { from  => 'sdist',
-              where => { holding_lib => \@ou_ids }
+              where => { holding_lib => \@ou_ids },
+              limit => 1
             }
         }
     ]);

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

Summary of changes:
 .../perlmods/lib/OpenILS/Application/Circ/Holds.pm |   21 ++++++++++---------
 .../perlmods/lib/OpenILS/Application/SuperCat.pm   |   15 ++++++++++---
 2 files changed, 22 insertions(+), 14 deletions(-)


hooks/post-receive
-- 
Evergreen ILS


More information about the open-ils-commits mailing list