Re: JOIN Very SLOW...
| From: | Andrey Hristov | Date: | Wed, 28 Nov 2001 10:26:39 +0000 |
| Subject: | Re: JOIN Very SLOW... | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-14650@lists.php.net to get a copy of this message | ||
You use LEFT JOIN so your query is optimized. Probably your tables are big, you don't have many
MB of RAM. When you have big RAM, I
think that tables reside in memory and join of 5 tables every >600,000 rows is done for 4-5s. May
be you have to increase some of
the buffers sizes of mysql.
Regards,
Andrey Hristov
----- Original Message -----
From: "Martin E. Koss" <mek@mek.co.uk>
To: <php-db@lists.php.net>
Sent: Wednesday, November 28, 2001 12:09 PM
Subject: [PHP-DB] JOIN Very SLOW...
> The following does work but it extremely slow.
>
> $phselect = "select COUNT(*) AS phTotal from properties LEFT JOIN
> propertydetails ON properties.PropertyID=propertydetails.PropertyID where
> ((propertydetails.Image1Desc='') AND
> (properties.PropertyType='$PropertyType'))";
>
> $phresult = mysql_query ($phselect,$conID);
> while ($phrow = mysql_fetch_array($phresult)) {
> $phTotal = $phrow["phTotal"];
> PRINT "<td align=\"right\">$phTotal</td>\n";
> } // end WHILE
>
> Is there an obvious problem here and can anyone help?
>
> Martin E. Koss
> M: 07946-706459
> E: mek@mek.co.uk
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-db-unsubscribe@lists.php.net
> For additional commands, e-mail: php-db-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>
>