[wp-hackers] WP_Rewrite: Disable post/Page paging ability?

Otto otto at ottodestruct.com
Wed Jul 30 14:12:43 GMT 2008

get_page_by_path makes a call to get all the pages matching a post
name. In the case of http://asdfsa345.pastebin.com/m4c8095f3, that is
query number 9:
SELECT ID, post_name, post_parent FROM wp_posts WHERE post_name = '8'
AND (post_type = 'page' OR post_type = 'attachment')

It then loops through all the found page parents to build the page
path, one at a time. Then it tries to match that path with the actual
path it's looking for. When it finds a match, it stops and gets that

You're getting all these queries because you have, by my quick count,
at least seven pages with a post_name of "8", before it finds the one
it's looking for.

On Tue, Jul 29, 2008 at 8:20 PM, Viper007Bond <viper at viper007bond.com> wrote:
> Found a bad side effect -- it's nearly doubling my queries on those Pages.
> Query dump: http://asdfsa345.pastebin.com/m4c8095f3
> Seems get_page_by_path() is being called a couple dozen times. Why I have no
> clue...
> For example: SELECT ID, post_name, post_parent FROM wp_posts WHERE ID = 46
> and post_type='page'
> Some example URL structures incase it helps:
> http://site.com/mypage/8/
> http://site.com/mypage/8/1/
> http://site.com/mypage/8/8/
> http://site.com/mypage/1/8/
> http://site.com/mypage/5/
> http://site.com/mypage/5/8/
> http://site.com/mypage/5/6/
> etc.
> Any ideas what's wrong and what I can do to cut it down? It's the end of the
> world as I Super Cache, but I'd still like to figure out what's going on
> behind the scenes. :)
> --
> Viper007Bond | http://www.viper007bond.com/ | http://www.finalgear.com/
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers

More information about the wp-hackers mailing list