Opened 18 years ago
Closed 17 years ago
#6770 closed defect (bug) (fixed)
large number of queries in the pages management page
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Milestone: | 2.6 | Priority: | normal |
| Severity: | minor | Version: | 2.5 |
| Component: | Optimization | Keywords: | |
| Focuses: | 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 (1)
Change History (7)
Note: See
TracTickets for help on using
tickets.
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.