[TYPO3] Slow query

Daniel Schledermann daniel at typoconsult.dk
Wed Sep 27 15:51:12 CEST 2006


Lukas wrote:
> My web hotel gave me an alert for a slow SQL query that took 16 seconds. 
> When I ran the same question in PHPmyAdmin, it took 6 seconds, which is 
> shorter but still pretty long.
> 
> I guess the query came from macina-searchbox. How can I speed it up?
> 
> Here's the query:
> SELECT IR.phash
> FROM index_words IW,
> index_rel IR,
> index_section ISEC
> WHERE
> IW.baseword LIKE '%ängsholmmen%'
> AND IW.wid=IR.wid
> AND ISEC.phash = IR.phash
> AND ISEC.rl0 IN (130)
> AND is_stopword=0
> GROUP BY IR.phash;

Try running it in phpmyadmin with:

EXPLAIN SELECT IR.phash
FROM index_words IW,
index_rel IR,
index_section ISEC
WHERE
IW.baseword LIKE '%ängsholmmen%'
AND IW.wid=IR.wid
AND ISEC.phash = IR.phash
AND ISEC.rl0 IN (130)
AND is_stopword=0
GROUP BY IR.phash;

Thats is always the first place to start debugging a slow SQL query. 
This will give you information on how many rows scanned in the tables 
involved.

/D



More information about the TYPO3-english mailing list