Re: [PHP-DB] JOIN Very SLOW...

2001-11-28 Thread Jon Farmer

I would suggest changing COUNT(*) to COUNT(properties.PropertyID)

Regards

Jon
--
Jon Farmer
Systems Programmer, Entanet www.enta.net
Tel 01952 428969 Mob 07763 620378
PGP Key available, send email with subject: Send PGP Key



- Original Message - 
From: Martin E. Koss [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Wednesday, November 28, 2001 10:09 AM
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: [EMAIL PROTECTED]


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] JOIN Very SLOW...

2001-11-28 Thread Andrey Hristov

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 [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
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: [EMAIL PROTECTED]


 --
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]




-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]