[Rt-commit] [svn] r737 - in rt/trunk: . lib/RT

jesse at pallas.eruditorum.org jesse at pallas.eruditorum.org
Sun Apr 25 02:02:14 EDT 2004


Author: jesse
Date: Sun Apr 25 02:02:12 2004
New Revision: 737

Modified:
   rt/trunk/   (props changed)
   rt/trunk/lib/RT/Groups_Overlay.pm
Log:
 ----------------------------------------------------------------------
 r2152 at tinbook:  jesse | 2004-04-25T06:01:59.654755Z
 
 We were needlessly including the "Principals" table in a query. It hurt postgres perf significantly
 ----------------------------------------------------------------------
 

Modified: rt/trunk/lib/RT/Groups_Overlay.pm
==============================================================================
--- rt/trunk/lib/RT/Groups_Overlay.pm	(original)
+++ rt/trunk/lib/RT/Groups_Overlay.pm	Sun Apr 25 02:02:12 2004
@@ -237,7 +237,6 @@
                  IncludeSuperusers      => undef,
                  @_ );
 
-    my $groupprinc = $self->NewAlias('Principals');
     my $acl        = $self->NewAlias('ACL');
 
     # {{{ Find only rows where the right granted is the one we're looking up or _possibly_ superuser 
@@ -274,7 +273,7 @@
             $or_check_roles =
                 " OR ( ( (main.Domain = 'RT::Queue-Role' AND main.Instance = " .
                 $args{'Object'}->Id . ") $or_check_ticket_roles ) " .
-                " AND main.Type = $acl.PrincipalType AND main.id = $groupprinc.id) ";
+                " AND main.Type = $acl.PrincipalType AND main.id = $acl.PrincipalId) ";
         }
 
 	if ( $args{'IncludeSystemRights'} ) {
@@ -292,12 +291,11 @@
 
     $self->_AddSubClause( "WhichGroup",
         qq{
-          ( (    $acl.PrincipalId = $groupprinc.id
+          ( (    $acl.PrincipalId = main.id
              AND $acl.PrincipalType = 'Group'
              AND (   main.Domain = 'SystemInternal'
                   OR main.Domain = 'UserDefined'
-                  OR main.Domain = 'ACLEquivalence')
-             AND main.id = $groupprinc.id)
+                  OR main.Domain = 'ACLEquivalence'))
            $or_check_roles)
         }
     );


More information about the Rt-commit mailing list