View Categories

Why does ShortPixel make a lot of MySQL queries? Should I worry?

The short answer is:
NO! 🙂

When you’re using a WordPress plugin like
Query Monitor you may notice many queries made by ShortPixel

While the number of queries may seem a lot, this shouldn’t worry you and here’s why:

  • Unless you explicitly choose to have the image optimization triggered on the front-end as well, the queries are only run when visiting the /wp-admin page with a user role that allows image optimization.
  • The queries are run only on certain pages that are related to images or on ShortPixel’s settings.
  • The queries are highly optimized and sometimes there are many of them, since fewer queries would otherwise mean a greater load on the database and server memory.
  • Most of the queries are executed either when the bulk optimization is running or when some new images are added and the image optimization process is automatically triggered.

ShortPixel Image Optimizer needs to make several database queries in order to find which images need optimization. Basically, the plugin checks your WordPress metadata, pulls out the image information and sends the data to our Image Optimization API. If your website has tens of thousands or more images then many queries will be executed in order for ShortPixel to know how many images are to be optimized on your website.

Note: If you have an old website and your database tables are using MyISAM (which can cause some performance issues), you should convert the tables to InnoDB.