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/
304 stars 148 forks source link

fix-prevention-of-mysql-to-use-the-index #649

Closed stremehard closed 2 weeks ago

stremehard commented 2 weeks ago

You are using % at the front of the like, this prevents mysql from using an index. It has to go through 20k records every single time. (and there are a lot of those requests)

Simple fix is to remove the % and replace it with app/

Also you can use = instead of LIKE.

Notes: We use that plugin in one of our websites, and we increased the speed of requests by 50 times at least.

ianmjones commented 2 weeks ago

Hey @stremehard, unfortunately we do not accept PRs for this repo.

Also, your change would not work for a number of reasons, the most obvious being that most people do not use app/ as their bucket path prefix, but also, the LIKE is absolutely required if you look at where it is being used.

Thanks for your interest though.