Project

General

Profile

Actions

Defect #20879

closed

Database slowdowns without indexes

Added by Sean Hagen about 10 years ago. Updated about 10 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
Database
Target version:
-
Start date:
Due date:
% Done:

0%

Estimated time:
Resolution:
Invalid
Affected version:

Description

We're using Redmine for our internal issue tracking system.

Yesterday the site started to get super slow, until it just stopped responding. The CPU on the server was pegged at 100%, and eventually the server would run out of memory and crash.

I created an index on 'enabled_modules'

create index em_name on enabled_modules (name(255));
and on 'issue_reads'
create index ir_issues_users on issue_reads (issue_id,user_id);

Now the same query that was killing the server completes in 1.3 seconds.

I also noticed that the query joins the same table (issue_reads) twice, once with a LEFT OUTER JOIN and once with a LEFT JOIN -- each time with the exact same ON conditions. Not sure if that's intentional.

I've attached the MySQL describe output from before the indexes and after.

Redmine version: v2.5.2
MySQL version ( mysql --version ): Ver 14.14 Distrib 5.1.73, for redhat-linux-gnu (x86_64) using readline 5.1


Files

describe-issues-query.txt (13.1 KB) describe-issues-query.txt Sean Hagen, 2015-09-29 21:50
Actions

Also available in: Atom PDF