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

View Issue DetailsJump to Notes ] Issue History ] Print ]
ID
0027140
TypeCategorySeverityReproducibilityDate SubmittedLast Update
defect[Openbravo ERP] 07. Sales managementmajoralways2014-07-21 16:532014-08-08 19:41
ReportervmromanosView Statuspublic 
Assigned Tovmromanos 
PrioritynormalResolutionfixedFixed in Version
StatusclosedFix in branchpiFixed in SCM revision4882d76b8d6a
ProjectionnoneETAnoneTarget Version3.0PR14Q4
OSLinux 32 bitDatabasePostgreSQLJava version1.6.0_12
OS VersionDebian 5.0Database version8.3.8Ant version1.7.0
Product VersionSCM revision 
Review Assigned Toeduardo_Argal
Web browser
ModulesCore
Regression level
Regression date
Regression introduced in release
Regression introduced by commit
Triggers an Emergency PackNo
Summary

0027140: Useless usage of hex_to_int() in C_ORDER_POST affects performance

DescriptionThe hex_to_int() database function is used in several places throughout the C_Order_Post process. This function transforms from hexadecimal to integer, which is a time demanding process and in the particular case of C_Order_Post is totally useless.

There are two similar queries used for getting the quantity pending to invoice and the quantity pending to deliver where this function is used. Example:

SELECT SUM(QtyOrdered*hex_to_int(C_OrderLine_ID)) SUM(QtyDelivered*hex_to_int(C_OrderLine_ID))
INTO ToDeliver

The transformation there has no sense and creates performance problems.
Steps To ReproduceUsing PG:
-Enable function statistics:
  -In postgresql.conf set track_functions = all
  -/etc/init.d/postgresql reload

1. Create a sales order with a great number of lines (for example 400).
2. Reset pg statistics: select pg_stat_reset();
3. Book the order
4. Check function calls: select funcname, calls, total_time, self_time from pg_stat_user_functions order by self_time desc
5. Verify 'hex_to_int' is invoked more than 2000 times with a total_time greater than 600
TagsPerformance
Attached Files

- Relationships Relation Graph ] Dependency Graph ]
blocks defect 0027160 closededuardo_Argal C_Order_Post poor performance 

-  Notes
(0068769)
shuehner (administrator)
2014-07-21 17:14

That function should just be deleted, as it was created when migrating to uuid's as a kind of workaround. But i think logic should be able to easily refactorable to not need it at all.
(0068806)
hgbot (developer)
2014-07-22 15:12

Repository: erp/devel/pi
Changeset: a2ce02e621d9152f77c21133daa28e53246f7e45
Author: Víctor Martínez Romanos <victor.martinez <at> openbravo.com>
Date: Tue Jul 22 10:21:40 2014 +0200
URL: http://code.openbravo.com/erp/devel/pi/rev/a2ce02e621d9152f77c21133daa28e53246f7e45 [^]

Fixed bug 27140: Useless usage of hex_to_int()

---
M src-db/database/model/functions/C_ORDER_POST1.xml
---
(0068956)
shuehner (administrator)
2014-07-29 12:03

Note: for reviewer please verify that the changed code does really do the same functional check.
On a quick look it does not. Before it did verify if the two quantities are same per line.
Now just in global
So getting diff of +1 in one line and -1 in another line before was captured. Now it is not.
Needs to be verified if that can happen in practice.

Also if that is correct that commit should have explained that it does intentionally change technical behavior but that it does matter functionally.
(0069059)
hgbot (developer)
2014-08-04 09:51

Repository: erp/devel/pi
Changeset: 7507a81f4e636dc2a3a0520312049ac300d08950
Author: Víctor Martínez Romanos <victor.martinez <at> openbravo.com>
Date: Mon Aug 04 09:51:01 2014 +0200
URL: http://code.openbravo.com/erp/devel/pi/rev/7507a81f4e636dc2a3a0520312049ac300d08950 [^]

Issue 27140: Backout previous fix to study its consequences

---
M src-db/database/model/functions/C_ORDER_POST1.xml
---
(0069060)
vmromanos (manager)
2014-08-04 09:52

Stefan, I think you are absolutely right.

I'm reverting the fix and I will study it deeply.
(0069069)
hgbot (developer)
2014-08-04 14:49

Repository: erp/devel/pi
Changeset: 4882d76b8d6a243d3c13c02c1664de289e52220d
Author: Víctor Martínez Romanos <victor.martinez <at> openbravo.com>
Date: Mon Aug 04 14:47:58 2014 +0200
URL: http://code.openbravo.com/erp/devel/pi/rev/4882d76b8d6a243d3c13c02c1664de289e52220d [^]

Fixed bug 27140: Useless usage of hex_to_int()

---
M src-db/database/model/functions/C_ORDER_POST1.xml
---
(0069117)
hgbot (developer)
2014-08-07 18:37

