View Issue Details

IDProjectCategoryView StatusLast Update
0005458mantisbtcustom fieldspublic2005-07-23 02:22
Reporterruss Assigned Tothraxisp  
PrioritynormalSeveritymajorReproducibilityalways
Status closedResolutionduplicate 
Product Version1.0.0a1 
Summary0005458: Slow queries on projects with many bugs and custom fields
Description

Slow query pulled from viewing the processlist in mysql:

SELECT DISTINCT mantis_bug_table.id AS id FROM mantis_project_table, mantis_bug_table LEFT JOIN mantis_custom_field_string_table mantis_custom_field_string_table_3 ON mantis_custom_field_string_table_3.bug_id = mantis_bug_table.id LEFT JOIN mantis_custom_field_string_table mantis_custom_field_string_table_2 ON mantis_custom_field_string_table_2.bug_id = mantis_bug_table.id WHERE mantis_project_table.enabled = 1 AND mantis_project_table.id = mantis_bug_table.project_id AND ( mantis_bug_table.project_id=2 ) AND (mantis_bug_table.view_state='10' OR mantis_bug_table.reporter_id='75')

The interesting thing is that the custom fields have no constraints set. I think they could be left out of the query. I fixed the slow queries on my setup by adding an index. I am running a recent checkout from cvs HEAD.

Added following index and the query returns in less 0.1 secs vs. ~60 secs on my system.

"alter table mantis_custom_field_string_table add index bug_id_idx (bug_id);"

The primary key does include bug_id, but it is the second field in the index therefore mysql does not use it for the query.

TagsNo tags attached.

Relationships

duplicate of 0005297 closedthraxisp performance problem when filtering on custom fields 
related to 0005207 closedthraxisp Improve performance of "My View" 

Activities

russ

russ

2005-04-20 03:05

reporter   ~0009842

Last edited: 2005-04-20 03:05

This may be related to 0005433 and 0005297

russ

russ

2005-04-20 03:08

reporter   ~0009843

Last edited: 2005-04-20 03:09

Can't edit bug but it should read:

"Added following index and the query returns in less 0.1 secs vs. approx. 60.0 secs on my system."

It looks like mantis doesn't like me using a tilde for 'approximately'.