Anonymous | Login
Project:
RSS
  
News | My View | View Issues | Roadmap | Summary

View Issue DetailsJump to Notes ] Issue History ] Print ]
ID
0027712
TypeCategorySeverityReproducibilityDate SubmittedLast Update
defect[Openbravo ERP] 04. Warehouse managementmajorhave not tried2014-09-30 09:382014-11-04 06:42
ReporteralostaleView Statuspublic 
Assigned Toeduardo_Argal 
PrioritynormalResolutionfixedFixed in Version
StatusclosedFix in branchpiFixed in SCM revisionc1d30f85a429
ProjectionnoneETAnoneTarget Version
OSAnyDatabaseAnyJava version
OS VersionDatabase versionAnt version
Product VersionSCM revision 
Review Assigned Topramakrishnan
Web browser
ModulesCore
Regression level
Regression date
Regression introduced in release
Regression introduced by commit
Triggers an Emergency PackNo
Summary

0027712: slow goods receipt batch insertion

DescriptionBatch insert of good receipts with many lines is slow.
Steps To ReproduceIn a DB with the following data:

m_inout: 500 records
m_inoutline: 220K records
m_attributesetinstance: 225K records
m_storage_detail: 204K records, all of them for the same product ('TEST_IMEI_01')

This testing DB can be downloaded from: https://drive.google.com/a/openbravo.com/file/d/0B2PGxKaZaJn-amwya25HZXE2T3M/view?usp=sharing [^]

Execute the following script to create shipments (attached file to create the script):

select generateGoodReceipt('TEST_IMEI_01', 'TEST_IMEI_01', '10_IMEITEST', 10)

First parameter is a Search Key of a product already existing in F&B Client
Second Parameter is a Search Key of an existing Storage Bin
third parameter is the Document Number you wish for the Goods Receipt

See times before and after applying proposed solution:

10 lines 2600ms -> 120ms
100 lines 23470ms -> 974ms
1000 lines (not tested) -> 5959ms
10000 lines (not tested) -> 60645ms
Proposed SolutionIn this case, most of the time is taken in m_update_inventory function in queries to m_storage_detail, though the are using the unique index the number of records retrieved is high causing slowness.

Proposals:
* Testing it, removing coalesces for m_attributesetinstance_id when possible makes a huge improvement (attached diff). Review it is correct
* Additionally:
  - initial query is doing a count to know if there's ANY value -> don't count, just check if it exists
  - is it possible for initial query to return count > 1? If a single value is expected, id should be stored to be in the other queries
TagsPerformance
Attached Files? file icon GenerateGoodsReceipt.sql [^] (6,662 bytes) 2014-09-30 09:40
diff file icon update-inventory.diff [^] (4,233 bytes) 2014-09-30 09:47 [Show Content]

- Relationships Relation Graph ] Dependency Graph ]
related to defect 0027713 closededuardo_Argal slow post of goods shipment if there are many storage detail for that product 
related to defect 0027980 closeddmitry_mezentsev API Break int-857 
causes defect 0029211 closededuardo_Argal Cannot complete a goods receipt with a line without attribute set value if it has a related prereservation 

-  Notes
(0071103)
eduardo_Argal (developer)
2014-10-21 18:50

Fixes bug 27713, 27712

Adds new index for qtyonhand qtyorderonhand to storage detail table.
Changes m_attributesetinstance_id to not null for M_STORAGE_DETAIL, and M_RESERVATION_STOCK tables as almost all records where already using '0' instead of null.
Removes unnecessary coalesce
(0071104)
eduardo_Argal (developer)
2014-10-21 18:50

Repository: erp/devel/pi
Changeset: c1d30f85a429d63b04ee6470072ec5b1742acc5e
Author: Eduardo Argal Guibert <eduardo.argal <at> openbravo.com>
Date: Tue Oct 21 18:40:15 2014 +0200
URL: http://code.openbravo.com/erp/devel/pi/rev/c1d30f85a429d63b04ee6470072ec5b1742acc5e [^] [^]

Fixes bug 27713, 27712

