Defect #16091
closedExport CSV with many custom field runs many queries
0%
Description
Hello!
When exporting issues in CSV with lot of custom field (more than 20) it's very slow. We've made an audit and we have found there are many sql requests like that : (we use mysql)
140127 16:38:49 2 Query SELECT `issues`.* FROM `issues` WHERE `issues`.`id` = 35006 LIMIT 1
2 Query SELECT `issue_relations`.* FROM `issue_relations` WHERE `issue_relations`.`issue_from_id` = 35007
2 Query SELECT `issue_relations`.* FROM `issue_relations` WHERE `issue_relations`.`issue_to_id` = 35007
2 Query SELECT `custom_values`.`id` AS t0_r0, `custom_values`.`customized_type` AS t0_r1, `custom_values`.`customized_id` AS t0_r2, `custom_values`.`custom_field_id` AS t0_r3, `custom_values`.`value` AS t0_r4, `custom_fields`.`id` AS t1_r0, `custom_fields`.`type` AS t1_r1, `custom_fields`.`name` AS t1_r2, `custom_fields`.`field_format` AS t1_r3, `custom_fields`.`possible_values` AS t1_r4, `custom_fields`.`regexp` AS t1_r5, `custom_fields`.`min_length` AS t1_r6, `custom_fields`.`max_length` AS t1_r7, `custom_fields`.`is_required` AS t1_r8, `custom_fields`.`is_for_all` AS t1_r9, `custom_fields`.`is_filter` AS t1_r10, `custom_fields`.`position` AS t1_r11, `custom_fields`.`searchable` AS t1_r12, `custom_fields`.`default_value` AS t1_r13, `custom_fields`.`editable` AS t1_r14, `custom_fields`.`visible` AS t1_r15, `custom_fields`.`multiple` AS t1_r16 FROM `custom_values` LEFT OUTER JOIN `custom_fields` ON `custom_fields`.`id` = `custom_values`.`custom_field_id` WHERE `custom_values`.`customized_id` = 35007 AND `custom_values`.`customized_type` = 'Issue' ORDER BY custom_fields.position
NB : there are differences in sql requests used between using a filter with all columns with doing export on selected column and no filter and doing export on all columns...
Whe are about 5 minutes to export 3300 issues with 20 customs fields...
Related issues