[wp-hackers] wp_options updates taking too long for page_uris and rewrite_rules

Paul Menard codehooligans at codehooligans.com
Thu Aug 24 02:58:19 GMT 2006


Great. thanks for the suggestion. I'm trying that now.

Paul


On Aug 23, 2006, at 6:36 PM, Ryan Boren wrote:

> Paul Menard wrote:
>> Since Sunday Anytime someone goes in to edit/add and Event the  
>> database locks up. This is a private hosted server with no other  
>> traffic. The solution I've found that brings the site back is to  
>> remove the 'page_uris' and rewrite_rules' records from the  
>> wp_options table. Then let WP rebuild these. I've had to finally  
>> keep people off the system otherwise it crashes hourly.
>
> If it runs faster if those options are deleted first, then the  
> culprit is likely the comparison check to see if the old value of  
> page_uris is equal to the new value.  This is done to avoid an  
> unnecessary DB update.  In this case, however, comparing two huge  
> arrays for equality is much more expensive than just sending the  
> update.  Try fixing it like this:
>
> Look for the function named generate_page_rewrite_rules() in the wp- 
> includes/functions-post.php file.
>
> Within that function, look for this line:
>
> update_option('page_uris', $page_rewrite_rules);
>
> Right before that line, add this line:
>
> delete_option('page_uris');
>
> It should then look like this:
>
> delete_option('page_uris');
> update_option('page_uris', $page_rewrite_rules);
>
> Try that out and let us know how it goes.
>
> Ryan
> _______________________________________________
> 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