[wp-hackers] Re: [ slow queries in 1.2

Ryan Boren ryan at boren.nu
Thu Nov 18 18:48:27 UTC 2004


On Thu, 2004-11-18 at 19:18 +0100, John Sinteur wrote:
> All-right  - I've figured it out. It's simply a request for:
> 
>   /index.php?cat=1
> 
> where category 1 has a lot of posts.

That query is made when updating the post caches.  It is creating a
category cache keyed by post id.  In 1.3 this lives in
update_post_caches() in functions.php.

> I would like to suggest a new option in the admin-pages where the blog  
> owner can set a limit on the number of posts returned when somebody  
> wants all posts in a category. That way wordpress will never try to  
> build a page with thousands of entries on it.
> 
> Is it okay if I write this and submit a diff on version 1.2?

In 1.3, paging is turned on everywhere, so huge post id lists like this
will only happen if paging is explicitly turned off or posts per page is
set to an obscene number.

Beyond that, we should fix the query.  For huge $posts arrays we could
skip the post_id_list stuff and just pull every post.  Would that be
faster?  Is their a more elegant query we could use?  

Ryan





More information about the hackers mailing list