Details
- 
    Type:Bug 
- 
    Status: Done/Fixed
- 
    Priority:Trivial 
- 
    Resolution: Fixed/Completed
- 
    Affects Version/s: 4.4.4
- 
    Fix Version/s: 4.5
- 
    Component/s: None
- 
    Labels:
Description
While writing a custom participant report I noticed the built in one was slow. On looking at the query I noticed the join in the report doesn't match the index - resulting in an unindexed join
Altering the join from 
            LEFT JOIN civicrm_line_item line_item_civireport
AND  line_item_civireport.entity_id = {$this->_aliases['civicrm_participant']}.id
      ";
to
            LEFT JOIN civicrm_line_item line_item_civireport
            ON line_item_civireport.entity_table = 'civicrm_participant' 
AND  line_item_civireport.entity_id = {$this->_aliases['civicrm_participant']}.id
      ";
fixes this query - although I suspect the join should not have actually been called - in this instance - but I am not investigating that.