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

perf: remove forcing of posting sort index on stock balance report #28902

Merged
merged 1 commit into from
Dec 15, 2021

Conversation

ankush
Copy link
Member

@ankush ankush commented Dec 15, 2021

mysql is generally smart enough to figure out which index is better
based on cardinality of index. While posting sort index is better when there are too many SLEs of same items; it's bad when there are many many item-WH combos each with comparatively less SLE count.

Now we have another index: item_wh which could be better than posting_sort index in some cases. So, let MySQL pick whatever it feels is best.

mysql is generally smart enough to figure out which index is better
based on cardinality of index. While posting sort index is better for
low item high # of SLE scenario it's bad for high item variety each with
lower count of SLEs.
@codecov
Copy link

codecov bot commented Dec 15, 2021

Codecov Report

Merging #28902 (a3752d3) into develop (29f6852) will decrease coverage by 0.02%.
The diff coverage is n/a.

@@             Coverage Diff             @@
##           develop   #28902      +/-   ##
===========================================
- Coverage    55.59%   55.56%   -0.03%     
===========================================
  Files         1126     1126              
  Lines        67191    67191              
===========================================
- Hits         37352    37337      -15     
- Misses       29839    29854      +15     
Impacted Files Coverage Δ
...rpnext/stock/report/stock_balance/stock_balance.py 78.57% <ø> (-0.60%) ⬇️
...wise_balance_history/batch_wise_balance_history.py 68.96% <0.00%> (-24.14%) ⬇️
...ctype/woocommerce_settings/woocommerce_settings.py 80.00% <0.00%> (-4.00%) ⬇️
...eport/item_variant_details/item_variant_details.py 84.33% <0.00%> (-3.62%) ⬇️
erpnext/education/doctype/student/student.py 73.68% <0.00%> (-3.16%) ⬇️
...xt/stock/report/stock_analytics/stock_analytics.py 91.08% <0.00%> (-2.98%) ⬇️
...ion/doctype/course_enrollment/course_enrollment.py 44.00% <0.00%> (-2.00%) ⬇️
.../report/stock_projected_qty/stock_projected_qty.py 88.15% <0.00%> (-1.32%) ⬇️
erpnext/stock/report/stock_ageing/stock_ageing.py 90.51% <0.00%> (-0.73%) ⬇️
... and 11 more

@ankush ankush marked this pull request as ready for review December 15, 2021 13:47
@ankush ankush merged commit 228e011 into frappe:develop Dec 15, 2021
@ankush ankush deleted the perf/stock_balance_report branch December 15, 2021 13:48
mergify bot pushed a commit that referenced this pull request Dec 15, 2021
mysql is generally smart enough to figure out which index is better
based on cardinality of index. While posting sort index is better for
low item high # of SLE scenario it's bad for high item variety each with
lower count of SLEs.

(cherry picked from commit 228e011)
@ankush ankush changed the title perf: remove forcing of posting sort index on stock balance perf: remove forcing of posting sort index on stock balance report Dec 15, 2021
ankush added a commit that referenced this pull request Dec 15, 2021
…28904)

mysql is generally smart enough to figure out which index is better
based on cardinality of index. While posting sort index is better for
low item high # of SLE scenario it's bad for high item variety each with
lower count of SLEs.

(cherry picked from commit 228e011)

Co-authored-by: Ankush Menat <ankush@frappe.io>
conncampbell pushed a commit to conncampbell/erpnext that referenced this pull request Jan 9, 2022
…8902)

mysql is generally smart enough to figure out which index is better
based on cardinality of index. While posting sort index is better for
low item high # of SLE scenario it's bad for high item variety each with
lower count of SLEs.
conncampbell pushed a commit to conncampbell/erpnext that referenced this pull request Jan 9, 2022
…8902)

mysql is generally smart enough to figure out which index is better
based on cardinality of index. While posting sort index is better for
low item high # of SLE scenario it's bad for high item variety each with
lower count of SLEs.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant