[Rt-devel] Re: SetOwner speed

Alexey G Misyurenko mag at caravan.ru
Mon Jun 19 05:03:49 EDT 2006


Ruslan Zakirov wrote:
> I spotted "AND (   (acl.objecttype = 'RT::System' AND acl.objectid =
> 1) OR (acl.objecttype = 'RT::System') )" which is really wierd and
> should be fixed in RT code. This should be just "AND (acl.objecttype =
> 'RT::System' AND acl.objectid = 1)", without OR ... part, but I don't
> think this change would give much speed improvement.
>

This part of SQL query is result of next function sequince call

Take -> SetOwner -> _CleanupInvalidDelegations -> HasRight(Right => 
'DelegateRights',
                                  Object => $RT::System) -> _HasRight

Looks like condition
   $self->can('_IsOverrideGlobalACL')  && $self->_IsOverrideGlobalACL( 
$args{Object})

is allways false and     push( @objects, 'RT::System' )  is allways called.

=== lib/RT/Principal_Overlay.pm
    push( @objects, 'RT::System' )
      unless $self->can('_IsOverrideGlobalACL')
             && $self->_IsOverrideGlobalACL( $args{Object} );
===

Also in lib/RT/Principal_Overlay.pm I see strange code constructions

right after building arrays @role_clauses and @object_clauses
is placed next code

       $check_roles .= join ' OR ', @role_clauses;
       $check_objects = join ' OR ', @object_clauses;

Why value of $check_roles is appended by join and $check_objects
is overwritten ??

> Also, I didn't know you're using Oracle. I can't read its explains,
> sorry. From oracle's docs I see that it has output formats of explains
> which have numbers of rows oracle scans. Such explain could be more
> informative.
>
> On 6/17/06, Alexey G Misyurenko <mag at caravan.ru> wrote:
>> Alexey G Misyurenko wrote:
>> > Ruslan Zakirov wrote:
>> >> On 6/15/06, Alexey G Misyurenko <mag at caravan.ru> wrote:
>> >>> Ruslan Zakirov wrote:
>> >>> > Ok, I think index on CachedGroupMembers(MemberId, GroupId, 
>> Disabled)
>> >>> > should help you with query 4, but to help you with other queries I
>> >>> > need to see EXPLAINs...
>> >>> >
>> > Sorry for the pause with answer - second oracle installation take a
>> > time...
>> >
>> >>> > Please, make explains before you'll add index and after.
>> >>> >
>> >
>> >
>> >  WITH INDEX
>> >  ----------
>> >  SQL Statement from editor:
>> >
>> >
>> SQL Tunning toolkit for oracle just finish analise what can be done with
>> original
>> SQL request generated by RT .
>>
>> SELECT *
>>   FROM (SELECT limitquery.*, ROWNUM limitrownum
>>           FROM (SELECT acl.ID
>>                   FROM acl, GROUPS, principals, cachedgroupmembers
>>                  WHERE (   acl.rightname = 'SuperUser'
>>                         OR acl.rightname = 'DelegateRights'
>>                        )
>>                    AND principals.disabled = 0
>>                    AND cachedgroupmembers.disabled = 0
>>                    AND principals.ID = GROUPS.ID
>>                    AND principals.principaltype = 'Group'
>>                    AND principals.ID = cachedgroupmembers.groupid
>>                    AND cachedgroupmembers.memberid = 10
>>                    AND (   (acl.objecttype = 'RT::System' AND
>> acl.objectid = 1
>>                            )
>>                         OR (acl.objecttype = 'RT::System')
>>                        )
>>                    AND acl.principalid = principals.ID
>>                    AND acl.principaltype = 'Group') limitquery
>>          WHERE ROWNUM <= 1)
>>  WHERE limitrownum >= 1
>>
>



More information about the Rt-devel mailing list