Uploaded image for project: 'Jira Data Center'
  1. Jira Data Center
  2. JRASERVER-63002

Create new composite indexes for changegroup and changeitem tables to improve performance

    • 6.04
    • 94
    • Severity 3 - Minor
    • 158
    • Hide
      Atlassian Update – 01 February 2019

      Hello everyone,

      We introduced indexes to changegroup and changeitem tables.
      The new indexes are named chggroup_issue_id and chgitem_group_field. If you modified your indexes please adjust names/remove them. Otherwise they will get duplicated.

      As a friendly reminder - remember to update your database statistics frequently. Otherwise your queries will be vulnerable to parameter sniffing.

      Sincerely,
      Jira Bugfix Team.

      Show
      Atlassian Update – 01 February 2019 Hello everyone, We introduced indexes to changegroup and changeitem tables. The new indexes are named chggroup_issue_id and chgitem_group_field. If you modified your indexes please adjust names/remove them. Otherwise they will get duplicated. As a friendly reminder - remember to update your database statistics frequently. Otherwise your queries will be vulnerable to parameter sniffing. Sincerely, Jira Bugfix Team.

      Issue Summary

      Improve database indexes for changeitem and changegroup tables.

      Steps to Reproduce

      1. Have a Jira instance with a large number of issues, with heavy Agile usage.

      Expected Results

      Jira performance remains as usual.

      Actual Results

      Jira performance decreases greatly.

      Notes

      • The default indexes on both tables are as illustrated in the following screenshots:
        Table changeitem

        table changegroup
      • Based on users's DBA findings from their database monitoring, there's a high and troublesome CPU impact of the following query:
        SELECT CG.ID, CG.issueid, CG.AUTHOR, CG.CREATED, CI.ID, CI.groupid, CI.FIELDTYPE,
        CI.FIELD, CI.OLDVALUE, CI.OLDSTRING, CI.NEWVALUE, CI.NEWSTRING
         FROM changegroup CG INNER JOIN
         changeitem CI ON CG.ID = CI.groupid
         WHERE CG.issueid=:1 AND CI.FIELD=:2
        ORDER BY CG.CREATED ASC, CI.ID ASC
        

        This is understandable as JIRA retrieves change history for rendering issue history tabs and JIRA Agile reports. However the DBA was able to significantly improve the performance by creating 2 new indexes:

        CREATE UNIQUE INDEX JIRADBUSER.CHANGEGROUP_SCX1
         ON JIRADBUSER.CHANGEGROUP
        (ISSUEID, ID)
        TABLESPACE JIRA_DATA;
        
        CREATE INDEX JIRADBUSER.CHANGEITEM_SCX1
         ON JIRADBUSER.CHANGEITEM
         (GROUPID, FIELD)
        TABLESPACE JIRA_DATA;
        

        which is believed to improve the performance considerably. We are assuming the logic behind this is the join on changegroup.id <==> changeitem.groupid Please consider the following arguments from the user:

      Workaround

      Note: Always back up your data before performing any modifications to the database. If possible, test any alter, insert, update, or delete SQL commands on a staging server first.

      Adding the indexes mentioned before seems to alleviate the problem.

        1. Feedback DBA Securex.pdf
          277 kB
        2. Selection_198.jpg
          Selection_198.jpg
          27 kB
        3. Selection_199.jpg
          Selection_199.jpg
          36 kB
        4. v$sqlstats_After_Drop_Indexes.xlsx
          19 kB
        5. v$sqlstats_Before_Drop_Indexes.xlsx
          14 kB

          Form Name

            [JRASERVER-63002] Create new composite indexes for changegroup and changeitem tables to improve performance

            Renata Dornelas made changes -
            Remote Link Original: This issue links to "Page (Atlassian Documentation)" [ 408813 ]
            Sarah A made changes -
            Remote Link Original: This issue links to "PSR-38 (Bulldog)" [ 383358 ] New: This issue links to "PSR-38 (JIRA Server (Bulldog))" [ 383358 ]
            Patrick Turbett made changes -
            Remote Link Original: This issue links to "RAID-906 (JIRA Server)" [ 368695 ] New: This issue links to "RAID-906 (JIRA Server (Bulldog))" [ 368695 ]
            Patrick Turbett made changes -
            Remote Link Original: This issue links to "RUM-2070 (Bulldog)" [ 380505 ] New: This issue links to "RUM-2070 (JIRA Server (Bulldog))" [ 380505 ]
            Chris Terry made changes -
            Affects Version/s New: 7.13.18 [ 92692 ]
            Andriy Yakovlev [Atlassian] made changes -
            Labels Original: affects-server affects-zdu l1l2 performance-scalability pse-request triage New: affects-server affects-zdu database l1l2 performance-scalability pse-request triage
            Josh Steckler (Inactive) made changes -
            Remote Link New: This issue links to "Page (Confluence)" [ 525360 ]
            Josh Steckler (Inactive) made changes -
            Remote Link New: This issue links to "Page (Confluence)" [ 521320 ]
            Diego Baeza (Inactive) made changes -
            Description Original: h3. Issue Summary
            Improve database indexes for changeitem and changegroup tables.

            h3. Steps to Reproduce
            # Have a Jira instance with a large number of issues, with heavy Agile usage.

            h3. Expected Results
            Jira performance remains as usual.

            h3. Actual Results
            Jira performance decreases greatly.
             
            h3. Notes
            * The default indexes on both tables are as illustrated in the following screenshots:
            Table {{changeitem}}
            !Selection_198.jpg!
            table {{changegroup}}
            !Selection_199.jpg!

            * Based on users's DBA findings from their database monitoring, there's a high and troublesome CPU impact of the following query:
            {code}
            SELECT CG.ID, CG.issueid, CG.AUTHOR, CG.CREATED, CI.ID, CI.groupid, CI.FIELDTYPE,
             CI.FIELD, CI.OLDVALUE, CI.OLDSTRING, CI.NEWVALUE, CI.NEWSTRING
             FROM changegroup CG INNER JOIN
             changeitem CI ON CG.ID = CI.groupid
             WHERE CG.issueid=:1 AND CI.FIELD=:2
            ORDER BY CG.CREATED ASC, CI.ID ASC
            {code}
            This is understandable as JIRA retrieves change history for rendering issue history tabs and JIRA Agile reports. However the DBA was able to significantly improve the performance by creating 2 new indexes:
            {code}
            CREATE UNIQUE INDEX JIRADBUSER.CHANGEGROUP_SCX1
             ON JIRADBUSER.CHANGEGROUP
            (ISSUEID, ID)
            TABLESPACE JIRA_DATA;
            {code}
            {code}
            CREATE INDEX JIRADBUSER.CHANGEITEM_SCX1
             ON JIRADBUSER.CHANGEITEM
             (GROUPID, FIELD)
            TABLESPACE JIRA_DATA;
            {code}
            which is believed to improve the performance considerably. We are assuming the logic behind this is the join on changegroup.id <==> changeitem.groupid Please consider the following arguments from the user:
            ** The performance impact of the change history db look up got worse after upgrading JIRA to JIRA 7.1.8, and is directly related to their Agile usage (i.e. it improves considerably as soon as they disable JIRA Agile).
            ** See attachment and reports from their DBA on the changes they have made with the indexes and the improvements seen [^Feedback DBA Securex.pdf], [^v$sqlstats_After_Drop_Indexes.xlsx], [^v$sqlstats_Before_Drop_Indexes.xlsx].


            h3. Workaround
            {panel}
            (!) *Note:* Always back up your data before performing any modifications to the database. If possible, test any alter, insert, update, or delete SQL commands on a staging server first.
            {panel}
            Adding the indexes mentioned before seems to alleviate the problem.
            New: h3. Issue Summary
            Improve database indexes for changeitem and changegroup tables.

            h3. Steps to Reproduce
            # Have a Jira instance with a large number of issues, with heavy Agile usage.

            h3. Expected Results
            Jira performance remains as usual.

            h3. Actual Results
            Jira performance decreases greatly.
             
            h3. Notes
            * The default indexes on both tables are as illustrated in the following screenshots:
            Table {{changeitem}}
            !Selection_198.jpg!
            table {{changegroup}}
            !Selection_199.jpg!

            * Based on users's DBA findings from their database monitoring, there's a high and troublesome CPU impact of the following query:
            {code}
            SELECT CG.ID, CG.issueid, CG.AUTHOR, CG.CREATED, CI.ID, CI.groupid, CI.FIELDTYPE,
            CI.FIELD, CI.OLDVALUE, CI.OLDSTRING, CI.NEWVALUE, CI.NEWSTRING
             FROM changegroup CG INNER JOIN
             changeitem CI ON CG.ID = CI.groupid
             WHERE CG.issueid=:1 AND CI.FIELD=:2
            ORDER BY CG.CREATED ASC, CI.ID ASC
            {code}
            This is understandable as JIRA retrieves change history for rendering issue history tabs and JIRA Agile reports. However the DBA was able to significantly improve the performance by creating 2 new indexes:
            {code}
            CREATE UNIQUE INDEX JIRADBUSER.CHANGEGROUP_SCX1
             ON JIRADBUSER.CHANGEGROUP
            (ISSUEID, ID)
            TABLESPACE JIRA_DATA;
            {code}
            {code}
            CREATE INDEX JIRADBUSER.CHANGEITEM_SCX1
             ON JIRADBUSER.CHANGEITEM
             (GROUPID, FIELD)
            TABLESPACE JIRA_DATA;
            {code}
            which is believed to improve the performance considerably. We are assuming the logic behind this is the join on changegroup.id <==> changeitem.groupid Please consider the following arguments from the user:
            ** The performance impact of the change history db look up got worse after upgrading JIRA to JIRA 7.1.8, and is directly related to their Agile usage (i.e. it improves considerably as soon as they disable JIRA Agile).
            ** See attachment and reports from their DBA on the changes they have made with the indexes and the improvements seen [^Feedback DBA Securex.pdf], [^v$sqlstats_After_Drop_Indexes.xlsx], [^v$sqlstats_Before_Drop_Indexes.xlsx].


            h3. Workaround
            {panel}
            (!) *Note:* Always back up your data before performing any modifications to the database. If possible, test any alter, insert, update, or delete SQL commands on a staging server first.
            {panel}
            Adding the indexes mentioned before seems to alleviate the problem.
            Josh Steckler (Inactive) made changes -
            Remote Link New: This issue links to "Page (Confluence)" [ 518604 ]

              psuwala ΞΔ (Inactive)
              astephen@atlassian.com Adrian Stephen
              Affected customers:
              60 This affects my team
              Watchers:
              102 Start watching this issue

                Created:
                Updated:
                Resolved: