Index: lib/class.tx_dam_db.php =================================================================== --- lib/class.tx_dam_db.php (revision 35444) +++ lib/class.tx_dam_db.php (revision ) @@ -1092,6 +1092,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 27648) +++ lib/class.tx_dam_iterator_references.php (revision ) @@ -331,11 +331,11 @@ /** * Returns an array with reference items + an array with the sorted items * - * @param string $selection: reference to a selection object + * @param tx_dam_selectionQuery $selection: reference to a selectionQuery object * @param array $columns: Array of column names required from the entries * @return void */ - function read(&$selection, $columns) { + function read(tx_dam_selectionQuery $selection, $columns) { $local_table = 'tx_dam'; $softRef_table = 'sys_refindex'; @@ -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(