Title: SQL_CALC_FOUND_ROWS in query
Last modified: August 5, 2023

---

# SQL_CALC_FOUND_ROWS in query

 *  Resolved [donbowman](https://wordpress.org/support/users/donbowman/)
 * (@donbowman)
 * [2 years, 10 months ago](https://wordpress.org/support/topic/sql_calc_found_rows-in-query/)
 * it appears this plugin uses SQL_CALC_FOUND_ROWS.
 * This has 2 negative effects for me:
    1. when used w/ mysql it slows things down a lot
    2. when used with TIDB, it is not implemented and fills the logs with errors.
 *     ```wp-block-code
       SELECT SQL_CALC_FOUND_ROWS  wp_posts.ID
       FROM wp_posts  INNER JOIN wp_postmeta ON ( wp_posts.ID = wp_postmeta.post_id )  INNER JOIN wp_postmeta AS mt1 ON ( wp_posts.ID = mt1.post_id )  INNER JOIN wp_postmeta AS mt2 ON ( wp_posts.ID = mt2.post_id )
       WHERE 1=1  AND (
       ( wp_postmeta.meta_key = '_nab_experiment_type' AND wp_postmeta.meta_value = 'nab/heatmap' )
       ...
       ```
   
 * It would improve the perf if it would remove this (I think by adding no_found_rows
   to the query_vars).

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

 *  Plugin Author [Antonio Villegas](https://wordpress.org/support/users/avillegasn/)
 * (@avillegasn)
 * [2 years, 10 months ago](https://wordpress.org/support/topic/sql_calc_found_rows-in-query/#post-16951700)
 * Hi [@donbowman](https://wordpress.org/support/users/donbowman/),
 * I couldn’t find any references to SQL_CALC_FOUND_ROWS in the source code of the
   plugin. It may be the case that we use a WordPress function that internally uses
   that? Do you have more information about where we are supposed to use it?
 * Thanks!
 *  Thread Starter [donbowman](https://wordpress.org/support/users/donbowman/)
 * (@donbowman)
 * [2 years, 10 months ago](https://wordpress.org/support/topic/sql_calc_found_rows-in-query/#post-16953565)
 * Hi Antonio.
 * Many aspects of wordpress have been working to remove this call. from core to
   plugins. it is added automatically by the framework if found rows is enabled.
 * usually the fix is:
 *     ```wp-block-code
       $wp_query->query_vars['no_found_rows'] = 1;
       ```
   
 *  Plugin Author [Antonio Villegas](https://wordpress.org/support/users/avillegasn/)
 * (@avillegasn)
 * [2 years, 10 months ago](https://wordpress.org/support/topic/sql_calc_found_rows-in-query/#post-16954924)
 * Ok. We will apply the fix in the next release.
 *  Plugin Author [David Aguilera](https://wordpress.org/support/users/davilera/)
 * (@davilera)
 * [2 years, 9 months ago](https://wordpress.org/support/topic/sql_calc_found_rows-in-query/#post-16995452)
 * Thanks for the heads up, [@donbowman](https://wordpress.org/support/users/donbowman/).
   We’ve applied the fix in Nelio A/B Testing’s upcoming release: 6.0.0. Stay tuned
   for the update!

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

The topic ‘SQL_CALC_FOUND_ROWS in query’ is closed to new replies.

 * ![](https://ps.w.org/nelio-ab-testing/assets/icon-256x256.png?rev=2514600)
 * [Nelio A/B Testing – AB Tests and Heatmaps for Better Conversion Optimization](https://wordpress.org/plugins/nelio-ab-testing/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/nelio-ab-testing/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/nelio-ab-testing/)
 * [Active Topics](https://wordpress.org/support/plugin/nelio-ab-testing/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/nelio-ab-testing/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/nelio-ab-testing/reviews/)

 * 4 replies
 * 3 participants
 * Last reply from: [David Aguilera](https://wordpress.org/support/users/davilera/)
 * Last activity: [2 years, 9 months ago](https://wordpress.org/support/topic/sql_calc_found_rows-in-query/#post-16995452)
 * Status: resolved