Index: lib/class.tx_dam_db.php =================================================================== --- lib/class.tx_dam_db.php (revision 42490) +++ lib/class.tx_dam_db.php (working copy) @@ -1104,6 +1104,8 @@ if ($uploadsPath) { $where[] = 'tx_dam_file_tracking.file_path='.$GLOBALS['TYPO3_DB']->fullQuoteStr($uploadsPath,'tx_dam_file_tracking'); } + // use index to preselect records + $where[] = $softRef_table . '.ref_string = CONCAT(' . $tracking_table . '.file_path,' . $tracking_table . '.file_name)'; $where[] = $softRef_table . '.ref_string LIKE CONCAT(' . $tracking_table . '.file_path,' . $tracking_table . '.file_name)'; $selectFields = implode(',', $fields); $whereClause = implode(' AND ', $where); Index: lib/class.tx_dam_iterator_references.php =================================================================== --- lib/class.tx_dam_iterator_references.php (revision 42490) +++ lib/class.tx_dam_iterator_references.php (working copy) @@ -367,6 +367,8 @@ // Look for references in file tracking table $where = array($softRefWhere); $where[] = $tracking_table . '.file_hash=' . $local_table . '.file_hash'; + // use index to preselect records + $where[] = $softRef_table . '.ref_string = CONCAT(' . $tracking_table . '.file_path,' . $tracking_table . '.file_name)'; $where[] = $softRef_table . '.ref_string LIKE CONCAT(' . $tracking_table . '.file_path,' . $tracking_table . '.file_name)'; $whereClause = implode(' AND ', $where); $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery( @@ -412,6 +414,8 @@ $fields = $local_table . '.uid'; $where = array($softRefWhere); $where[] = $tracking_table . '.file_hash=' . $local_table . '.file_hash'; + // use index to preselect records + $where[] = $softRef_table . '.ref_string = CONCAT(' . $tracking_table . '.file_path,' . $tracking_table . '.file_name)'; $where[] = $softRef_table . '.ref_string LIKE CONCAT(' . $tracking_table . '.file_path,' . $tracking_table . '.file_name)'; $whereClause = implode(' AND ', $where); $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(