Make WordPress Core

Opened 13 years ago

Closed 11 years ago

#1907 closed defect (bug) (wontfix)

page_rows -function inefficient?

Reported by: janit Owned by:
Milestone: Priority: normal
Severity: normal Version: 1.5.2
Component: Optimization Keywords: pages cms performance page_rows reporter-feedback
Focuses: Cc:


I ended up using WP as a CMS with quite a lot of pages. I ran into problems with the generation time of wp-admin/edit-pages.php. I digged a bit deeper and found out that the performance can be enhanced by modifying wp-admin/admin-functions.php. The page_rows -function the SQL query could be optimized from

if (!$pages)
    $pages = $wpdb->get_results("SELECT * FROM $wpdb->posts WHERE post_status = 'static' ORDER BY menu_order");


$pages = $wpdb->get_results("SELECT * FROM $wpdb->posts WHERE post_status = 'static' AND post_parent = $parent ORDER BY menu_order");

This improved my generation time from ~8.0 seconds to ~0.4 seconds. I realize that WP is not exactly meant for this, but I think a change this small is worth to do.

Change History (3)

#1 @davidhouse
13 years ago

  • Keywords bg|has-patch added

#2 @jhodgdon
11 years ago

  • Keywords reporter-feedback added; bg|has-patch removed

This is not so easy to fix now. As of SVN version [4984], the page_rows function is no longer doing its own SQL query. It has instead been centralized into a function called get_pages (in wp-includes/posts.php).

So a different patch is needed, if the optimization still needs to be done, perhaps passing different arguments into get_pages?

I am curious if the slowness is still a problem in more current versions or not. ??

Anyway, for now marking as needing more feedback....

#3 @Nazgul
11 years ago

  • Resolution set to wontfix
  • Status changed from new to closed

No real traction for over a year, so closing it as wontfix.

If somebody has suggestions/patches/... to add, feel free to reopen.

Note: See TracTickets for help on using tickets.