RE: [PHP-DB] Optimize following Mysql-Query
| From: | Vaughn, Paul | Date: | Fri, 30 May 2003 15:03:00 +0000 |
| Subject: | RE: [PHP-DB] Optimize following Mysql-Query | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-28175@lists.php.net to get a copy of this message | ||
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: [PHP-DB] 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