[TYPO3-dam] Slow SQL query in dam 1.1 beta 05 ?

Jonas Tränkner jonas.traenkner at airgamer.de
Thu Mar 29 10:55:49 CEST 2007


Hi Ben, 

thx for your answer.

I have the solution for my problem:
Heres again the SQL query, directly copied from dams debug output:
// The 'slow' one:
// ===========================
SELECT DISTINCT tx_dam . *
FROM tx_dam
LEFT JOIN tx_dam_mm_cat AS tx_dam_mm_cat_a ON tx_dam.uid = tx_dam_mm_cat_a.uid_local, tx_dam_cat
WHERE 1
AND tx_dam.pid
IN ( 27 )
AND tx_dam.sys_language_uid =0
AND tx_dam.file_status !=255
AND (
tx_dam_mm_cat_a.uid_foreign
IN ( 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120 )
)

AND tx_dam.deleted =0
AND tx_dam_cat.deleted =0

ORDER BY title
LIMIT 20
// ===========================

The solution is adding to where statement 'AND tx_dam_cat.uid=tx_dam_mm_cat_a.uid_local'.

Also tested on another Server, same result.
Seems that our servers don't optimize this statement or sth. like that.

I think this problem is in class.tx_dam_selectionCategory.php in function selection_getQueryPart().
I added at line#259:
$this->damSel->qg->addWhere('AND tx_dam_cat.uid=tx_dam_mm_cat_'.$alias.".uid_local", 'WHERE');

No it works fast :P
Greetz
Jonas






More information about the TYPO3-project-dam mailing list