Hi,
I wonder if someone is willing to help me optimize the following query:
SELECT <somefields>
FROM schools
LEFT JOIN addresses ON addresses.fkSchool = idSchool
LEFT JOIN users ON users.idUser = fkLogin
LEFT JOIN xlevels ON xlevels.fkSchool = idSchool
WHERE fkDep = 1
AND (fkLevel = 2 OR fkLevel = 4)
AND (Address_Street_CH LIKE '%string%' OR Address_Street2_CH Like '%string%')
ORDER BY School_Name_CH
Notes:
* The fk prefix stans for "foreign key", and id as a primary key.
Well, there are about 3,000 rows in the schools table, and about the same on addresses, and schoolsxlevels. That query takes more than one minute to execute on my PIII 500 Mhz, so I wonder if there's a way to speed up the query...
I'll be really grateful if you can help me! But thanks anyway for reading me!
Sincerely,
Ivan V.
I wonder if someone is willing to help me optimize the following query:
SELECT <somefields>
FROM schools
LEFT JOIN addresses ON addresses.fkSchool = idSchool
LEFT JOIN users ON users.idUser = fkLogin
LEFT JOIN xlevels ON xlevels.fkSchool = idSchool
WHERE fkDep = 1
AND (fkLevel = 2 OR fkLevel = 4)
AND (Address_Street_CH LIKE '%string%' OR Address_Street2_CH Like '%string%')
ORDER BY School_Name_CH
Notes:
* The fk prefix stans for "foreign key", and id as a primary key.
Well, there are about 3,000 rows in the schools table, and about the same on addresses, and schoolsxlevels. That query takes more than one minute to execute on my PIII 500 Mhz, so I wonder if there's a way to speed up the query...
I'll be really grateful if you can help me! But thanks anyway for reading me!
Sincerely,
Ivan V.