RE: Optimize following Mysql-Query

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Title: RE: Optimize following Mysql-Query

Another large performance hit is the use of "like" with the wildcards.  If you can avoid wildcard searches do.
WHERE Personen.NAME IN ('$name')"; or "= $name"  Obviously this is only valid if the variable is going to match what is in the data exactly.

- Paul

-----Original Message-----
From: Andr Sannerholt [mailto:sannerholt@freenet.de]
Sent: Friday, May 30, 2003 6:49 AM
To: php-db@lists.php.net
Subject: Optimize following Mysql-Query


Hi Everyone,

I have the following Mysql-Query that returns correct information, but it
just needs to much time (3-4 Minutes!!) Can you help me to optimize it?

$query=
"SELECT * FROM Firmennamen INNER JOIN Master ON Firmennamen.ID=Master.FN
WHERE Master.FN IN (SELECT Master.FN FROM Master INNER JOIN Personen ON
Master.NN=Personen.ID WHERE Personen.NAME LIKE '%$name%')";
$result  =  mysql_query($abfrage2) or die("Anfrage results fehlgeschlagen");

Regards

Andre Sannerholt



--
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

[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux