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

[IMP] website_sale: faster recursive e-commerce category search #60834

Conversation

yajo
Copy link
Contributor

@yajo yajo commented Oct 27, 2020

When a website has a big category tree, without this patch it has to make a lot of queries just to build the tree. Now it's way faster because it solves all in 1 query.

For example, in a production database, and after warmup, this reduced the amount of queries from 369 to 229 while browsing a category. That's 140 less queries, a lot. Also, when browsing /shop, it reduced the queries from 326 to 172. The times inside and outside Postgres also improve according to my tests.

Note: this domain could be even more constrained to avoid reading all website categories if they are collapsed, but given faed8d5 is not in v12, it ends up producing lots of more queries (by using child_of or parent_of operators) and slowing more the result than just downloading all of them.

@Tecnativa TT26309

--
I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr

@yajo yajo force-pushed the 12.0-website_sale-faster_recursive_categories branch from e7e85f1 to e16551d Compare October 27, 2020 14:07
@robodoo robodoo added ☑ ci/security CI 🤖 Robodoo has seen passing statuses and removed ☐ ci/security labels Oct 27, 2020
@pedrobaeza
Copy link
Collaborator

@JKE-be what do you think about this?

When a website has a big category tree, without this patch it has to make a lot of queries just to build the tree. Now it's way faster because it solves all in 1 query.

For example, in a production database, and after warmup, this reduced the amount of queries from 369 to 229 while browsing a category. That's 140 less queries, a lot. Also, when browsing `/shop`, it reduced the queries from 326 to 172. The times inside and outside Postgres also improve according to my tests.

Note: this domain could be even more constrained to avoid reading all website categories if they are collapsed, but given odoo#34249 is not in v12, it ends up producing lots of more queries (by using `child_of` or `parent_of` operators) and slowing more the result than just downloading all of them.

@Tecnativa TT26309
@yajo yajo force-pushed the 12.0-website_sale-faster_recursive_categories branch from e16551d to ec08a9c Compare November 3, 2020 09:16
@robodoo robodoo added ☐ ci/runbot and removed CI 🤖 Robodoo has seen passing statuses ☑ ci/runbot labels Nov 3, 2020
@robodoo robodoo added ☐ ci/style CI 🤖 Robodoo has seen passing statuses and removed ☐ ci/security labels Nov 3, 2020
@rdeodoo
Copy link
Contributor

rdeodoo commented Nov 6, 2020

Didn't check the PR yet but for informative purpose, this was improved in later version with 5f87def

@JKE-be
Copy link
Contributor

JKE-be commented Dec 1, 2020

As explain by @rdeodoo it has been already improved in v13.
So since it is not a bug but an improvement in stable version, and that is just for v12, we will avoid to merge it in core.
Thanks for contribution

@JKE-be JKE-be closed this Dec 1, 2020
eLBati added a commit to takobi-online/odoo that referenced this pull request May 22, 2023
…make a lot of queries just to build the tree. Now it's way faster because it solves all in 1 query.

For example, in a production database, and after warmup, this reduced the amount of queries from 369 to 229 while browsing a category. That's 140 less queries, a lot. Also, when browsing /shop, it reduced the queries from 326 to 172. The times inside and outside Postgres also improve according to my tests.

Note: this domain could be even more constrained to avoid reading all website categories if they are collapsed, but given faed8d5 is not in v12, it ends up producing lots of more queries (by using child_of or parent_of operators) and slowing more the result than just downloading all of them

odoo#60834
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CI 🤖 Robodoo has seen passing statuses Website
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants