Query causing load because of SQL_CALC_FOUND_ROWS post counting?

I found this query causing some load in the server, my hosting provdier asked me to look on it.

SELECT SQL_CALC_FOUND_ROWS  wp_posts 

I think this select no. rows found in wp_posts table.. but i tried to this query in separate page, it takes so long to complete the request.Can somebody help me to overcome from this issue?

Read More

Thanks!

Related posts

Leave a Reply

1 comment

  1. WordPress uses this feature of MySQL to get a total count of posts when you are only retrieving limited amount (100 posts total, but only 10 posts per page).

    From quick look at source there is no_found_rows query argument that can disable it. That will wreck pagination and should only be used with specific queries that don’t need counting (for example get_posts() uses it by default).

    You probably need to look into performance of your database overall (if you are running something crazy large) or if there are issues with configuration (if you are running something small enough to not possibly cause issues with resources).