Bug 437912

Summary: FlagList() really slow when included in a column for query results
Product: [Community] Bugzilla Reporter: David Lawrence <dkl>
Component: DatabaseAssignee: Tony Fu <tfu>
Status: CLOSED NEXTRELEASE QA Contact:
Severity: low Docs Contact:
Priority: low    
Version: 3.2CC: dkl
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2008-05-28 03:49:09 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 406071    
Attachments:
Description Flags
Patch to speed up FlagList() stored function some (v1)
dkl: review? (tfu)
Patch to speed up FlagList() stored function some (v2) tfu: review+

Description David Lawrence 2008-03-18 04:17:40 UTC
Description of problem:
Due to recent changes in the stored function FlagList(), it has become slow to
return results when including the column in buglist.cgi. The changes were due to
the flags.is_active columns no longer present in 3.2 schema. Need to determine
where the performance hit is coming from in the stored function code.

rh_bugzilla_3:
redhat/bugs-functions.mysql

Comment 1 David Lawrence 2008-03-24 21:55:37 UTC
Created attachment 298957 [details]
Patch to speed up FlagList() stored function some (v1)

This simplification seems somewhat faster to me than what is there currently. I
am passing in only the bug id and user id to the function. The function is then
looking up the group_ids for the user in a sub select instead of creating a
temporary table. 

Alot of the slowdown with the current implementation seems to be coming from
blocking while trying to create the tmpGroupIds temp table. Alleviating that
need seems to speed it up some although it is not as fast as it could be.

Tony please have a look at the change and let me know what you think.

Dave

Comment 2 David Lawrence 2008-03-26 03:33:40 UTC
Created attachment 299092 [details]
Patch to speed up FlagList() stored function some (v2)

Updated patch. Enabled inclusion of attachment flags in the flag list if the
flagged attachment is either not private or the user is in the insider group
which allows them to see the attachment.

Tony, please take a look. I have this change running on
https://bugdev.devel.redhat.com/bugzilla if you want to try it out against the
snapshot database.

Thanks

Comment 3 Tony Fu 2008-05-02 06:20:07 UTC
Dave,

This new sql fucntion looks good.  I have tested it against a test database and
it works fine.

By the way, I don't have a sudo permission to access bz-web1-test.devel.  Can
you set set it up for me please?


Thanks,
Tony

Comment 4 David Lawrence 2008-05-02 14:48:41 UTC
Thanks Tony. Changing to MODIFIED.