Opened 16 years ago
Closed 11 years ago
#8874 closed enhancement (maybelater)
wp_list_pages consume a lot of memory
Reported by: | horaciod | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 2.7 |
Component: | Query | Keywords: | needs-patch |
Focuses: | performance | Cc: |
Description
When we use wp_list_pages in installatiosn with lots of pages (in my case 106 with a lot of text inside ) this function use get_pages (posts.php) which has a get_results of the posts completes with a "select *" but only id,post_title, post_parent is needed.
Maybe you can use a nuew option to wp_list_pages or get_pages with the list of fields to retrieve.
I´m making a patch but first i´m studing the code rules of wordpress.
This Affects a wpdtree plugin and other which use get_pages. In my case this select break the connection with mysql in a Shared web server.
Attachments (4)
Change History (19)
#2
in reply to:
↑ 1
@
16 years ago
Replying to mrmist:
I'm pretty sure that there's already a ticket floating around with a patch for wp_list_pages. Can't find it just now. I agree with the sentiment though.
i've made a search too but nothing found.
#3
@
16 years ago
- Keywords needs-patch added
- Milestone changed from 2.7.1 to 2.8
- Version set to 2.7
Yep. Must have been another query.
needs a patch so I doubt it will make 2.7.1
#5
@
16 years ago
- Milestone Future Release deleted
- Resolution set to duplicate
- Status changed from new to closed
dup of #8492
#6
@
16 years ago
- Milestone set to Future Release
- Resolution duplicate deleted
- Status changed from closed to reopened
re-opening as it's actually a different bug. the two are related though.
#7
@
16 years ago
- Keywords has-patch added; needs-patch removed
- Milestone changed from Future Release to 2.8
patch added, should to the job. set the fields - argument to 'ID, post_title, post_parent'
. did work like a charm for me.
cache only works on default '*' set of fields. it can make sense to use the $fields parameters content as part of the cache key and enable caching for certain type of queries as well.
addtionally the docblock has been extended to have a description of all parameters. all but author.
#8
@
16 years ago
- Keywords dev-feedback added
I *think* that this:
wp_cache_set( 'get_pages', $cache, 'posts' );
... is needed.
what is missing and may not necessarily be needed is:
update_post_cache($pages);
that being said, adding such a call will tremendously speed things up when generating permalinks, since it saves one query per missed cache hit.
maybe there is a need for an extra cache group, for use by permalinks.
#9
@
16 years ago
- Keywords needs-patch added; has-patch removed
patch is broken again. dev feedback would be useful, too...
#10
@
16 years ago
- Component changed from Optimization to Template
- Milestone changed from 2.8 to Future Release
moving to future, as there are a couple of related bugs on wp_list_pages being slow.
#14
@
11 years ago
- Milestone changed from Future Release to 4.0
for 500 pages with 20 paragraphs of post_content
each, it consumes 2MB for *
and 300KB for ID, post_title, post_parent
Since get_pages()
uses direct SQL, we can accomplish this without #19866. Officially a fan.
#15
@
11 years ago
- Milestone 4.0 deleted
- Resolution set to maybelater
- Status changed from reopened to closed
Actually no, scratch that. This would require a bunch of gymnastics to avoid caching the fragmented results. Not a big enough performance gain to warrant it. Would also require passing fields
down to other functions like get_page_children()
. I can see why no one has refreshed this patch in 5 years.
I'm pretty sure that there's already a ticket floating around with a patch for wp_list_pages. Can't find it just now. I agree with the sentiment though.