Title: Slow query &#8211; SQL Calc rows found
Last modified: August 30, 2016

---

# Slow query – SQL Calc rows found

 *  [M4rk0444](https://wordpress.org/support/users/m4rk0444/)
 * (@m4rk0444)
 * [10 years, 8 months ago](https://wordpress.org/support/topic/slow-query-sql-calc-rows-found/)
 * Hi!
 * I have a problem with slow queries on my site. I noticed high time to first byte
   on my server. I contacted my host and they told me that this query takes up to
   3 seconds. This is the query:
 * SELECT SQL_CALC_FOUND_ROWS X5i3v_posts.ID FROM X5i3v_posts WHERE 1=1 AND X5i3v_posts.
   post_type = ‘ad_listing’ AND (X5i3v_posts.post_status = ‘publish’ OR X5i3v_posts.
   post_status = ‘tr_pending’ OR X5i3v_posts.post_status = ‘tr_failed’ OR X5i3v_posts.
   post_status = ‘tr_completed’ OR X5i3v_posts.post_status = ‘tr_activated’) ORDER
   BY RAND() LIMIT 0, 10
 * I have a loooot of posts. Now I know that SQL Calc Found Rows takes more time
   the bigger the database gets. Is there any way to disable or workaround this 
   query?
 * I found a lot of old posts which doesn’t really help with the new wordpress and
   the files don’t refer to the latest wordpress files.
 * Please help me with this.
 * Warm greetings
 * Julia

Viewing 6 replies - 1 through 6 (of 6 total)

 *  Moderator [keesiemeijer](https://wordpress.org/support/users/keesiemeijer/)
 * (@keesiemeijer)
 * [10 years, 8 months ago](https://wordpress.org/support/topic/slow-query-sql-calc-rows-found/#post-6417569)
 * Hi M4rk0444
 * On what page do you have this query?
 * I think the query is used to find the maximum posts amount for pagination.
    Do
   you need pagination on that page?
 *  Thread Starter [M4rk0444](https://wordpress.org/support/users/m4rk0444/)
 * (@m4rk0444)
 * [10 years, 8 months ago](https://wordpress.org/support/topic/slow-query-sql-calc-rows-found/#post-6417574)
 * Hi keesiemeijer!
 * Thank you for your answer! You can see it here on: [http://www.firmenvorstellung.com](http://www.firmenvorstellung.com)
 * It is using the query already on the home page.
    If you enter the site you will
   notice the long time to first byte. The page rendering is fast.
 * How can I work around this query?
 *  Moderator [keesiemeijer](https://wordpress.org/support/users/keesiemeijer/)
 * (@keesiemeijer)
 * [10 years, 8 months ago](https://wordpress.org/support/topic/slow-query-sql-calc-rows-found/#post-6417584)
 * Alas, there is not much I can do to help as this is a commercial theme, and I
   would have to guess in what file and how the query is made.
 * Contact your theme support for this issue.
 * This could be a possible solution.
    [http://wordpress.stackexchange.com/questions/71381/how-to-disable-sql-calc-found-rows](http://wordpress.stackexchange.com/questions/71381/how-to-disable-sql-calc-found-rows)
 *  Thread Starter [M4rk0444](https://wordpress.org/support/users/m4rk0444/)
 * (@m4rk0444)
 * [10 years, 8 months ago](https://wordpress.org/support/topic/slow-query-sql-calc-rows-found/#post-6417585)
 * Thank you for your answer. So you guess it is a theme specific problem?
    If you
   want I could provide you a test account information to take a look at it.
 * Thank you for your help.
    Julia
 *  Moderator [keesiemeijer](https://wordpress.org/support/users/keesiemeijer/)
 * (@keesiemeijer)
 * [10 years, 8 months ago](https://wordpress.org/support/topic/slow-query-sql-calc-rows-found/#post-6417606)
 * I’m sorry but that’s not allowed here.
 * I could potentially be liable for any potential damage that could be caused by
   me or by anyone else accessing the system after me.
 *  Moderator [keesiemeijer](https://wordpress.org/support/users/keesiemeijer/)
 * (@keesiemeijer)
 * [10 years, 8 months ago](https://wordpress.org/support/topic/slow-query-sql-calc-rows-found/#post-6417608)
 * To answer one of your other questions.
 * > So you guess it is a theme specific problem?
 * Try de-activating all plugins to see if the query is gone.

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘Slow query – SQL Calc rows found’ is closed to new replies.

## Tags

 * [database](https://wordpress.org/support/topic-tag/database/)
 * [MySQL](https://wordpress.org/support/topic-tag/mysql/)
 * [query](https://wordpress.org/support/topic-tag/query/)
 * [slow query](https://wordpress.org/support/topic-tag/slow-query/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 6 replies
 * 2 participants
 * Last reply from: [keesiemeijer](https://wordpress.org/support/users/keesiemeijer/)
 * Last activity: [10 years, 8 months ago](https://wordpress.org/support/topic/slow-query-sql-calc-rows-found/#post-6417608)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
