Hello guys,
I have similar situation..could you please advise if anything can be changed to improve gerrit query performance for our instance.
Environment: Gerrit 2.5, Postgresql 9.1, tomcat 7, Ubuntu 12.04.
So, I have an account Test Developer.
1) I give him Read access to one project with 1 Change, then go to page: All -> Merged, Gerrit generates ~1000 queries to the Database, so the page loads ~20-30 seconds:
SELECT T.change_key,T.created_on,T.last_updated_on,T.sort_key,T.owner_account_id,T.dest_project_name,T.dest_branch_name,T.open,T.status,T.nbr_patch_sets,T.current_patch_set_id,T.subject,T.topic,T.last_sha1_merge_tested,T.mergeable,T.row_version,T.change_id FROM changes T WHERE T.open='N' AND T.status=$1 AND T.sort_key<$2 ORDER BY T.sort_key DESC","parameters: $1 = 'M', $2 = '0022f8bc00000007'
2) I remove any access for him, then go to page All -> Merged - Situation is the same, ~1000 queries, ~20 seconds to load the page
3) Then I give access to about 50 projects (with one from the first variant) - <10 queries, milliseconds to load a page.
As i can assume, that is a issue with gerrit logic, so, are there any ways to improve gerrit queries?
As workaround I found, that using Search like: status:merged project:MyProject is working quickly (because WHERE project='MyProject" statement adds to the query) BUT any OR statement in the search returns us to the sloooow queries.