Re: Optimize following Mysql-Query

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

 



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++;
    }
?>



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