Opened 21 years ago
Closed 19 years ago
#1907 closed defect (bug) (wontfix)
page_rows -function inefficient?
| Reported by: | janit | Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | |
| Component: | Optimization | Version: | 1.5.2 |
| Severity: | normal | Keywords: | pages cms performance page_rows reporter-feedback |
| Cc: | Focuses: |
Description
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");
to
$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)
Note:
See TracTickets
for help on using tickets.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
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....