views:

46

answers:

2

I have a wordpress website up and running that is reasonably popular but over the last couple of days my performance has degraded terribly.

I have installed Jet Profiler and have been monitoring the MySQL database to see if I can find something wrong and this one query is consistently the worst offender.

SELECT SQL_CALC_FOUND_ROWS  wp_posts.* FROM wp_posts  WHERE 1=1  AND wp_posts.post_type = 'post' AND (wp_posts.post_status = 'publish')  ORDER BY wp_posts.ID ASC LIMIT 0, 1

My first guess would be to remove the SQL_CALC_FOUND_ROWS function and change the * to be specific fields only but I can't find what is calling this query.

How would I find out which php file is calling this?

+1  A: 

There's a good chance that's your front page. I assume you've installed caching in front of WordPress, either using WP Super Cache or something else (nginx, Squid, etc). If not, you shouldn't be looking at the database. Caching is critical for WP.

scompt.com
I am using WP Super Cache and am now swapping that for W3 Total Cache but I am still getting the same problems with instabilityThe site can be found here if it helps www.lazygamer.co.za
Gavin Mannion
I got back a 406 response code when I access that page a couple times. That might be preventing your page from being cached. Your page should be returning a 200 response code when everything goes right.
scompt.com
That would explain the behaviour I am seeing. What tool did you use to check the response codes?
Gavin Mannion
`curl -D - -o /dev/null http://www.lazygamer.co.za` will show just the headers returned from the request
scompt.com
+1  A: 

You might want to take a look at these two issues posted on their tracker:

http://core.trac.wordpress.org/ticket/10469

http://core.trac.wordpress.org/ticket/12557

(Update: Added a link)

sirhc
Thanks I did see this but all they seem to be saying is that this is wrong but they aren't fixing it yet. I am trying to find this specific query from somewhere to fix it or optimise it
Gavin Mannion