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

Evergreen Git git at git.evergreen-ils.org
Thu Sep 12 13:45:49 EDT 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  d1d41d16c7ace2c097c0dbea8c0b72a3bc6a690c (commit)
      from  2e447f31f3cd379b8323d646be7e10333153f498 (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 d1d41d16c7ace2c097c0dbea8c0b72a3bc6a690c
Author: Mike Rylander <mrylander at gmail.com>
Date:   Thu Sep 12 13:13:23 2013 -0400

    Optimize container filters in QueryParser
    
    When a container filter is used at the top level of a QueryParser
    query (that is, in a simple query with no OR-logic branches or explicit
    nesting groups) we can use an INNER join instead of LEFT + IS NOT NULL.
    
    On some production datasets this showed an increase in performance from
    20+ seconds to 1ms for the core query.
    
    Signed-off-by: Mike Rylander <mrylander at gmail.com>
    Signed-off-by: Dan Scott <dscott at laurentian.ca>

diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Driver/Pg/QueryParser.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Driver/Pg/QueryParser.pm
index 544dba9..e4e237c 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Driver/Pg/QueryParser.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Driver/Pg/QueryParser.pm
@@ -1096,12 +1096,13 @@ sub flatten {
                         }
                         $with .= "     )";
 
-                        $from .= "\n" . ${spc} x 3 . "LEFT JOIN container_${filter_alias} ON container_${filter_alias}.record = m.source";
+                        my $optimize_join = 1 if $self->top_plan and !$NOT;
+                        $from .= "\n" . ${spc} x 3 . ( $optimize_join ? 'INNER' : 'LEFT') . " JOIN container_${filter_alias} ON container_${filter_alias}.record = m.source";
 
-                        my $spcdepth = $self->plan_level + 5;
-
-                        $where .= $joiner if $where ne '';
-                        $where .= "${NOT}(container_${filter_alias} IS NOT NULL)";
+                        if (!$optimize_join) {
+                            $where .= $joiner if $where ne '';
+                            $where .= "(container_${filter_alias} IS " . ( $NOT ? 'NULL)' : 'NOT NULL)');
+                        }
                     }
                 }
             } elsif ($filter->name eq 'record_list') {

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

Summary of changes:
 .../Application/Storage/Driver/Pg/QueryParser.pm   |   11 ++++++-----
 1 files changed, 6 insertions(+), 5 deletions(-)


hooks/post-receive
-- 
Evergreen ILS


More information about the open-ils-commits mailing list