[Suggestion] Optimise SQL CALLS
-
On le disqus.php In the function dsq_dash_comment_counts().
Lucky for you, the count on all the comment run pretty quickly. But I have 500k comments in my database and cannot afford this query.
I suggest to cache this information
if ( false === ( $count = get_transient( ‘dsq_dash_comment_counts’ ) ) ) {
$count = $wpdb->get_results(“
SELECT comment_approved, COUNT( * ) AS num_comments
FROM {$wpdb->comments}
WHERE comment_type != ‘trackback’
AND comment_type != ‘pingback’
GROUP BY comment_approved
“, ARRAY_A );
set_transient( ‘dsq_dash_comment_counts’, $count , 60*60 );
}
The topic ‘[Suggestion] Optimise SQL CALLS’ is closed to new replies.