Re: Optimize following Mysql-Query

From: Date: Fri, 30 May 2003 13:19:34 +0000
Subject: Re: Optimize following Mysql-Query
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-28161@lists.php.net to get a copy of this message
on 05/30/2003 7:49 AM, André Sannerholt at sannerholt@freenet.de appended the following bits to my mbox: > 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? Since subselects are fairly new to MySQL and one of the big reasons the developers didn't want to implement them was the performance hit, I'd bet that is your problem. Looking at the query, you might be able to join the Personen table directly so you can use its fields in the WHERE clause. Something like: $query= "SELECT * FROM Firmennamen INNER JOIN Master ON Firmennamen.ID=Master.FN INNER JOIN Personen ON Master.NN=Personen.ID WHERE Personen.NAME LIKE '%$name%'"; Also make sure that you are indexing the fields that you are performing the joins on. HTH. Sincerely, Paul Burney <http://paulburney.com/> <?php while ($self != "asleep") { $sheep_count++; } ?>

« previous php.db (#28161) next »