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?