For an example of a 2.05 blog: http://www.wealthyreader.com. It has 10 queries to bring back the main page. I realize it is a less populated blog but this demonstrates the type of performance we used to see on http://www.slipperybrick.com before we upgraded to 2.07 and then to 2.10.
I’m running 2.1 with the NewsPortal theme, and my front page returns <!-- 34 queries. 0.672 seconds. --> for me.
I’d say that it’s not specific to 2.1 or 2.0.7, but more specific to whatever it is that you happen to be doing.
Thanks for the reply Otto42. Can you tell me how many categories you have?
I’ve noticed that wordpress does one seperate select statement for each category and I’m trying to figure out why.
I found my blog reduced no.Of qurry execute new version help me lot .Btw try disable related post plugin n check
That’s odd. I have 19(?) categories, and some code that displays recent posts on the home page — and “only” 46 queries (which is better than 175+).
OTOH, graywolf is displaying a number of in-post images on the home page, while I have one (currently); I also have no ads, references to Flickr or really much of anything else. Could it be these items that are causing the large number of queries?
Thanks for the reply Otto42. Can you tell me how many categories you have?
I’ve noticed that wordpress does one seperate select statement for each category and I’m trying to figure out why.
That would make sense, my categories are very limited, whereas you have a whole lot more.
What are these separate select statements that you see it doing? It might help to track down what’s going on.
Well, I been checking the mysql general log file and it appears most of the queries are either for options or for the categories. We have close to 200 categories and for some reason almost every category gets queried by id:
SELECT * FROM wp_categories WHERE cat_ID = ‘125’ LIMIT 1
And we’ll see hundreds of these on each page request.
I’ve tried turning off all the plugins and that doesn’t seem to help. As mentioned previously, I’ve switched themes and it the problem got worse, not better.
I’m still trying to figure out why WP needs to grab all the fields for each category.
I think I’ve tracked down where the query is coming from.
In wp-includes\category.php Line 150:
$_category = $wpdb->get_row("SELECT * FROM $wpdb->categories WHERE cat_ID = '$category' LIMIT 1");
Wrapped around this code is a call to check and see if it is in the cache. If it is, get it from cache, it it is not, get it from the database. However it appears it never finds it in the cache.
I have the enable cache line in my wp-config.php file:
define('ENABLE_CACHE', true);
so that should be ok.
It appears if the cache worked correctly then this wouldn’t be a problem.
Anybody knows if there is a problem with the caching or if there is something special you need to do in order to get the cache to work?
I think I found the answer to this:
Remove this line from you wp-config.php file if you have it:
define('ENABLE_CACHE', true);
This was a legacy setting left over from a previous version. We are happily back to 25 queries to generate a page.
Hopefully someone can learn from my mistake.
Interesting. I can’t quite see why that would work, but hey, you can’t argue with results. 🙂
I agree, Otto42. I guess it’s one of those things that leaves us all amazed and delighted. LOL