-------------------------------------------------------
results for EXPLAIN
-------------------------------------------------------
articles | ALL | PRIMARY | NULL | NULL | NULL | 25818
| where used; Using temporary; Using filesort | stats | ref | vdate,article_id,v_a | article_id | 4 |
articles.id | 15 | where used | z1 | eq_ref | PRIMARY,parent_id | PRIMARY | 2 |
stats.zone_id | 1 | where used | z2 | eq_ref | PRIMARY | PRIMARY | 2 | z1.parent_id | 1
| -------------------------------------------------------






The big problem here is that we either scan the whole articles table, or, in the second case, look up too many refrences in it during a join because the stats table has too many matching records even withing the range constraint. Do you have a timestamp field in the articles table that is a key and that you can constrain if not exactly then at least with some reasonable upper and lower bound?


An alternative solution ( better in the long run, in my opinion, but more work) - add statistical columns ( view_count, printed_count, emailed_count) to the articles table, and keep them updated on each event.

--
Sasha Pachev
Create online surveys at http://www.surveyz.com/

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]



Reply via email to