Again I’m having troubles while migrating from Access to MySQL.
The following SQL Statements works fine with Access:
SELECT *
FROM tbl_content
WHERE contentID IN (
SELECT contentID
FROM tbl_tags
WHERE Bezeichnung IN (
SELECT Bezeichnung
FROM tbl_tags t2
WHERE t2.contentID= " & contentID & ")
AND contentID <> " & contentID & ")
AND Status = 1
ORDER BY Datum DESC LIMIT 0,5;
In MySQLthe performance is really slow. Any ideas for help?
You have answered your own question in the title. Generally speaking, MySQL does not optimise
IN (Subquery)as well as JOINS so you would be better off usingJOINAlso check that the relevant columns are indexed for increased performance.
EDIT
Further more I think
EXISTSMay be more efficient still in MySQL, butEXPLAINshould show more: