Can you explain better what you wont to count, please?
This query seem a bit strange, can you explain the kinds of relations?
You can check/add the indexes on foreign keys and may be you can
change: "LEFT JOIN authors" with "INNER JOIN authors" (if article
hasOne author ) ... and:...  "LEFT JOIN websites" with "INNER JOIN
websites" if article hasOne website , but all depends of yours
relations..
Sanza

On 8 Ott, 12:08, victor piousbox <[email protected]> wrote:
> I have a website with a bunch of articles. This is one of the queries
> executed by I assume the Paginator:
>
> SELECT COUNT(*) AS `count` FROM `articles` AS `Article` LEFT JOIN
> `authors` AS `Author` ON (`Article`.`author_id` = `Author`.`id`) LEFT
> JOIN `websites` AS `Website` ON (`Article`.`website_id` =
> `Website`.`id`) LEFT JOIN `articles` AS `ParentArticle` ON
> (`Article`.`article_id` = `ParentArticle`.`id`) LEFT JOIN `articles`
> AS `ChildArticle` ON (`ChildArticle`.`article_id` = `Article`.`id`)
> WHERE 1 = 1
>
> It takes 2ms when I just go to /articles/index, but if I edit and save
> an article, the same query takes 123000ms (that's two minutes). I have
> 3300 articles.
>
> Why does this happen? And how can I avoid it?
>
> _V

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected] For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en

Reply via email to