[open-ils-commits] [GIT] Evergreen ILS branch rel_2_3 updated. e2232d2f62588f8062d66824a5027e1c0b8a718f

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, rel_2_3 has been updated
       via  e2232d2f62588f8062d66824a5027e1c0b8a718f (commit)
      from  4fec929171a336504044b5df2d6b93abd2d8896c (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 e2232d2f62588f8062d66824a5027e1c0b8a718f
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 0a7c050..4a079bd 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Holds.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Holds.pm
@@ -1314,18 +1314,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 => [
             {
@@ -1337,10 +1341,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 ...

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

Summary of changes:
 .../perlmods/lib/OpenILS/Application/Circ/Holds.pm |   21 ++++++++++---------
 1 files changed, 11 insertions(+), 10 deletions(-)


hooks/post-receive
-- 
Evergreen ILS


More information about the open-ils-commits mailing list