CoreShop icon indicating copy to clipboard operation
CoreShop copied to clipboard

Slow "object_url_slugs" queries on big project

Open hethehe opened this issue 2 years ago • 1 comments

Q A
Bug report? yes
Feature request? yes
BC Break report? no
RFC? no

Problem: If you have a project with multiple sites (e.g. 4) and multiple languages (e.g. 6), then coreshop generates 30 URL slugs for every product ( (every site + the fallback) * every language). On a project with 5000 products there are 150'000 entries. => The slugs are generated automatically on PRE_UPDATE and PRE_ADD

When you open a product in the backend, the URL slugs are queried: SELECT * FROM object_url_slugs WHERE fieldname = 'slug' AND ownertype = 'localizedfield' AND position = 'de' AND objectId = '1234' This query slows down with every new site, language, product.

Possible Solutions:

  • Add an index for fieldname, ownertype, position and objectId
  • Just add URL slugs for sites defined in the store section of coreshop
  • Add an option "do not create slugs automatically for each site - use fallback for each site that does not have its own URL slug
  • any more ideas?

hethehe avatar Jun 21 '22 08:06 hethehe

The slug field comes from Pimcore directly, so performance issues need to be reported there: https://github.com/pimcore/pimcore.

Regarding slugs only for valid sites: absolutely, would you create a PR for that?

dpfaffenbauer avatar Jun 21 '22 09:06 dpfaffenbauer