Disqus Comment System
[Suggestion] Optimise SQL CALLS (1 post)

  1. bactisme
    Posted 2 years ago #

    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 );


Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Disqus Comment System
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic


No tags yet.