Jira pre-indexing query is slow due to slower mysql execution plan

Jeevan Patnaik December 30, 2020

Hi,

One of our Jira instance has index page opening very slowly everytime (unless the query is cached in database). I see the query that is taking longer is as follows and when I compared the execution plan of the query with that of other instances, it is choosing a slower execution plan:

mysql> explain SELECT COUNT(I.ID) FROM jiraissue I WHERE (I.PROJECT IN ('15101', .........'25804') ) AND (I.ARCHIVED = 'Y' );

| id | select_type | table | partitions | type | possible_keys | key | key_len | ref | rows | filtered | Extra |

| 1 | SIMPLE | I | NULL | range | issue_proj_status | issue_proj_status | 9 | NULL | 440933 | 10.00 | Using index condition; Using where |

On other instances, it is not using index condition and using only where. So, I ran the same query with option ignore index(issue_proj_status) to not use Index condition and then the query is completed fast. 

mysql> explain SELECT COUNT(I.ID) FROM jiraissue I ignore index(issue_proj_status) WHERE (I.PROJECT IN ('15101', .........'25804') ) AND (I.AR
CHIVED = 'Y' );

| id | select_type | table | partitions | type | possible_keys | key | key_len | ref | rows | filtered | Extra |

| 1 | SIMPLE | I | NULL | ALL | NULL | NULL | NULL | NULL | 4335153 | 5.00 | Using where |


mysql> SELECT COUNT(I.ID) FROM jiraissue I ignore index(issue_proj_status) WHERE (I.PROJECT IN (15101', .........'25804') ) AND (I.ARCHIVED = 'Y' );
+-------------+
| COUNT(I.ID) |
+-------------+
| 0 |
+-------------+
1 row in set (15.03 sec)

The only difference that I could find between the instances is that the number of projects in the issue instance is high (1009). This query runs everytime indexing page is opened and it takes atleast 15 mins of time.

Any ideas on what causing this and how to fix it?

1 answer

0 votes
Fadoua
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
December 31, 2020

@Jeevan Patnaik 

Did you check your DB and instance configuration? What I mean when we work in Atlassian Tools and the number of projects, issues,....goes up you need to make sure that your Server (where application is sitting) and DB have enough space, JVM,.......same goes with the DB you need to make sure that you are meeting the requirements.

https://confluence.atlassian.com/adminjiraserver/jira-applications-installation-requirements-938846826.html

Please make sure to select your Jira version.

Best,

Fadoua

Suggest an answer

Log in or Sign up to answer