Recent Topics

1 Mar 27, 2006 22:48    

Hi,

I've installed B2evolution with hundreds of blogs, hundreds of comments and thousands of pages served daily.

In the past week we've experienced a low performance, not due to a spam. The reason is a query in the b2evocore/_function_cats.php

SELECT postcat_cat_ID AS cat_ID, COUNT(*) AS cat_postcount
FROM evo_postcats INNER JOIN evo_posts ON postcat_post_ID = ID
WHERE  (  ( post_status = 'private' AND post_author = 1 )  OR post_status IN ('published','protected') )  AND  post_issue_date <= '2006-03-27 19:23:02'
GROUP BY cat_ID;

This query uses temporary

+----+-------------+--------------+------+-------------------------------------------------+---------+---------+--------------------------+-------+----------------------------------------------+
| id | select_type | table        | type | possible_keys                                   | key     | key_len | ref                      | rows  | Extra                                        |
+----+-------------+--------------+------+-------------------------------------------------+---------+---------+--------------------------+-------+----------------------------------------------+
|  1 | SIMPLE      | evo_posts    | ALL  | PRIMARY,post_issue_date,post_author,post_status | NULL    |    NULL | NULL                     | 17737 | Using where; Using temporary; Using filesort |
|  1 | SIMPLE      | evo_postcats | ref  | PRIMARY                                         | PRIMARY |       4 | b2evolution.evo_posts.ID |     1 | Using where; Using index                     |
+----+-------------+--------------+------+-------------------------------------------------+---------+---------+--------------------------+-------+----------------------------------------------+

It seems that is not a good idea to put in a query dates in the format date('Y-m-d H:i:s'). If your MySQL has enabled query cache and you serve thousands of pages this where clause doesn't permit to profit from the query cache. At each served page the value of the date changes and the query is obviously different and no query cache is possible.

I hope it can help somebody


Form is loading...