nystudio107 / craft-retour

Retour allows you to intelligently redirect legacy URLs, so that you don't lose SEO value when rebuilding & restructuring a website
https://nystudio107.com/plugins/retour
Other
39 stars 26 forks source link

Index on siteId, redirectMatchType #282

Closed tekstrand closed 1 year ago

tekstrand commented 1 year ago

Is your feature request related to a problem? Please describe.

Slow query performance on large data sets

Describe the solution you would like

Create an index in mysql on siteId, redirectMatchType

Describe alternatives you have considered

Reduce data set

Additional context

n/a

khalwat commented 1 year ago

Where exactly are you seeing this slow query on large data sets? Inside the CP when searching/sorting, or on the frontend in some way, when handling redirects?

I ask because there is an index on siteId:

https://github.com/nystudio107/craft-retour/blob/develop/src/migrations/Install.php#L222

https://github.com/nystudio107/craft-retour/blob/develop/src/migrations/Install.php#L245

But there is not one for redirectMatchType which perhaps we could add.

tekstrand commented 1 year ago

We were seeing this on a headless site with both the rest api and gql api. We've since re-architected to reduce the number of queries and store the results in redis at the edge so that we don't have this issue.

khalwat commented 1 year ago

Addressed in: https://github.com/nystudio107/craft-retour/commit/79feefa2099100c372c6454f23bcceaba86df6d7 & https://github.com/nystudio107/craft-retour/commit/db8ae9abe83b4a672681fd54d098b9357323a669

Craft CMS 3:

You can try it now by setting your semver in your composer.json to look like this:

    "nystudio107/craft-retour": "dev-develop as 3.2.11”,

Then do a composer clear-cache && composer update

…..

Craft CMS 4:

You can try it now by setting your semver in your composer.json to look like this:

    "nystudio107/craft-retour": "dev-develop-v4 as 4.1.13”,

Then do a composer clear-cache && composer update

khalwat commented 1 year ago

You'll also want to run:

php craft migrate/all

...to run the pending migration