Skip to content

Improve performance of update of order_cart_rule table data#1781

Open
Quetzacoalt91 wants to merge 1 commit into
PrestaShop:7.6.xfrom
Quetzacoalt91:improve-performance-of-order_cart_rule
Open

Improve performance of update of order_cart_rule table data#1781
Quetzacoalt91 wants to merge 1 commit into
PrestaShop:7.6.xfrom
Quetzacoalt91:improve-performance-of-order_cart_rule

Conversation

@Quetzacoalt91
Copy link
Copy Markdown
Member

@Quetzacoalt91 Quetzacoalt91 commented Apr 10, 2026

Questions Answers
Description? Fix a bottleneck on a SQL request that contains 2 sub queries to the same table for each row.
Type? improvement
BC breaks? Nope
Deprecations? Nope
Fixed ticket? Fixes #1561
Sponsor company @PrestaShopCorp
How to test? Table contents of order_detail after an update to 1.7.7.0+ is the same before and after the PR.

Technical details

EXPLAIN - Original query

id select_type table type key rows Extra
1 UPDATE od index PRIMARY 100082 NULL
2 DEPENDENT SUBQUERY osd ref idx_id_order_detail 2 NULL
3 DEPENDENT SUBQUERY osd ref idx_id_order_detail 2 NULL

EXPLAIN - Optimized query

id select_type table type key rows Extra
1 UPDATE od ALL NULL 100082 NULL
1 PRIMARY ref <auto_key0> 10 NULL
2 DERIVED test_order_slip_det index idx_id_order… 9689 NULL

Timing

Query Duration
Original (correlated subquery) 2.258s
Optimized (LEFT JOIN) 0.429s
Speedup 5.3×

@Quetzacoalt91 Quetzacoalt91 self-assigned this Apr 10, 2026
@Quetzacoalt91 Quetzacoalt91 added the enhancement Type: Improvement label Apr 10, 2026
@github-project-automation github-project-automation Bot moved this to Ready for review in PR Dashboard Apr 10, 2026
@sonarqubecloud
Copy link
Copy Markdown

@Quetzacoalt91 Quetzacoalt91 changed the base branch from dev to 7.6.x April 13, 2026 08:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Status: Ready for review

Development

Successfully merging this pull request may close these issues.

autoupgrade query (1.7.7.0) for total_refunded_tax_excl is totally bottleneck on huge PrestaShop

2 participants