Create additional method atLeastOneIssueExists for performance enhancement over counting the issues

XMLWordPrintable

    • 6
    • 5

      Problem Definition

      Current method com.atlassian.jira.issue.IssueManager#getIssueCountForProject might have performance overhead for large Jira installations due to slow SQL.
      In some cases it's not necessary to count a number of issues, you just need to check is the project is not empty.

      Additional comments:

      • This method is executed as part of board-scope-filter which is executed quite often, see JSWSERVER-16185;
      • Example of SQL requests, note 2 requests per page load when viewing an issue:
        2018-06-11 12:55:58,804 http-nio-8081-exec-19 admin 775x382x1 hj63dl /browse/AG-13 3ms "SELECT COUNT(I.ID) FROM public.jiraissue I WHERE I.PROJECT='10300'"
        2018-06-11 12:56:00,716 http-nio-8081-exec-16 admin 776x449x3 hj63dl /rest/projects/1.0/project/AG/lastVisited 1ms "SELECT COUNT(I.ID) FROM public.jiraissue I WHERE I.PROJECT='10300'"
        
      • In case of large jiraissue table this SQL might take more than 1s to execute;

      Suggested Solution

      Create additional method atLeastOneIssueExists(Long projectId) similar to com.atlassian.jira.issue.IssueManager#atLeastOneIssueExists
      It should have performance enhancement, since it will not count the issues as it's currently done in getIssueCountForProject.
      After all, we are only executing it on board-scope-filter to check if the project is not empty.

      Workaround

      None

            Assignee:
            Grzegorz Tanczyk (Inactive)
            Reporter:
            Andriy Yakovlev [Atlassian]
            Votes:
            5 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:
              Resolved: