[rt-users] UseSQLForACLChecks / CurrentUserCanSee

Ruslan Zakirov ruz at bestpractical.com
Fri Jan 25 11:50:26 EST 2013


On Fri, Jan 25, 2013 at 8:14 PM, ktm at rice.edu <ktm at rice.edu> wrote:
> On Fri, Jan 25, 2013 at 02:15:02AM +0400, Ruslan Zakirov wrote:
>> On Fri, Jan 25, 2013 at 1:52 AM, ktm at rice.edu <ktm at rice.edu> wrote:
>> > We are running version 3.8.13 with a PostgreSQL 9.2 backend. I will
>> > try to look into it further and see if I can locate the cause of the
>> > pathological performance issues.
>>
>> Then you don't have one performance improvement that is only in RT
>> 4.0+, grab patch from b5b357766929465521281c2886456c6b1fe24824 commit.
>>
>> Pg's log of slow queries would be next stop.
>>
>>
>> --
>> Best regards, Ruslan.
>>
>
> Hi Ruslan,
>
> I could not figure out how to pull this patch from the git commit, but
> here are the two top queries from the DB logs:


git show <sha>

or

https://github.com/bestpractical/rt/commit/b5b357766929465521281c2886456c6b1fe24824.patch


> SELECT count ( DISTINCT main.id ) FROM tickets main JOIN groups groups_1 ON ( groups_1.domain = '' ) AND ( groups_1.instance = main.id ) LEFT JOIN cachedgroupmembers cachedgroupmembers_2 ON ( cachedgroupmembers_2.memberid = '' ) AND ( cachedgroupmembers_2.groupid = groups_1.id ) WHERE ( main.STATUS != '' ) AND ( main.queue = '' AND main.STATUS = '' AND ( ( main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' OR main.queue = '' ) OR ( main.OWNER = '' ) OR ( cachedgroupmembers_2.memberid IS NOT NULL AND groups_1.type = '' ) OR ( cachedgroupmembers_2.memberid IS NOT NULL AND groups_1.type = '' ) ) ) AND ( main.type = '' ) AND ( main.effectiveid = main.id ) ;
>
> It was executed 260 time for a total DB time of 2.65 seconds.

Well. You observe several problems:

1) This query you see comes from Quick Search box that in 3.8 takes
Q*S SQL queries, where Q is number of queues and S number of statuses.
In 4.0.x RT does the same using one query only.

2) As pg takes small fraction then you should for sure start with the patch.

3) Recently we discovered a problem with most searches for tickets on
Pg. Pg wrongly estimates main.effectiveid = main.id condition to
return very small number of rows. Before you get here you should other
things first.

[snip]

First of all, apply the patch. Consider upgrade. I will try to find my
patch for third problem that doesn't involve schema change.

> Regards,
> Ken

-- 
Best regards, Ruslan.



More information about the rt-users mailing list