WordPress.org

Ready to get started?Download WordPress

Forums

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

  1. bactisme
    Member
    Posted 1 year 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 );
    }

    http://wordpress.org/extend/plugins/disqus-comment-system/

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.