Openbravo Issue Tracking System - Openbravo ERP | ||||||||||||
View Issue Details | ||||||||||||
ID | Project | Category | View Status | Date Submitted | Last Update | |||||||
0027141 | Openbravo ERP | 07. Sales management | public | 2014-07-21 17:01 | 2014-08-18 13:34 | |||||||
Reporter | vmromanos | |||||||||||
Assigned To | vmromanos | |||||||||||
Priority | normal | Severity | minor | Reproducibility | always | |||||||
Status | closed | Resolution | fixed | |||||||||
Platform | OS | 20 | OS Version | Debian 5.0 | ||||||||
Product Version | ||||||||||||
Target Version | 3.0PR14Q4 | Fixed in Version | ||||||||||
Merge Request Status | ||||||||||||
Review Assigned To | rafaroda | |||||||||||
OBNetwork customer | ||||||||||||
Web browser | ||||||||||||
Modules | Core | |||||||||||
Support ticket | ||||||||||||
Regression level | ||||||||||||
Regression date | ||||||||||||
Regression introduced in release | ||||||||||||
Regression introduced by commit | ||||||||||||
Triggers an Emergency Pack | No | |||||||||||
Summary | 0027141: Minor performance fix in C_ORDERLINETAX_TRG | |||||||||||
Description | The C_ORDERLINETAX_TRG trigger contains the following SQL query: SELECT COUNT(C_TAX_ID) INTO v_Count FROM C_ORDERTAX WHERE C_ORDER_ID = :NEW.C_Order_ID AND C_TAX_ID = :NEW.C_TAX_ID; Later on there is an IF clause that checks v_Count > 0. In this scenario where we are not interested in the exact number of records, it's better from a performance perspective to use COUNT(1) instead. | |||||||||||
Steps To Reproduce | Using 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 the total_time for C_ORDERLINETAX_TRG 6. Apply the proposed solution 7. Verify the total_time for C_ORDERLINETAX_TRG has decreased. | |||||||||||
Proposed Solution | Use Count(1) | |||||||||||
Additional Information | ||||||||||||
Tags | Performance | |||||||||||
Relationships |
| |||||||||||
Attached Files | ||||||||||||
Issue History | ||||||||||||
Date Modified | Username | Field | Change | |||||||||
2014-07-21 17:01 | vmromanos | New Issue | ||||||||||
2014-07-21 17:01 | vmromanos | Assigned To | => vmromanos | |||||||||
2014-07-21 17:01 | vmromanos | Modules | => Core | |||||||||
2014-07-21 17:01 | vmromanos | Triggers an Emergency Pack | => No | |||||||||
2014-07-21 17:01 | vmromanos | Tag Attached: Performance | ||||||||||
2014-07-21 17:01 | vmromanos | Status | new => scheduled | |||||||||
2014-07-21 17:01 | vmromanos | fix_in_branch | => pi | |||||||||
2014-07-22 15:12 | hgbot | Checkin | ||||||||||
2014-07-22 15:12 | hgbot | Note Added: 0068807 | ||||||||||
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/796652fcb518b93f0ffb193a69ffafe6a0d997be [^] | |||||||||
2014-07-23 08:26 | alostale | Relationship added | blocks 0027160 | |||||||||
2014-07-23 10:58 | mtaal | Issue Monitored: mtaal | ||||||||||
2014-08-04 16:36 | dmitry_mezentsev | Note Added: 0069075 | ||||||||||
2014-08-08 18:53 | hudsonbot | Checkin | ||||||||||
2014-08-08 18:53 | hudsonbot | Note Added: 0069210 | ||||||||||
2014-08-08 19:50 | eduardo_Argal | Note Added: 0069274 | ||||||||||
2014-08-18 13:34 | rafaroda | Review Assigned To | => rafaroda | |||||||||
2014-08-18 13:34 | rafaroda | Note Added: 0069458 | ||||||||||
2014-08-18 13:34 | rafaroda | Status | resolved => closed |
Notes | |||||
|
|||||
|
|
||||
|
|||||
|
|
||||
|
|||||
|
|
||||
|
|||||
|
|
||||
|
|||||
|
|