Repository: erp/devel/pi
Changeset: 19e19b829b48c51c1d9a26f66feeb4a7f2a684d1
Author: Víctor Martínez Romanos <victor.martinez <at> openbravo.com>
Date: Thu Aug 07 18:35:47 2014 +0200
URL: http://code.openbravo.com/erp/devel/pi/rev/19e19b829b48c51c1d9a26f66feeb4a7f2a684d1 [^]

Issue 27140: fixed execution in Oracle

The previous SQL queries raised a ORA-01403: no data found exception when no records were found.
They have been rewritten to use count(*) instead, which either returns 0 if no records are found or 1 when it finds any record.

---
M src-db/database/model/functions/C_ORDER_POST1.xml
---
(0069209)
hudsonbot (developer)
2014-08-08 18:53

A changeset related to this issue has been promoted main and to the
Central Repository, after passing a series of tests.

Promotion changeset: https://code.openbravo.com/erp/devel/main/rev/4450016dee64 [^]
Maturity status: Test
(0069257)
hudsonbot (developer)
2014-08-08 18:54

A changeset related to this issue has been promoted main and to the
Central Repository, after passing a series of tests.

Promotion changeset: https://code.openbravo.com/erp/devel/main/rev/4450016dee64 [^]
Maturity status: Test
(0069260)
hudsonbot (developer)
2014-08-08 18:54

A changeset related to this issue has been promoted main and to the
Central Repository, after passing a series of tests.

Promotion changeset: https://code.openbravo.com/erp/devel/main/rev/4450016dee64 [^]
Maturity status: Test
(0069270)
hudsonbot (developer)
2014-08-08 18:54

A changeset related to this issue has been promoted main and to the
Central Repository, after passing a series of tests.

Promotion changeset: https://code.openbravo.com/erp/devel/main/rev/4450016dee64 [^]
Maturity status: Test
(0069273)
eduardo_Argal (developer)
2014-08-08 19:41

Code Reviewed and tested

- Issue History
Date Modified Username Field Change
2014-07-21 16:53 vmromanos New Issue
2014-07-21 16:53 vmromanos Assigned To => vmromanos
2014-07-21 16:53 vmromanos Modules => Core
2014-07-21 16:53 vmromanos Triggers an Emergency Pack => No
2014-07-21 16:54 vmromanos Tag Attached: Performance
2014-07-21 16:54 vmromanos Status new => scheduled
2014-07-21 16:54 vmromanos fix_in_branch => pi
2014-07-21 17:14 shuehner Note Added: 0068769
2014-07-21 17:15 shuehner Issue Monitored: shuehner
2014-07-22 15:12 hgbot Checkin
2014-07-22 15:12 hgbot Note Added: 0068806
2014-07-22 15:12 hgbot Status scheduled => resolved
2014-07-22 15:12 hgbot Resolution open => fixed
2014-07-22 15:12 hgbot Fixed in SCM revision => http://code.openbravo.com/erp/devel/pi/rev/a2ce02e621d9152f77c21133daa28e53246f7e45 [^]
2014-07-23 08:26 alostale Relationship added blocks 0027160
2014-07-23 10:58 mtaal Issue Monitored: mtaal
2014-07-29 12:03 shuehner Note Added: 0068956
2014-08-04 09:51 hgbot Checkin
2014-08-04 09:51 hgbot Note Added: 0069059
2014-08-04 09:52 vmromanos Note Added: 0069060
2014-08-04 09:52 vmromanos Status resolved => new
2014-08-04 09:52 vmromanos Resolution fixed => open
2014-08-04 11:02 vmromanos Status new => scheduled
2014-08-04 14:49 hgbot Checkin
2014-08-04 14:49 hgbot Note Added: 0069069
2014-08-04 14:49 hgbot Status scheduled => resolved
2014-08-04 14:49 hgbot Resolution open => fixed
2014-08-04 14:49 hgbot Fixed in SCM revision http://code.openbravo.com/erp/devel/pi/rev/a2ce02e621d9152f77c21133daa28e53246f7e45 [^] => http://code.openbravo.com/erp/devel/pi/rev/4882d76b8d6a243d3c13c02c1664de289e52220d [^]
2014-08-07 18:37 hgbot Checkin
2014-08-07 18:37 hgbot Note Added: 0069117
2014-08-08 18:53 hudsonbot Checkin
2014-08-08 18:53 hudsonbot Note Added: 0069209
2014-08-08 18:54 hudsonbot Checkin
2014-08-08 18:54 hudsonbot Note Added: 0069257
2014-08-08 18:54 hudsonbot Checkin
2014-08-08 18:54 hudsonbot Note Added: 0069260
2014-08-08 18:54 hudsonbot Checkin
2014-08-08 18:54 hudsonbot Note Added: 0069270
2014-08-08 19:41 eduardo_Argal Review Assigned To => eduardo_Argal
2014-08-08 19:41 eduardo_Argal Note Added: 0069273
2014-08-08 19:41 eduardo_Argal Status resolved => closed


Copyright © 2000 - 2009 MantisBT Group
Powered by Mantis Bugtracker