>>>>> "gregor" == gregor brabyn <[email protected]> writes:
gregor> The query that slows a web page load down by typically 30
gregor> seconds is:
gregor> SELECT COUNT(*) AS count ,
gregor> TIMESTAMP(CONCAT(YEAR(t.timestamp), "-",
gregor> MONTH(t.timestamp), "-", DAYOFMONTH(t.timestamp))) AS
gregor> division FROM listing l, listing_impression t WHERE
gregor> l.id=t.listing_id AND l.company_id=710 AND t.listing_type
gregor> = 'full' AND t.timestamp > DATE_SUB(NOW(), INTERVAL 7 day)
gregor> GROUP BY division ORDER BY division
First write this properly see we are sure MySQL sees the join:
SELECT
COUNT(*) AS count,
TIMESTAMP(CONCAT(YEAR(t.timestamp), "-", MONTH(t.timestamp), "-",
DAYOFMONTH(t.timestamp))) AS division
FROM listing l
join listing_impression t on
l.id=t.listing_id
WHERE
l.company_id=710 AND t.listing_type = 'full' AND t.timestamp >
DATE_SUB(NOW(), INTERVAL 7 day)
GROUP BY division
ORDER BY division
Now execute this query with the following in front "explain "
and post the output here.
--
Cheers,
Berend de Boer
--~--~---------~--~----~------------~-------~--~----~
NZ PHP Users Group: http://groups.google.com/group/nzphpug
To post, send email to [email protected]
To unsubscribe, send email to
[email protected]
-~----------~----~----~----~------~----~------~--~---