Ticket #6770 (closed defect (bug): fixed)

Opened 9 months ago

Last modified 7 months ago

large number of queries in the pages management page

Reported by: Denis-de-Bernardy Assigned to: anonymous
Priority: normal Milestone: 2.6
Component: Optimization Version: 2.5
Severity: minor Keywords:
Cc:

Description

On a site with lots of static pages, you get all sorts of queries like:

array(3) {
    [0]=>
    string(87) "SELECT COUNT(*) FROM wp_comments WHERE comment_post_ID = 553 AND comment_approved = '0'"
    [1]=>
    float(0.00033998489379883)
    [2]=>
    string(24) "get_pending_comments_num"

they could be replaced by a single query, such as:

SELECT comment_post_ID, COUNT(comment_ID) FROM wp_comments WHERE comment_post_ID = IN ( post ID list ) AND comment_approved = '0' GROUP BY comment_post_ID

Attachments

get_comments_pending_num.diff (2.1 kB) - added by ryan on 04/21/08 22:03:59.
Consolidate get_pending_comments_num() queries

Change History

04/18/08 12:13:17 changed by Denis-de-Bernardy

also, on the same page, this query gets run twice:

[13]=>
  array(3) {
    [0]=>
    string(103) "SELECT post_status, COUNT( * ) AS num_posts FROM wp_posts WHERE post_type = 'page' GROUP BY post_status"
    [1]=>
    float(0.0020089149475098)
    [2]=>
    string(14) "wp_count_posts"
  }
  [14]=>
  array(3) {
    [0]=>
    string(103) "SELECT post_status, COUNT( * ) AS num_posts FROM wp_posts WHERE post_type = 'page' GROUP BY post_status"
    [1]=>
    float(0.0018351078033447)
    [2]=>
    string(14) "wp_count_posts"
  }

D.

04/18/08 16:02:41 changed by ryan

[7637] eliminates extra post_status count queries. Working on the post comment count queries.

04/21/08 22:03:59 changed by ryan

  • attachment get_comments_pending_num.diff added.

Consolidate get_pending_comments_num() queries

04/22/08 21:26:04 changed by ryan

(In [7775]) Consolidate get_pending_comments_num() queries. see #6770

04/22/08 21:33:30 changed by ryan

(In [7776]) Consolidate get_pending_comments_num() queries. see #6770 for 2.5

06/24/08 06:16:07 changed by DD32

  • milestone set to 2.6.

06/24/08 18:54:17 changed by ryan

  • status changed from new to closed.
  • resolution set to fixed.