deliciousbrains / wp-amazon-s3-and-cloudfront

Automatically copies media uploads to Amazon S3 for delivery. Optionally configure Amazon CloudFront for even faster delivery.
https://wordpress.org/plugins/amazon-s3-and-cloudfront/
309 stars 149 forks source link

Bug: SQL Query takes too much time to return the response and it is affecting site performance #651

Open umangsuthar opened 2 hours ago

umangsuthar commented 2 hours ago

Describe the bug This query is being called when homepage is loaded for our website. It is taking too much time and that is affecting the site performance significantly. Currently our site is taking around 10 seconds to load where almost 90% time taken by the below queries:

SELECT *
FROM wp_as3cf_items
WHERE (path LIKE '%wp-content/uploads/2024/10/11105620/cropped-cropped-logo-black.svg_.png'
OR original_path LIKE '%wp-content/uploads/2024/10/11105620/cropped-cropped-logo-black.svg_.png');
Screenshot 2024-11-06 at 12 02 16 PM

Please check above image for reference. This query is called for all the images which are at our home page.

To Reproduce Steps to reproduce the behavior:

  1. Go to 'https://fxis.ai/edu'
  2. Click on 'Home Page'
  3. Scroll down to '....'
  4. See error

Expected behavior Ideally query should not take this much time to return the response data.

Screenshots If applicable, add screenshots to help explain your problem.

Screenshot 2024-11-06 at 12 03 42 PM

debug.log Capturing errors to debug.log and attaching to this issue will help immensely!

https://deliciousbrains.com/why-use-wp-debug-log-wordpress-development/

Diagnostic Info (from plugin's "Support" tab): Attach file to issue (preferred) or paste here.

Additional context Add any other context about the problem here.

umangsuthar commented 2 hours ago

We found this LINK where other developer updated the query which improves the performance of the site significantly: https://wordpress.org/support/topic/offload-media-adds-6-seconds-of-mysql-queries/

Screenshot 2024-11-06 at 12 05 19 PM