WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Possible Duplicate:
wordpress query causing load

In the site I'm trying to optimize, I noticed several queries that are rather slow and start with SELECT SQL_CALC_FOUND_ROWS

Searching this site, the relevant question wordpress query causing load has no adequate answer, in my opinion.

Can I somehow disable SQL_CALC_FOUND_ROWS without breaking too many things - if possible breaking nothing? It seems that pagination relies on this.

@Wyck advised me to read this core ticket: #10964. After reading it, I can't really understand if the ticket been completely resolved, it seems not.

In any case, is there a way to disable SQL_CALC_FOUND_ROWS?

share|improve this question

marked as duplicate by Rarst Nov 3 '12 at 11:43

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

up vote 5 down vote accepted

First should only disable SQL_CALC_FOUND_ROWS if you aren't using pagination, to do so set parameter no_found_rows to true in WP_Query.

WP_Query( array( 'no_found_rows' => true ) );

Note get_posts() does that by default.

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.