Title: Plugin generates 70  sql queries
Last modified: August 30, 2016

---

# Plugin generates 70 sql queries

 *  Resolved [webvitaly](https://wordpress.org/support/users/webvitaly/)
 * (@webvitaly)
 * [10 years, 8 months ago](https://wordpress.org/support/topic/plugin-generates-70-sql-queries/)
 * Plugin generates 70+ sql queries on every page.
 * There are about 20 sql queries on average page if plugin is deactivated.
 * Are you planning to fix this issue?
 * I used this [lite plugin to show debug info](https://wordpress.org/plugins/info/).
 * [https://wordpress.org/plugins/easy-fancybox/](https://wordpress.org/plugins/easy-fancybox/)

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

 *  [Rolf Allard van Hagen](https://wordpress.org/support/users/ravanh/)
 * (@ravanh)
 * [10 years, 6 months ago](https://wordpress.org/support/topic/plugin-generates-70-sql-queries/#post-6525438)
 * Hi webvitality, I suspect that info plugin mistakes any get_option() for an SQL
   query. This is not true as default options get loaded from the database in one
   big query by WordPress. Read more on [http://wordpress.stackexchange.com/questions/27717/are-all-options-loaded-to-memory-on-each-request](http://wordpress.stackexchange.com/questions/27717/are-all-options-loaded-to-memory-on-each-request)
   for example. Easy FancyBox does not do any database queries on its own…
 * There is one possible exception: if you installed Easy FancyBox but have not 
   changed or even saved the default options on Settigns > Media yet. In that case,
   there are no database options set (yet) while the active plugin tries to load
   them. This will cause WordPress to double-check the database for these options
   and that will show as these extra queries.
 * A quick fix is to go to Settings > Media and even if you’re happy with the default
   settings, hit the Save button.
 * That said, I am planning on merging all (or many of) these options into one options
   array. This will look cleaner in the database and only cause a small amount of
   extra queries when options are not saved yet.
 * Hope that explanation helps 🙂
 *  Thread Starter [webvitaly](https://wordpress.org/support/users/webvitaly/)
 * (@webvitaly)
 * [10 years, 6 months ago](https://wordpress.org/support/topic/plugin-generates-70-sql-queries/#post-6525441)
 * Thank you for the detailed reply.
    Hitting “Save” button on Media settings page
   helped to decrease the number of SQL queries by 50+.
 * P.S. [Info plugin](https://wordpress.org/plugins/info/) uses WordPress core [get_num_queries()](https://developer.wordpress.org/reference/functions/get_num_queries/#source-code)
   function to output the number of queries. And this function is using `$wpdb->
   num_queries` variable which is WordPress core queries counter.

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

The topic ‘Plugin generates 70 sql queries’ is closed to new replies.

 * ![](https://ps.w.org/easy-fancybox/assets/icon-256x256.png?rev=3188201)
 * [Firelight Lightbox](https://wordpress.org/plugins/easy-fancybox/)
 * [Support Threads](https://wordpress.org/support/plugin/easy-fancybox/)
 * [Active Topics](https://wordpress.org/support/plugin/easy-fancybox/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/easy-fancybox/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/easy-fancybox/reviews/)

## Tags

 * [performance](https://wordpress.org/support/topic-tag/performance/)
 * [sql](https://wordpress.org/support/topic-tag/sql/)

 * 2 replies
 * 2 participants
 * Last reply from: [webvitaly](https://wordpress.org/support/users/webvitaly/)
 * Last activity: [10 years, 6 months ago](https://wordpress.org/support/topic/plugin-generates-70-sql-queries/#post-6525441)
 * Status: resolved