I have a Kohana 3.3 application, running on WAMP (PHP 5.4.3) which uses a static function to get a list of recent articles. When I load the page, the Application Execution time (via Kohana Profiler) is 6.7 seconds. When I load the same page without calling the get_recent method (passing an empty array) the Application Execution time is 0.3 seconds.
This indicates that this static method is causing a problem. I have run the raw MySQL and it takes 1.4 seconds.
This is the code inside the method:
$articles = self::factory('user_articles')
->join('articles', 'INNER')->on('user_articles.article_id', '=', 'articles.id')
->order_by('user_articles.created_at', 'ASC')
->limit(10)
->group_by('articles.id')->find_all();
There is an index on user_articles.article_id
and on articles.id
. Is there anything else I can do to optimize the query or speed up the execution time?