Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[14.0][IMP] Query performance for shop route in website_sale_filter_p… #858

Conversation

FrancescoBallerini
Copy link

@FrancescoBallerini FrancescoBallerini commented Oct 17, 2023

…roduct_brand

Fixes #792 in v14.0

Additional context

Time difference between queries in our environments before and after commit
It's quite a big boost, I hope I am not missing something.

BEFORE COMMIT (using mapped)
INFO t1 odoo.addons.website_sale_filter_product_brand.controllers.website_sale: Time Perf Counter: 4.394335448043421

AFTER COMMIT (using search domain)
INFO t1 odoo.addons.website_sale_filter_product_brand.controllers.website_sale: Time Perf Counter: 0.10209001100156456

@FrancescoBallerini FrancescoBallerini force-pushed the 14.0-filter_product_brand_optimize_shop_loading_time branch 2 times, most recently from c0ab4dd to 55c6f79 Compare October 17, 2023 19:38
Copy link

There hasn't been any activity on this pull request in the past 4 months, so it has been marked as stale and it will be closed automatically if no further activity occurs in the next 30 days.
If you want this PR to never become stale, please ask a PSC member to apply the "no stale" label.

@github-actions github-actions bot added the stale PR/Issue without recent activity, it'll be soon closed automatically. label Feb 25, 2024
Copy link
Member

@chienandalu chienandalu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@FrancescoBallerini FrancescoBallerini force-pushed the 14.0-filter_product_brand_optimize_shop_loading_time branch from 3411fc4 to 55c6f79 Compare February 26, 2024 20:29
…roduct_brand

Qweb key `attr_valid` stores a list of product ids, which is exposed
to qContext

- Before this commit:

  Product ids list for `attr_valid` is built with ORM `mapped()`,
  which is very slow if you have a lot of products and attributes for
  products.

  (Tested with 15'000 products and around 500 values for different
  attributes)

  Depending on hardware, this might cause some annoying delay before
  the "/shop" route is loaded, as this single query might take several
  seconds to be executed in such situations.

- After this commit:

  Product ids list for `attr_valid` is now built with a search domain
  on `product.attribute.value` model: this will improve loading time
  by a lot (about x35 times faster) for "/shop" route compared to
  ORM `mapped()` execution time.
@FrancescoBallerini FrancescoBallerini force-pushed the 14.0-filter_product_brand_optimize_shop_loading_time branch from 55c6f79 to 55657a2 Compare February 26, 2024 20:41
@FrancescoBallerini
Copy link
Author

@chienandalu Thanks for the approval !

Copy link

@andreampiovesana andreampiovesana left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@OCA-git-bot
Copy link
Contributor

This PR has the approved label and has been created more than 5 days ago. It should therefore be ready to merge by a maintainer (or a PSC member if the concerned addon has no declared maintainer). 🤖

@pedrobaeza pedrobaeza added this to the 14.0 milestone Feb 28, 2024
@pedrobaeza
Copy link
Member

/ocabot merge patch

@OCA-git-bot
Copy link
Contributor

Hey, thanks for contributing! Proceeding to merge this for you.
Prepared branch 14.0-ocabot-merge-pr-858-by-pedrobaeza-bump-patch, awaiting test results.

@OCA-git-bot OCA-git-bot merged commit f10a093 into OCA:14.0 Feb 29, 2024
7 checks passed
@OCA-git-bot
Copy link
Contributor

Congratulations, your PR was merged at bad0d8b. Thanks a lot for contributing to OCA. ❤️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved merged 🎉 ready to merge stale PR/Issue without recent activity, it'll be soon closed automatically.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

'website_sale_filter_product_brand' slow /shop loading time
5 participants