At 03:37 PM 6/28/99 , Kevin Smith wrote:
>The id from the table url is set as INT(11) yet the id from pageview is
>set as mediumint(8) unsigned. I believe, if these were set up the same
>i.e. either both as INT(11) or both as mediumint(8). This should help
>increase the speed.
done.
>Also, because of they way MySQL may run the query, try running this, the
>query defines the join between the two tables first...
funny, i would have thought that that would be slower. i thought ordering
the where clauses so the most restrictive part came first would reduce the
amount of work, but i guess i was mistaken.
>SELECT SUM(count) as 'Total Views'
>FROM pageview, url
>WHERE (((url.id)=(pageview.id))
>AND ((url.url like '/sports/%'))
>AND ((pageview.date)=('1999-06-16')));
>
>Let me know how you get on, I would infact be VERY interested.
OK, it's certainly a vast improvement:
+-------------+
| Total Views |
+-------------+
| 14398 |
+-------------+
1 row in set (1 min 14.45 sec)
still a little pokey considering i have to run several dozen similar
queries for each days stats but i guess i can deal.
thanks for your help!
Jon Drukman
Director Of Technology
GameSpot