Adds new index for qtyonhand qtyorderonhand to storage detail table.
Changes m_attributesetinstance_id to not null for M_STORAGE_DETAIL, and M_RESERVATION_STOCK tables as almost all records where already using '0' instead of null.
Removes unnecessary coalesce

---
M src-db/database/model/functions/M_CHECK_STOCK.xml
M src-db/database/model/functions/M_UPDATE_INVENTORY.xml
M src-db/database/model/tables/M_RESERVATION_STOCK.xml
M src-db/database/model/tables/M_STORAGE_DETAIL.xml
---
(0071160)
hgbot (developer)
2014-10-24 10:49

Repository: erp/devel/api-checks
Changeset: be3bd7ba7f26568a14e1491003d742029d7f30b2
Author: Eduardo Argal Guibert <eduardo.argal <at> openbravo.com>
Date: Fri Oct 24 10:48:28 2014 +0200
URL: http://code.openbravo.com/erp/devel/api-checks/rev/be3bd7ba7f26568a14e1491003d742029d7f30b2 [^]

Related with issue 27712: Fixes API Change for NOT NULL column M_ATTRIBUTESETINSTANCE_ID

There is no risk in setting it to NOT NULL as a default an onCreateDefault have been added. This column was already being populated in most of the cases with '0' as default value. It was forcing many sql to use coalesce while just few records were null (although many already contained '0')

---
M model/src-db/database/model/tables/M_RESERVATION_STOCK.xml
M model/src-db/database/model/tables/M_STORAGE_DETAIL.xml
---
(0071386)
pramakrishnan (developer)
2014-11-04 06:42

Code Review + Testing - OK.

- Issue History
Date Modified Username Field Change
2014-09-30 09:38 alostale New Issue
2014-09-30 09:38 alostale Assigned To => dmiguelez
2014-09-30 09:38 alostale Modules => Core
2014-09-30 09:38 alostale Triggers an Emergency Pack => No
2014-09-30 09:39 alostale Steps to Reproduce Updated View Revisions
2014-09-30 09:40 alostale File Added: GenerateGoodsReceipt.sql
2014-09-30 09:40 alostale Summary slow shipment batch insertion => slow goods receipt batch insertion
2014-09-30 09:40 alostale Description Updated View Revisions
2014-09-30 09:45 alostale Tag Attached: Performance
2014-09-30 09:47 alostale File Added: update-inventory.diff
2014-09-30 09:50 alostale Steps to Reproduce Updated View Revisions
2014-09-30 09:57 alostale Relationship added related to 0027713
2014-09-30 09:58 alostale Issue Monitored: alostale
2014-09-30 11:25 jonalegriaesarte Resolution time => 1414623600
2014-09-30 11:25 jonalegriaesarte Severity minor => major
2014-10-09 16:45 jpcalvente Issue Monitored: jpcalvente
2014-10-21 18:49 eduardo_Argal Status new => scheduled
2014-10-21 18:49 eduardo_Argal fix_in_branch => pi
2014-10-21 18:49 eduardo_Argal Status scheduled => resolved
2014-10-21 18:49 eduardo_Argal Fixed in SCM revision => https://code.openbravo.com/erp/devel/pi/rev/c1d30f85a429d63b04ee6470072ec5b1742acc5e [^]
2014-10-21 18:49 eduardo_Argal Resolution open => fixed
2014-10-21 18:50 eduardo_Argal Note Added: 0071103
2014-10-21 18:50 eduardo_Argal Note Added: 0071104
2014-10-24 10:49 hgbot Checkin
2014-10-24 10:49 hgbot Note Added: 0071160
2014-10-24 18:41 eduardo_Argal Relationship added related to 0027980
2014-10-31 13:09 dmitry_mezentsev Assigned To dmiguelez => Sandrahuguet
2014-10-31 13:22 Sandrahuguet Assigned To Sandrahuguet => eduardo_Argal
2014-11-04 06:42 pramakrishnan Review Assigned To => pramakrishnan
2014-11-04 06:42 pramakrishnan Note Added: 0071386
2014-11-04 06:42 pramakrishnan Status resolved => closed
2015-03-10 09:59 ngarcia Relationship added causes 0029211


Copyright © 2000 - 2009 MantisBT Group
Powered by Mantis Bugtracker