Title: Plugin causing lots of slow queries on heavy site due to wild cards
Last modified: August 26, 2025

---

# Plugin causing lots of slow queries on heavy site due to wild cards

 *  [sushantchawla2005](https://wordpress.org/support/users/sushantchawla2005/)
 * (@sushantchawla2005)
 * [7 months, 2 weeks ago](https://wordpress.org/support/topic/plugin-causing-lots-of-slow-queries-on-heavy-site-due-to-wild-cards/)
 * Hi,
 * We are using your plugin on our wordpress site to offload the static assets to
   our AWS S3 buckets as our it is very heavy ecommerce site but the plugin has 
   started causing lots of resource usage through MariaDB where we have observed
   the slow queries like the following and keeping the server busy whole day:
 * `Time: 250826 9:46:40 User@Host: XXXXXXXX[XXXXXXXX] @ localhost [] Thread_id:
   1062548 Schema: XXXXXXXX QC_hit: No Query_time: 6.094702 Lock_time: 0.000031 
   Rows_sent: 1 Rows_examined: 2098942 Rows_affected: 0 Bytes_sent: 3063`
 * `SET timestamp=1756201600;
   SELECT * FROM wp_as3cf_items WHERE (path LIKE '%uploads/
   2025/08/CABRH104587-2274851-1.webp' OR original_path LIKE '%uploads/2025/08/CABRH104587-
   2274851-1.webp');
 * Can you provide the fix where it uses relative or absolute path to search for
   the entries in the database table instead of using wildcards please?
 * Regards,
 * Sushant Chawla

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

 *  Thread Starter [sushantchawla2005](https://wordpress.org/support/users/sushantchawla2005/)
 * (@sushantchawla2005)
 * [7 months, 2 weeks ago](https://wordpress.org/support/topic/plugin-causing-lots-of-slow-queries-on-heavy-site-due-to-wild-cards/#post-18616094)
 * Hi,
 * This is urgent, can someone respond to this issue please?
 *  Plugin Support [Delicious Brains Support](https://wordpress.org/support/users/dbisupport/)
 * (@dbisupport)
 * [7 months, 2 weeks ago](https://wordpress.org/support/topic/plugin-causing-lots-of-slow-queries-on-heavy-site-due-to-wild-cards/#post-18616973)
 * Hi [@sushantchawla2005](https://wordpress.org/support/users/sushantchawla2005/),
 * WP Offload Media Support Team here. Thanks for reaching out with your query! 
   We would be happy to assist.
 * At the moment, the plugin uses a query designed to account for different bucket
   configurations. It also includes a built-in caching system, so it doesn’t always
   need to call the database to retrieve a file’s offload URL. In addition, using
   an external object cache can further reduce database load, especially when paired
   with a page caching solution.
 * To help us check if the plugin’s built-in caching is working correctly on your
   site, can you please try editing your wp-config.php file and replace this line–
 * define( ‘WP_DEBUG’, false );
 * With these lines –
 * define(‘WP_DEBUG’, true);
   define(‘WP_DEBUG_LOG’, true);define(‘WP_DEBUG_DISPLAY’,
   false);
 * This means that any errors are logged to /wp-content/debug.log, because some 
   errors are not visible on screen. More details about that at [https://wordpress.org/support/article/editing-wp-config-php/#wp_debug](https://wordpress.org/support/article/editing-wp-config-php/#wp_debug)
 * Can you try the process again and then share the contents of the debug.log file
   in your next response? Feel free to redact any sensitive info.
 * Once we have finished troubleshooting, you should revert that config change and
   delete the debug.log file.
 *  Thread Starter [sushantchawla2005](https://wordpress.org/support/users/sushantchawla2005/)
 * (@sushantchawla2005)
 * [7 months, 2 weeks ago](https://wordpress.org/support/topic/plugin-causing-lots-of-slow-queries-on-heavy-site-due-to-wild-cards/#post-18617180)
 * Hi [@dbisupport](https://wordpress.org/support/users/dbisupport/)
 * As it is a high traffic website and debug.log file is getting really heavy, can
   you provide me with any strings which you’re looking for in debug logs, please?
 * For the record, we are using the following Redis configuration:
 *     ```wp-block-code
       define( 'WP_REDIS_CONFIG', ['token' => "XXXX",'host' => '/var/run/redis/redis.sock','port' => 0,'scheme' => 'unix','database' => "XXXX",'timeout' => 2.5,'read_timeout' => 2.5,'split_alloptions' => true,'async_flush' => true,'client' => 'phpredis','compression' => 'zstd','serializer' => 'igbinary','prefetch' => false,'non_prefetchable_groups' => [ 'as3cf', 'yith_wcbm_badges' ],'debug' => false,'save_commands' => false,'prefix' => DB_NAME,] );define( 'WP_REDIS_DISABLED', false );
       ```
   
 * Additionally, sometimes we don’t prefer to use Redis (object-cache-pro) due to
   conflicts and other reasons. Does that mean this plugin amazon-s3-and-cloudfront-
   pro will cause thousands of slow queries if we stop using Redis?
 * Looking forward to your quick response. Thanks!
    -  This reply was modified 7 months, 2 weeks ago by [sushantchawla2005](https://wordpress.org/support/users/sushantchawla2005/).
 *  Thread Starter [sushantchawla2005](https://wordpress.org/support/users/sushantchawla2005/)
 * (@sushantchawla2005)
 * [7 months, 2 weeks ago](https://wordpress.org/support/topic/plugin-causing-lots-of-slow-queries-on-heavy-site-due-to-wild-cards/#post-18617208)
 * Hi,
 * Please check the comparison of rows examined with and without wildcard
 * **With wild card (1.8 Million rows examined):**
 * `MariaDB [XXXXXX]> EXPLAIN SELECT * FROM wp_as3cf_items WHERE (path LIKE '%uploads/
   2025/07/BVPK000273-2201478-1-300x300.webp' OR original_path LIKE '%uploads/2025/
   07/BVPK000273-2201478-1-300x300.webp');
   +------+-------------+----------------
   +------+---------------+------+---------+------+---------+-------------+| id 
   | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra
   |+------+-------------+----------------+------+---------------+------+---------
   +------+---------+-------------+| 1 | SIMPLE | wp_as3cf_items | ALL | NULL | 
   NULL | NULL | NULL | 1829871 | Using where |+------+-------------+----------------
   +------+---------------+------+---------+------+---------+-------------+1 row
   in set (0.000 sec)
 * **Same Query** **Without wildcard (Only 2 rows examined)**
 * `MariaDB [XXXXXX]> EXPLAIN SELECT * FROM wp_as3cf_items WHERE (path LIKE 'uploads/
   2025/07/BVPK000273-2201478-1-300x300.webp' OR original_path LIKE 'uploads/2025/
   07/BVPK000273-2201478-1-300x300.webp');
   +------+-------------+----------------
   +-------------+------------------------------+------------------------------+---------
   +------+------+-------------------------------------------------------------+
   | id | select_type | table | type | possible_keys | key | key_len | ref | rows
   | Extra |+------+-------------+----------------+-------------+------------------------------
   +------------------------------+---------+------+------+-------------------------------------------------------------
   +| 1 | SIMPLE | wp_as3cf_items | index_merge | uidx_path,uidx_original_path |
   uidx_path,uidx_original_path | 762,762 | NULL | 2 | Using sort_union(uidx_path,
   uidx_original_path); Using where |+------+-------------+----------------+-------------
   +------------------------------+------------------------------+---------+------
   +------+-------------------------------------------------------------+1 row in
   set (0.000 sec)
 * This is a big difference.
 *  Plugin Support [Delicious Brains Support](https://wordpress.org/support/users/dbisupport/)
 * (@dbisupport)
 * [7 months, 1 week ago](https://wordpress.org/support/topic/plugin-causing-lots-of-slow-queries-on-heavy-site-due-to-wild-cards/#post-18623614)
 * Hi [@sushantchawla2005](https://wordpress.org/support/users/sushantchawla2005/),
 * Thanks for sharing your setup. We’re not Redis experts, but one thing that stands
   out is that **as3cf** is listed in your `non_prefetchable_groups`. WP Offload
   Media uses object caching if it detects that your server has one, and this setting
   could be preventing it from caching effectively.
 * Regarding the wildcard query, the plugin uses that type of lookup to account 
   for different bucket configurations. But in normal circumstances, the plugin 
   saves the storage version of the URLs in the `amazonS3_cache` postmeta record,
   and if an external object cache is available those cached values can be served
   even faster. This helps reduce calls to the database every time a page is loaded.
 * More about the `amazonS3_cache` record here: [https://deliciousbrains.com/wp-offload-media/doc/developer-guide/#local-to-provider-data](https://deliciousbrains.com/wp-offload-media/doc/developer-guide/#local-to-provider-data)
 * At this stage, the next step is still to confirm whether the plugin’s own caching
   layer is working as expected. Plugin errors in the debug log should include the
   string **as3cf** or mention **S3**. If your debug.log is very large, you might
   try filtering it for those terms.
 * If you happen to disable Redis, WP Offload Media won’t automatically cause thousands
   of slow queries. That’s why it’s important we check the error logs first.
 *  Thread Starter [sushantchawla2005](https://wordpress.org/support/users/sushantchawla2005/)
 * (@sushantchawla2005)
 * [7 months, 1 week ago](https://wordpress.org/support/topic/plugin-causing-lots-of-slow-queries-on-heavy-site-due-to-wild-cards/#post-18625332)
 * Hi [@dbisupport](https://wordpress.org/support/users/dbisupport/)
 * Thanks for your response. We are not using Redis on the application as it was
   causing some conflicts with plugins, so let’s assume we don’t have Redis available.
 * I believe the plugin uses **amazonS3_cache** as I have seen queries having this
   string regularly but the issue is those queries which doesn’t hit the cache. 
   Our **wp_as3cf_items** table has **2127032** rows so whenever queries like the
   following one triggers, it causes a lot of resource usage and slowness.
 * `MariaDB [XXXXXXXX]> SELECT * FROM wp_as3cf_items WHERE (path LIKE '%uploads/
   2025/07/BVPK000273-2201478-1-300x300.webp' OR original_path LIKE '%uploads/2025/
   07/BVPK000273-2201478-1-300x300.webp');
   Empty set (33.923 sec)
 * `MariaDB [``XXXXXXXX`]> select count(*) from wp_as3cf_items;
   +----------+| count(*)
   |+----------+| 2127032 |+----------+1 row in set (0.508 sec)
 * Due to the wild cards in these queries, it forces database engine to scan through
   2 Million+ rows and use lots of resources.
 * If we use this query, it uses indexes and triggers really quick.
 * `SELECT * FROM wp_as3cf_items WHERE (path LIKE 'uploads/2025/07/BVPK000273-2201478-
   1-300x300.webp' OR original_path LIKE 'uploads/2025/07/BVPK000273-2201478-1-300x300.
   webp');
   Empty set (0.000 sec)
 * Additionally, I have tried to search for the strings **as3cf** or **S3** in debug.
   log but there are no such entries there.
 * I hope this would help you apply the required optimisations to the plugin’s code.
   Looking forward to your response.
 * Regards,
   Sushant Chawla

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

The topic ‘Plugin causing lots of slow queries on heavy site due to wild cards’ 
is closed to new replies.

 * ![](https://ps.w.org/amazon-s3-and-cloudfront/assets/icon-256x256.jpg?rev=1809890)
 * [WP Offload Media Lite for Amazon S3, DigitalOcean Spaces, and Google Cloud Storage](https://wordpress.org/plugins/amazon-s3-and-cloudfront/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/amazon-s3-and-cloudfront/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/amazon-s3-and-cloudfront/)
 * [Active Topics](https://wordpress.org/support/plugin/amazon-s3-and-cloudfront/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/amazon-s3-and-cloudfront/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/amazon-s3-and-cloudfront/reviews/)

 * 6 replies
 * 2 participants
 * Last reply from: [sushantchawla2005](https://wordpress.org/support/users/sushantchawla2005/)
 * Last activity: [7 months, 1 week ago](https://wordpress.org/support/topic/plugin-causing-lots-of-slow-queries-on-heavy-site-due-to-wild-cards/#post-18625332)
 * Status: not resolved