Title: Slow SQL queries
Last modified: February 22, 2019

---

# Slow SQL queries

 *  [alx359](https://wordpress.org/support/users/alx359/)
 * (@alx359)
 * [7 years, 1 month ago](https://wordpress.org/support/topic/slow-sql-queries-3/)
 * Upon activation of Query Monitor, noticed a couple of slow queries all over the
   back-end coming from this plugin. The fix that worked for me is to limit calls
   of those queries only when using the plugin.
 * `plugins\delete-thumbnails\delete-thumbnails.php` line 16:
 * Change this:
 *     ```
       function dlthumbs() {
       	global $dlthumbs;
       	if (is_admin()) // admin only
       		$dlthumbs = new dlthumbs();
       }
       ```
   
 * To this:
 *     ```
       function dlthumbs() {
       	global $dlthumbs, $pagenow;
       	//ensure slow db calls aren't called everywhere in back-end 
       	if ( is_admin() && $pagenow == 'tools.php' && isset( $_GET['page'] ) && $_GET['page'] == 'dlthumbs' ) {
       		$dlthumbs = new dlthumbs();
       	}
       }
       ```
   

Viewing 1 replies (of 1 total)

 *  Plugin Author [David Sword](https://wordpress.org/support/users/davidsword/)
 * (@davidsword)
 * [7 years, 1 month ago](https://wordpress.org/support/topic/slow-sql-queries-3/#post-11240641)
 * Hello!
 * Thank you very much for finding this and bringing this up with a solution.
 * This plugin was thrown together quickly to do a job. Embarrassingly, this plugin
   is **terribly** out of date and in **major** need of of some attention for security
   and preformance. I would love improve it, and it’s on my list, but I don’t know
   when I’ll have time.
 * Thank you again!

Viewing 1 replies (of 1 total)

The topic ‘Slow SQL queries’ is closed to new replies.

 * ![](https://ps.w.org/delete-thumbnails/assets/icon-256x256.jpg?rev=1685851)
 * [Delete Thumbnails](https://wordpress.org/plugins/delete-thumbnails/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/delete-thumbnails/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/delete-thumbnails/)
 * [Active Topics](https://wordpress.org/support/plugin/delete-thumbnails/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/delete-thumbnails/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/delete-thumbnails/reviews/)

 * 1 reply
 * 2 participants
 * Last reply from: [David Sword](https://wordpress.org/support/users/davidsword/)
 * Last activity: [7 years, 1 month ago](https://wordpress.org/support/topic/slow-sql-queries-3/#post-11240641)
 * Status: not resolved