Make WordPress Core

Opened 16 years ago

Closed 16 years ago

Last modified 16 years ago

#8057 closed defect (bug) (fixed)

get_comments() needs to cache

Reported by: viper007bond's profile Viper007Bond Owned by:
Milestone: 2.7 Priority: normal
Severity: normal Version: 2.7
Component: Optimization Keywords: needs-patch
Focuses: Cc:

Description

Reported by Mark.

get_comments() needs to use the internal cache, even if it's just caching the results of that particular SQL query.

get_page_of_comment() uses get_comments() to get all comments of the single comment's post so it can loop through them and calculate what page that comment will be on. Each call to get_page_of_comment() (and there's a lot due to get_comment_link()) currently results in a MySQL query.

Ouch.

Change History (6)

#1 @Viper007Bond
16 years ago

In short: calling get_comments() 10 times with the same parameters should result in only one SQL query I think.

#2 @Viper007Bond
16 years ago

  • Component changed from Comments to Optimization
  • Milestone changed from 2.7 to 2.9
  • Owner set to anonymous
  • Priority changed from highest omg bbq to normal
  • Severity changed from critical to normal

Currently working on a patch to avoid using get_page_of_comment() as much and for get_page_of_comment() to avoid using get_comments() altogether (it'll still use a query though, but it'll be a much lighter one).

#3 @Viper007Bond
16 years ago

Done: http://trac.wordpress.org/ticket/7956#comment:17

It'd still be nice if get_comments() cached, but it's no longer a big deal and doesn't need to be done for 2.7

#4 @ryan
16 years ago

(In [9511]) Add caching to get_comments(). see #8057

#5 @Viper007Bond
16 years ago

  • Milestone 2.9 deleted
  • Resolution set to fixed
  • Status changed from new to closed

Was fixed in 2.7.

#6 @DD32
16 years ago

  • Milestone set to 2.7
Note: See TracTickets for help on using tickets.