SELECT DISTINCT L.* from data.languages L, data2.user U WHERE L.id IN (U.language_1, U.language_2, U.language_3) order by name;
I believe the IN clause is a shade faster than multiple ORs, but I'm not 100% sure. 'Luck -Szii ----- Original Message ----- From: "andy" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Tuesday, May 07, 2002 9:38 AM Subject: [PHP-DB] need help on improving performance on this querry > Hi there, > > I do have a user table with 3 languages. I know that I should have put them > into a seperate table. I still could, but would take lots of recoding. I > discovered, that as soon as I leave out the OR statements the querry takes > under 0.2 s. With the two OR it takes on a 10000 records about 1.4 s. > > Is there a way to increase the performance with a different querry? I did > already index the fields, but does not look much better though. > > SELECT DISTINCT L.* > from data.languages L, data2.user U > where > L.id = U.language_1 > or L.id = U.language_2 > or L.id = U.language_3 > order by name > > Thanx for any help, > > Andy > > > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php